From 21c3bb86e95fa847b8b158d4552fa34b6b0b3159 Mon Sep 17 00:00:00 2001 From: sayboras Date: Fri, 19 Jun 2020 15:11:54 +1000 Subject: [PATCH] feat(config): Add support for LINTER_PATH param To add support for LINT_PATH param. This will make super-lint more usable for existing projects, which might have lint rule file in other location. The default value is still .github/lints. Closes #161 --- Dockerfile | 1 + README.md | 1 + lib/linter.sh | 11 +++++++++++ 3 files changed, 13 insertions(+) diff --git a/Dockerfile b/Dockerfile index a93c72bc..e6a9652d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -116,6 +116,7 @@ ENV GITHUB_SHA=${GITHUB_SHA} \ GITHUB_WORKSPACE=${GITHUB_WORKSPACE} \ DEFAULT_BRANCH=${DEFAULT_BRANCH} \ VALIDATE_ALL_CODEBASE=${VALIDATE_ALL_CODEBASE} \ + LINTER_PATH=${LINTER_PATH} \ VALIDATE_YAML=${VALIDATE_YAML} \ VALIDATE_JSON=${VALIDATE_JSON} \ VALIDATE_XML=${VALIDATE_XML} \ diff --git a/README.md b/README.md index 8e6d6f39..e1db8751 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,7 @@ and won't run anything unexpected. | --- | --- | --- | | **VALIDATE_ALL_CODEBASE** | `true` | Will parse the entire repository and find all files to validate across all types. **NOTE:** When set to `false`, only **new** or **edited** files will be parsed for validation. | | **DEFAULT_BRANCH** | `master` | The name of the repository default branch. | +| **LINTER_PATH** | `.github/linters` | Directory for all linter configuration rules. | | **VALIDATE_YAML** | `true` |Flag to enable or disable the linting process of the language. | | **VALIDATE_JSON** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_XML** | `true` | Flag to enable or disable the linting process of the language. | diff --git a/lib/linter.sh b/lib/linter.sh index ca88f558..cbda9146 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -98,6 +98,7 @@ VALIDATE_CSS="${VALIDATE_CSS}" # Boolean to validate lang VALIDATE_ENV="${VALIDATE_ENV}" # Boolean to validate language TEST_CASE_RUN="${TEST_CASE_RUN}" # Boolean to validate only test cases DISABLE_ERRORS="${DISABLE_ERRORS}" # Boolean to enable warning-only output without throwing errors +LINTER_PATH="${LINTER_PATH}" # Linter Path Directory ############## # Debug Vars # @@ -569,6 +570,16 @@ GetGitHubVars() ############################### TEST_CASE_RUN=$(echo "$TEST_CASE_RUN" | awk '{print tolower($0)}') + ##################################### + # Get the Linter path # + ##################################### + if [ -z "$LINTER_PATH" ]; then + ################################### + # No flag passed, set to default # + ################################### + LINTER_PATH="$DEFAULT_LINTER_PATH" + fi + ########################## # Get the run local flag # ##########################