From 418c922120006007fad0f1839b3dae7210c0a50b Mon Sep 17 00:00:00 2001 From: Alexander Schmidt Date: Tue, 4 Mar 2025 21:13:33 +0100 Subject: [PATCH] feat: add env var for npm-groovy-lint failon level (#6530) --- README.md | 1 + lib/functions/linterCommands.sh | 2 +- lib/linter.sh | 4 ++++ test/lib/linterCommandsTest.sh | 3 +++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 87764439..e571cc4b 100644 --- a/README.md +++ b/README.md @@ -285,6 +285,7 @@ You can configure Super-linter using the following environment variables: | **GITLEAKS_CONFIG_FILE** | `.gitleaks.toml` | Filename for [GitLeaks configuration](https://github.com/zricethezav/gitleaks#configuration) (ex: `.gitleaks.toml`) | | **GITLEAKS_LOG_LEVEL** | Gitleaks default log level | Gitleaks log level. Defaults to the Gitleaks default log level. | | **GO_CONFIG_FILE** | `.golangci.yml` | Filename for [golangci-lint configuration](https://golangci-lint.run/usage/configuration/) (ex: `.golangci.toml`) | +| **GROOVY_FAILON_LEVEL** | `warning` | npm-groovy-lint failon level. | | **IGNORE_GENERATED_FILES** | `false` | If set to `true`, super-linter will ignore all the files with `@generated` marker but without `@not-generated` marker. Jscpd and Checkov ignore this variable. Use their include and ignore features to select or ignore the files to lint. | | **IGNORE_GITIGNORED_FILES** | `false` | If set to `true`, super-linter will ignore all the files that are ignored by Git. Checkov ignores this variable. Use its include and ignore features to select or ignore the files to lint. | | **JAVA_FILE_NAME** | `sun_checks.xml` | Filename for [Checkstyle configuration](https://checkstyle.sourceforge.io/config.html). Checkstyle embeds several configuration files, such as `sun_checks.xml`, `google_checks.xml` that you can use without providing your own configuration file. | diff --git a/lib/functions/linterCommands.sh b/lib/functions/linterCommands.sh index 3635cf47..f58db66f 100755 --- a/lib/functions/linterCommands.sh +++ b/lib/functions/linterCommands.sh @@ -166,7 +166,7 @@ LINTER_COMMANDS_ARRAY_GO_MODULES=(golangci-lint run --allow-parallel-runners -c LINTER_COMMANDS_ARRAY_GO_RELEASER=(goreleaser check) LINTER_COMMANDS_ARRAY_GOOGLE_JAVA_FORMAT=(java -jar /usr/bin/google-java-format) LINTER_COMMANDS_ARRAY_GRAPHQL_PRETTIER=("${PRETTIER_COMMAND[@]}") -LINTER_COMMANDS_ARRAY_GROOVY=(npm-groovy-lint -c "${GROOVY_LINTER_RULES}" --failon warning --no-insight) +LINTER_COMMANDS_ARRAY_GROOVY=(npm-groovy-lint -c "${GROOVY_LINTER_RULES}" --failon "${GROOVY_FAILON_LEVEL}" --no-insight) LINTER_COMMANDS_ARRAY_HTML=(htmlhint --config "${HTML_LINTER_RULES}") LINTER_COMMANDS_ARRAY_HTML_PRETTIER=("${PRETTIER_COMMAND[@]}") LINTER_COMMANDS_ARRAY_JAVA=(java -jar /usr/bin/checkstyle -c "${JAVA_LINTER_RULES}") diff --git a/lib/linter.sh b/lib/linter.sh index 80978aab..b1a42625 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -145,6 +145,10 @@ declare -l ENFORCE_COMMITLINT_CONFIGURATION_CHECK ENFORCE_COMMITLINT_CONFIGURATION_CHECK="${ENFORCE_COMMITLINT_CONFIGURATION_CHECK:-"false"}" export ENFORCE_COMMITLINT_CONFIGURATION_CHECK +declare GROOVY_FAILON_LEVEL +GROOVY_FAILON_LEVEL="${GROOVY_FAILON_LEVEL:-"warning"}" +export GROOVY_FAILON_LEVEL + # Define private output paths early because cleanup depends on those being defined DEFAULT_SUPER_LINTER_OUTPUT_DIRECTORY_NAME="super-linter-output" SUPER_LINTER_OUTPUT_DIRECTORY_NAME="${SUPER_LINTER_OUTPUT_DIRECTORY_NAME:-${DEFAULT_SUPER_LINTER_OUTPUT_DIRECTORY_NAME}}" diff --git a/test/lib/linterCommandsTest.sh b/test/lib/linterCommandsTest.sh index d0c01f06..f47c7986 100755 --- a/test/lib/linterCommandsTest.sh +++ b/test/lib/linterCommandsTest.sh @@ -24,11 +24,14 @@ BASH_EXEC_IGNORE_LIBRARIES="false" # shellcheck disable=SC2034 GITHUB_WORKSPACE="$(pwd)" # shellcheck disable=SC2034 +GROOVY_FAILON_LEVEL="warning" +# shellcheck disable=SC2034 IGNORE_GITIGNORED_FILES="false" # shellcheck disable=SC2034 TYPESCRIPT_STANDARD_TSCONFIG_FILE=".github/linters/tsconfig.json" # shellcheck disable=SC2034 YAML_ERROR_ON_WARNING="false" + for LANGUAGE in "${LANGUAGE_ARRAY_FOR_LINTER_RULES[@]}"; do GetLinterRules "${LANGUAGE}" "TEMPLATES" done