Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C flavor #3067

Merged
merged 3 commits into from
Nov 4, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/deploy-BETA-flavors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
# flavors-start
flavor:
[
"c_cpp",
"ci_light",
"cupcake",
"documentation",
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy-RELEASE-flavors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
# flavors-start
flavor:
[
"c_cpp",
"ci_light",
"cupcake",
"documentation",
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l

- Allow to use value `any` to always activate a linter who as a **_DIRECTORY** variable. Example: `KUBERNETES_DIRECTORY: any`

- New flavor **c_cpp**: New flavor for pure C/C++ projects

- Linter versions upgrades
- [protolint](https://github.com/yoheimuta/protolint) from 0.46.2 to **0.46.3** on 2023-10-29
- [checkov](https://www.checkov.io/) from 3.0.12 to **3.0.13** on 2023-10-30
Expand Down
360 changes: 360 additions & 0 deletions flavors/c_cpp/Dockerfile

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions flavors/c_cpp/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Automatically @generated by build.py
name: "MegaLinter"
author: "Nicolas Vuillamy"
description: "[c_cpp flavor] Combine all available linters to automatically validate your sources without configuration !"
outputs:
has_updated_sources:
description: "0 if no source file has been updated, 1 if source files has been updated"
runs:
using: "docker"
image: "docker://oxsecurity/megalinter-c_cpp:v7"
args:
- "-v"
- "/var/run/docker.sock:/var/run/docker.sock:rw"
branding:
icon: "check"
color: "green"
62 changes: 62 additions & 0 deletions flavors/c_cpp/flavor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"descriptors": [
"BASH",
"KOTLIN"
],
"label": "Optimized for pure C/C++ projects",
"linters": [
"ACTION_ACTIONLINT",
"ANSIBLE_ANSIBLE_LINT",
"BASH_EXEC",
"BASH_SHELLCHECK",
"BASH_SHFMT",
"C_CPPLINT",
"COPYPASTE_JSCPD",
"CPP_CPPLINT",
"CSS_STYLELINT",
"CSS_SCSS_LINT",
"DOCKERFILE_HADOLINT",
"EDITORCONFIG_EDITORCONFIG_CHECKER",
"ENV_DOTENV_LINTER",
"GRAPHQL_GRAPHQL_SCHEMA_LINTER",
"GROOVY_NPM_GROOVY_LINT",
"HTML_DJLINT",
"HTML_HTMLHINT",
"JSON_JSONLINT",
"JSON_ESLINT_PLUGIN_JSONC",
"JSON_V8R",
"JSON_PRETTIER",
"KOTLIN_KTLINT",
"KUBERNETES_KUBECONFORM",
"KUBERNETES_HELM",
"KUBERNETES_KUBESCAPE",
"MAKEFILE_CHECKMAKE",
"MARKDOWN_MARKDOWNLINT",
"MARKDOWN_MARKDOWN_LINK_CHECK",
"MARKDOWN_MARKDOWN_TABLE_FORMATTER",
"OPENAPI_SPECTRAL",
"PROTOBUF_PROTOLINT",
"REPOSITORY_CHECKOV",
"REPOSITORY_GIT_DIFF",
"REPOSITORY_GITLEAKS",
"REPOSITORY_GRYPE",
"REPOSITORY_SECRETLINT",
"REPOSITORY_SEMGREP",
"REPOSITORY_TRIVY",
"REPOSITORY_TRIVY_SBOM",
"REPOSITORY_TRUFFLEHOG",
"SNAKEMAKE_LINT",
"SNAKEMAKE_SNAKEFMT",
"SPELL_CSPELL",
"SPELL_PROSELINT",
"SPELL_VALE",
"SPELL_LYCHEE",
"SQL_SQL_LINT",
"SQL_SQLFLUFF",
"TEKTON_TEKTON_LINT",
"XML_XMLLINT",
"YAML_PRETTIER",
"YAML_YAMLLINT",
"YAML_V8R"
]
}
62 changes: 62 additions & 0 deletions megalinter/descriptors/all_flavors.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,66 @@
{
"c_cpp": {
"descriptors": [
"BASH",
"KOTLIN"
],
"label": "Optimized for pure C/C++ projects",
"linters": [
"ACTION_ACTIONLINT",
"ANSIBLE_ANSIBLE_LINT",
"BASH_EXEC",
"BASH_SHELLCHECK",
"BASH_SHFMT",
"C_CPPLINT",
"COPYPASTE_JSCPD",
"CPP_CPPLINT",
"CSS_STYLELINT",
"CSS_SCSS_LINT",
"DOCKERFILE_HADOLINT",
"EDITORCONFIG_EDITORCONFIG_CHECKER",
"ENV_DOTENV_LINTER",
"GRAPHQL_GRAPHQL_SCHEMA_LINTER",
"GROOVY_NPM_GROOVY_LINT",
"HTML_DJLINT",
"HTML_HTMLHINT",
"JSON_JSONLINT",
"JSON_ESLINT_PLUGIN_JSONC",
"JSON_V8R",
"JSON_PRETTIER",
"KOTLIN_KTLINT",
"KUBERNETES_KUBECONFORM",
"KUBERNETES_HELM",
"KUBERNETES_KUBESCAPE",
"MAKEFILE_CHECKMAKE",
"MARKDOWN_MARKDOWNLINT",
"MARKDOWN_MARKDOWN_LINK_CHECK",
"MARKDOWN_MARKDOWN_TABLE_FORMATTER",
"OPENAPI_SPECTRAL",
"PROTOBUF_PROTOLINT",
"REPOSITORY_CHECKOV",
"REPOSITORY_GIT_DIFF",
"REPOSITORY_GITLEAKS",
"REPOSITORY_GRYPE",
"REPOSITORY_SECRETLINT",
"REPOSITORY_SEMGREP",
"REPOSITORY_TRIVY",
"REPOSITORY_TRIVY_SBOM",
"REPOSITORY_TRUFFLEHOG",
"SNAKEMAKE_LINT",
"SNAKEMAKE_SNAKEFMT",
"SPELL_CSPELL",
"SPELL_PROSELINT",
"SPELL_VALE",
"SPELL_LYCHEE",
"SQL_SQL_LINT",
"SQL_SQLFLUFF",
"TEKTON_TEKTON_LINT",
"XML_XMLLINT",
"YAML_PRETTIER",
"YAML_YAMLLINT",
"YAML_V8R"
]
},
"ci_light": {
"descriptors": [
"BASH"
Expand Down
1 change: 1 addition & 0 deletions megalinter/descriptors/bash.megalinter-descriptor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ descriptor_flavors:
- all_flavors # Applicable to CI in any language project
- ci_light
- cupcake
- c_cpp
file_extensions:
- ".sh"
- ".bash"
Expand Down
1 change: 1 addition & 0 deletions megalinter/descriptors/c.megalinter-descriptor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ descriptor_id: C
descriptor_type: language
descriptor_flavors:
- cupcake
- c_cpp
- dotnet
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still see a problem here when it comes to clang-format being added. I would naturally put that linter in here and the cpp descriptor file.

However, if I understand it right, that would mean clang-format is also added to the cupcake, dotnet, and dotnetweb linters. I think we only want it in this new c_cpp linter. Right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@daltonv you can override descriptor_flavors at linter level, so you could add the following property on clang-format linter definition :)

     descriptor_flavors: 
        - c_cpp

- dotnetweb
file_extensions:
Expand Down
1 change: 1 addition & 0 deletions megalinter/descriptors/cpp.megalinter-descriptor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ descriptor_label: "C++"
descriptor_type: language
descriptor_flavors:
- cupcake
- c_cpp
- dotnet
- dotnetweb
file_extensions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ descriptor_flavors:
- all # Applicable to CI in any language project
- ci_light
- cupcake
- c_cpp
- documentation
- dotnet
- dotnetweb
Expand Down
Loading