feat!: deprecate error_on_missing_exec_bit (#5120)

Deprecate the ERROR_ON_MISSING_EXEC_BIT variable to remove a confusing
corner case, and to align the BASH_EXEC check to how super-linter
handles other linters.
This commit is contained in:
Marco Ferrari 2024-01-10 23:54:13 +01:00 committed by GitHub
parent 3a784fcfd6
commit 3a5617235c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 31 deletions

View file

@ -107,7 +107,6 @@ jobs:
env:
ACTIONS_RUNNER_DEBUG: true
CREATE_LOG_FILE: true
ERROR_ON_MISSING_EXEC_BIT: true
VALIDATE_ALL_CODEBASE: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BRANCH: main

View file

@ -134,7 +134,6 @@ test-find: ## Run super-linter on a subdirectory with USE_FIND_ALGORITHM=true
docker run \
-e RUN_LOCAL=true \
-e ACTIONS_RUNNER_DEBUG=true \
-e ERROR_ON_MISSING_EXEC_BIT=true \
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true \
-e DEFAULT_BRANCH=main \
-e USE_FIND_ALGORITHM=true \
@ -148,7 +147,6 @@ lint-codebase: ## Lint the entire codebase
-e ACTIONS_RUNNER_DEBUG=true \
-e DEFAULT_BRANCH=main \
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true \
-e ERROR_ON_MISSING_EXEC_BIT=true \
-e RENOVATE_SHAREABLE_CONFIG_PRESET_FILE_NAMES="default.json,hoge.json" \
-e VALIDATE_ALL_CODEBASE=true \
-v "$(CURDIR):/tmp/lint" \
@ -166,7 +164,6 @@ lint-subset-files-enable-only-one-type: ## Lint a small subset of files in the c
-e ACTIONS_RUNNER_DEBUG=true \
-e DEFAULT_BRANCH=main \
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true \
-e ERROR_ON_MISSING_EXEC_BIT=true \
-e VALIDATE_ALL_CODEBASE=true \
-e VALIDATE_MARKDOWN=true \
-v "$(CURDIR):/tmp/lint" \
@ -179,7 +176,6 @@ lint-subset-files-enable-expensive-io-checks: ## Lint a small subset of files in
-e ACTIONS_RUNNER_DEBUG=true \
-e DEFAULT_BRANCH=main \
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true \
-e ERROR_ON_MISSING_EXEC_BIT=true \
-e VALIDATE_ALL_CODEBASE=true \
-e VALIDATE_ARM=true \
-e VALIDATE_CLOUDFORMATION=true \
@ -226,7 +222,6 @@ test-default-config-files: ## Test default configuration files loading
docker run \
-e RUN_LOCAL=true \
-e ACTIONS_RUNNER_DEBUG=true \
-e ERROR_ON_MISSING_EXEC_BIT=true \
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true \
-e DEFAULT_BRANCH=main \
-e USE_FIND_ALGORITHM=true \
@ -240,7 +235,6 @@ test-linters: ## Run the linters test suite
-e CHECKOV_FILE_NAME=".checkov-test-linters.yaml" \
-e DEFAULT_BRANCH=main \
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true \
-e ERROR_ON_MISSING_EXEC_BIT=true \
-e JSCPD_CONFIG_FILE=".jscpd-test-linters.json" \
-e RENOVATE_SHAREABLE_CONFIG_PRESET_FILE_NAMES="default.json,hoge.json" \
-e RUN_LOCAL=true \

View file

@ -173,7 +173,6 @@ You can configure super-linter using the following environment variables:
| **DOCKERFILE_HADOLINT_FILE_NAME** | `.hadolint.yaml` | Filename for [hadolint configuration](https://github.com/hadolint/hadolint) (ex: `.hadolintlintrc.yaml`) |
| **EDITORCONFIG_FILE_NAME** | `.ecrc` | Filename for [editorconfig-checker configuration](https://github.com/editorconfig-checker/editorconfig-checker) |
| **ENABLE_GITHUB_ACTIONS_GROUP_TITLE** | `false` if `RUN_LOCAL=true`, `true` otherwise | Flag to enable [GitHub Actions log grouping](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#grouping-log-lines). |
| **ERROR_ON_MISSING_EXEC_BIT** | `false` | If set to `false`, the `bash-exec` linter will report a warning if a shell script is not executable. If set to `true`, the `bash-exec` linter will report an error instead. |
| **FILTER_REGEX_EXCLUDE** | `none` | Regular expression defining which files will be excluded from linting (ex: `.*src/test.*`) |
| **FILTER_REGEX_INCLUDE** | `all` | Regular expression defining which files will be processed by linters (ex: `.*src/.*`) |
| **GITHUB_ACTIONS_CONFIG_FILE** | `actionlint.yml` | Filename for [Actionlint configuration](https://github.com/rhysd/actionlint/blob/main/docs/config.md) (ex: `actionlint.yml`) |

View file

@ -34,6 +34,14 @@ This section helps you migrate from super-linter `v5` to `v6`.
[Customizing static analysis](https://dart.dev/tools/analysis) in the Dart SDK
documentation.
### ERROR_ON_MISSING_EXEC_BIT
- `ERROR_ON_MISSING_EXEC_BIT` has been deprecated to align the
`VALIDATE_BASH_EXEC` check to the other linters, removing a surprising corner
case. If `VALIDATE_BASH_EXEC` is set to `true` and a shell script is not
marked as executable, the script will not pass validation. You can remove the
`ERROR_ON_MISSING_EXEC_BIT` variable from your super-linter configuration.
### Experimental batch workers
- Experimental batch support is deprecated. You can safely remove the

View file

@ -320,6 +320,9 @@ function WarnIfVariableIsSet() {
}
function ValidateDeprecatedVariables() {
# The following variables have been deprecated in v6
WarnIfVariableIsSet "${ERROR_ON_MISSING_EXEC_BIT}" "ERROR_ON_MISSING_EXEC_BIT"
WarnIfVariableIsSet "${EXPERIMENTAL_BATCH_WORKER}" "EXPERIMENTAL_BATCH_WORKER"
WarnIfVariableIsSet "${VALIDATE_JSCPD_ALL_CODEBASE}" "VALIDATE_JSCPD_ALL_CODEBASE"
WarnIfVariableIsSet "${VALIDATE_KOTLIN_ANDROID}" "VALIDATE_KOTLIN_ANDROID"

View file

@ -280,26 +280,10 @@ function LintCodebase() {
(("GOOD_TEST_CASES_COUNT++"))
if [ ${ERROR_CODE} -ne 0 ]; then
debug "Found errors. Error code: ${ERROR_CODE}, File type: ${FILE_TYPE}, Error on missing exec bit: ${ERROR_ON_MISSING_EXEC_BIT}"
if [[ ${FILE_TYPE} == "BASH_EXEC" ]] && [[ "${ERROR_ON_MISSING_EXEC_BIT}" == "false" ]]; then
########
# WARN #
########
warn "Warnings found in [${LINTER_NAME}] linter!"
warn "${LINT_CMD}"
else
#########
# Error #
#########
error "Found errors in [${LINTER_NAME}] linter!"
error "Error code: ${ERROR_CODE}. Command output:${NC}\n------\n${LINT_CMD}\n------"
# Increment the error count
(("ERRORS_FOUND_${FILE_TYPE}++"))
fi
error "Found errors when running ${LINTER_NAME} on ${FILE}. Error code: ${ERROR_CODE}. File type: ${FILE_TYPE}. Command output:${NC}\n------\n${LINT_CMD}\n------"
# Increment the error count
(("ERRORS_FOUND_${FILE_TYPE}++"))
else
###########
# Success #
###########
info " - File:${F[W]}[${FILE_NAME}]${F[B]} was linted with ${F[W]}[${LINTER_NAME}]${F[B]} successfully"
if [ -n "${LINT_CMD}" ]; then
info " - Command output:${NC}\n------\n${LINT_CMD}\n------"

View file

@ -420,10 +420,8 @@ debug "TEST_CASE_RUN: ${TEST_CASE_RUN}"
###############################################################
# Default Vars that are called in Subs and need to be ignored #
###############################################################
DEFAULT_DISABLE_ERRORS='false' # Default to enabling errors
export DEFAULT_DISABLE_ERRORS # Workaround SC2034
ERROR_ON_MISSING_EXEC_BIT="${ERROR_ON_MISSING_EXEC_BIT:-false}" # Default to report a warning if a shell script doesn't have the executable bit set to 1
export ERROR_ON_MISSING_EXEC_BIT
DEFAULT_DISABLE_ERRORS='false' # Default to enabling errors
export DEFAULT_DISABLE_ERRORS # Workaround SC2034
RAW_FILE_ARRAY=() # Array of all files that were changed
export RAW_FILE_ARRAY # Workaround SC2034
TEST_CASE_FOLDER='test/linters' # Folder for test cases we should always ignore