Merge pull request #729 from ferrarimarco/bash-exec-error

Make bash-exec errors or warnings configurable
This commit is contained in:
Lukas Gravley 2020-09-16 08:25:46 -05:00 committed by GitHub
commit 9cf76b18f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 1 deletions

View file

@ -204,6 +204,7 @@ But if you wish to select or exclude specific linters, we give you full control
| **DEFAULT_WORKSPACE** | `/tmp/lint` | The location containing files to lint if you are running locally. |
| **DISABLE_ERRORS** | `false` | Flag to have the linter complete with exit code 0 even if errors were detected. |
| **DOCKERFILE_HADOLINT_FILE_NAME** | `.hadolint.yml` | Filename for [hadolint configuration](https://github.com/hadolint/hadolint) (ex: `.hadolintlintrc.yaml`) |
| **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 arror 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/.*`) |
| **JAVASCRIPT_ES_CONFIG_FILE** | `.eslintrc.yml` | Filename for [eslint configuration](https://eslint.org/docs/user-guide/configuring#configuration-file-formats) (ex: `.eslintrc.yml`, `.eslintrc.json`) |

View file

@ -257,6 +257,8 @@ DEFAULT_IFS="${IFS}" # Get the Default IFS for up
###############################################################
DEFAULT_DISABLE_ERRORS='false' # Default to enabling errors
export DEFAULT_DISABLE_ERRORS # Workaround SC2034
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
RAW_FILE_ARRAY=() # Array of all files that were changed
export RAW_FILE_ARRAY # Workaround SC2034
READ_ONLY_CHANGE_FLAG=0 # Flag set to 1 if files changed are not txt or md

View file

@ -297,7 +297,7 @@ function LintCodebase() {
# Check the shell for errors #
##############################
if [ ${ERROR_CODE} -ne 0 ]; then
if [[ ${FILE_TYPE} == "BASH_EXEC" ]]; then
if [[ ${FILE_TYPE} == "BASH_EXEC" ]] && [[ "${ERROR_ON_MISSING_EXEC_BIT}" == "false" ]]; then
########
# WARN #
########