Don't override the secondary rules file path, if available

This commit is contained in:
Marco Ferrari 2020-10-30 12:15:16 +01:00
parent 7ed2bbc699
commit 888bc7524e
4 changed files with 19 additions and 20 deletions

View file

@ -210,7 +210,7 @@ But if you wish to select or exclude specific linters, we give you full control
| **DEFAULT_BRANCH** | `master` | The name of the repository default branch. | | **DEFAULT_BRANCH** | `master` | The name of the repository default branch. |
| **DEFAULT_WORKSPACE** | `/tmp/lint` | The location containing files to lint if you are running locally. | | **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. | | **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`) | | **DOCKERFILE_HADOLINT_FILE_NAME** | `.hadolint.yaml` | Filename for [hadolint configuration](https://github.com/hadolint/hadolint) (ex: `.hadolint.yaml`) |
| **EDITORCONFIG_FILE_NAME** | `.ecrc` | Filename for [editorconfig-checker configuration](https://github.com/editorconfig-checker/editorconfig-checker) | | **EDITORCONFIG_FILE_NAME** | `.ecrc` | Filename for [editorconfig-checker configuration](https://github.com/editorconfig-checker/editorconfig-checker) |
| **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. | | **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_EXCLUDE** | `none` | Regular expression defining which files will be excluded from linting (ex: `.*src/test.*`) |

View file

@ -311,9 +311,9 @@ analyzer:
### Hadolint standard Config file ### Hadolint standard Config file
- `.github/linters/.hadolint.yml` - `.github/linters/.hadolint.yaml`
- You can pass multiple rules and overwrite default rules - You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.hadolint.yml` - File should be located at: `.github/linters/.hadolint.yaml`
### Hadolint disable single line ### Hadolint disable single line

View file

@ -70,7 +70,7 @@ CSS_FILE_NAME="${CSS_FILE_NAME:-.stylelintrc.json}"
DART_FILE_NAME="analysis_options.yml" DART_FILE_NAME="analysis_options.yml"
# shellcheck disable=SC2034 # Variable is referenced indirectly # shellcheck disable=SC2034 # Variable is referenced indirectly
DOCKERFILE_FILE_NAME=".dockerfilelintrc" DOCKERFILE_FILE_NAME=".dockerfilelintrc"
DOCKERFILE_HADOLINT_FILE_NAME="${DOCKERFILE_HADOLINT_FILE_NAME:-.hadolint.yml}" DOCKERFILE_HADOLINT_FILE_NAME="${DOCKERFILE_HADOLINT_FILE_NAME:-.hadolint.yaml}"
EDITORCONFIG_FILE_NAME="${EDITORCONFIG_FILE_NAME:-.ecrc}" EDITORCONFIG_FILE_NAME="${EDITORCONFIG_FILE_NAME:-.ecrc}"
# shellcheck disable=SC2034 # Variable is referenced indirectly # shellcheck disable=SC2034 # Variable is referenced indirectly
GO_FILE_NAME=".golangci.yml" GO_FILE_NAME=".golangci.yml"
@ -407,10 +407,10 @@ GetLinterRules() {
# Update the path to the file location # # Update the path to the file location #
######################################## ########################################
eval "${LANGUAGE_LINTER_RULES}=${LANGUAGE_FILE_PATH}" eval "${LANGUAGE_LINTER_RULES}=${LANGUAGE_FILE_PATH}"
else
debug " -> Codebase does NOT have file:[${LANGUAGE_FILE_PATH}]" # Check if we have secondary file name to look for
# Check if we have secondary name to check elif [ -n "$SECONDARY_FILE_NAME" ]; then
if [ -n "$SECONDARY_FILE_NAME" ]; then debug " -> Codebase does NOT have file:[${LANGUAGE_FILE_PATH}]."
SECONDARY_LANGUAGE_FILE_PATH="${GITHUB_WORKSPACE}/${LINTER_RULES_PATH}/${SECONDARY_FILE_NAME}" SECONDARY_LANGUAGE_FILE_PATH="${GITHUB_WORKSPACE}/${LINTER_RULES_PATH}/${SECONDARY_FILE_NAME}"
debug "${LANGUAGE_NAME} language rule file has a secondary rules file name to check (${SECONDARY_FILE_NAME}). Path: ${SECONDARY_LANGUAGE_FILE_PATH}" debug "${LANGUAGE_NAME} language rule file has a secondary rules file name to check (${SECONDARY_FILE_NAME}). Path: ${SECONDARY_LANGUAGE_FILE_PATH}"
@ -423,8 +423,7 @@ GetLinterRules() {
######################################## ########################################
eval "${LANGUAGE_LINTER_RULES}=${SECONDARY_LANGUAGE_FILE_PATH}" eval "${LANGUAGE_LINTER_RULES}=${SECONDARY_LANGUAGE_FILE_PATH}"
fi fi
fi else
######################################################## ########################################################
# No user default provided, using the template default # # No user default provided, using the template default #
######################################################## ########################################################