From 976bc9c852a50d4d24074950f68a810ed6774433 Mon Sep 17 00:00:00 2001 From: Sean Killeen Date: Thu, 18 Jun 2020 15:12:41 -0400 Subject: [PATCH 01/51] Add environment variable for disabling errors --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 89eab906..bd8bce43 100644 --- a/Dockerfile +++ b/Dockerfile @@ -125,7 +125,8 @@ ENV GITHUB_SHA=${GITHUB_SHA} \ ANSIBLE_DIRECTORY=${ANSIBLE_DIRECTORY} \ RUN_LOCAL=${RUN_LOCAL} \ TEST_CASE_RUN=${TEST_CASE_RUN} \ - ACTIONS_RUNNER_DEBUG=${ACTIONS_RUNNER_DEBUG} + ACTIONS_RUNNER_DEBUG=${ACTIONS_RUNNER_DEBUG} \ + DISABLE_ERRORS=${DISABLE_ERRORS} ############################# # Copy scripts to container # From 4d2b216eaf25247d5fd6500feb8d3af1e42e434c Mon Sep 17 00:00:00 2001 From: Sean Killeen Date: Thu, 18 Jun 2020 15:17:59 -0400 Subject: [PATCH 02/51] Add variable and default --- lib/linter.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/linter.sh b/lib/linter.sh index 4ea4461b..92897eec 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -89,6 +89,7 @@ VALIDATE_DOCKER="${VALIDATE_DOCKER}" # Boolean to validate lang VALIDATE_GO="${VALIDATE_GO}" # Boolean to validate language VALIDATE_TERRAFORM="${VALIDATE_TERRAFORM}" # 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 ############## # Debug Vars # @@ -108,6 +109,7 @@ DEFAULT_ACTIONS_RUNNER_DEBUG='false' # Default value for debugg RAW_FILE_ARRAY=() # Array of all files that were changed READ_ONLY_CHANGE_FLAG=0 # Flag set to 1 if files changed are not txt or md TEST_CASE_FOLDER='.automation/test' # Folder for test cases we should always ignore +DEFULAT_DISABLE_ERRORS='false' # Default to enabling errors ########################## # Array of changed files # From 2338c2c98ed3e43c9affd508bd1314600993f262 Mon Sep 17 00:00:00 2001 From: Sean Killeen Date: Thu, 18 Jun 2020 15:22:13 -0400 Subject: [PATCH 03/51] Parse DEFAULT_ERRORS variable --- lib/linter.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lib/linter.sh b/lib/linter.sh index 92897eec..4188f6af 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -1096,6 +1096,30 @@ GetValidationInfo() # Set the value ANSIBLE_DIRECTORY="$TEMP_ANSIBLE_DIRECTORY" fi + + ############################### + # Get the disable errors flag # + ############################### + if [ -z "$DISABLE_ERRORS" ]; then + ################################## + # No flag passed, set to default # + ################################## + DISABLE_ERRORS="$DEFAULT_DISABLE_ERRORS" + fi + + ############################### + # Convert string to lowercase # + ############################### + DSIABLE_ERRORS=$(echo "$DISABLE_ERRORS" | awk '{print tolower($0)}') + + ############################ + # Set to false if not true # + ############################ + if [ "$DISABLE_ERRORS" != "true" ]; then + ACTIONS_RUNNER_DEBUG="false" + fi + + ############################ # Get the run verbose flag # From ff19ebe77d28621cc482b3a028da6d739d384dcc Mon Sep 17 00:00:00 2001 From: Sean Killeen Date: Thu, 18 Jun 2020 15:24:47 -0400 Subject: [PATCH 04/51] exit early if errors are disabled --- lib/linter.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/linter.sh b/lib/linter.sh index 4188f6af..f72f3e03 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -1895,6 +1895,14 @@ Footer() fi done + ################################## + # Exit with 0 if errors disabled # + ################################## + + if ${ERRORS_DISABLED} then + exit 0 + fi + ############################### # Exit with 1 if errors found # ############################### From cf8b1eddfe41db50e98843e07c71796b3af5940b Mon Sep 17 00:00:00 2001 From: Sean Killeen Date: Thu, 18 Jun 2020 15:25:54 -0400 Subject: [PATCH 05/51] Update lib/linter.sh --- lib/linter.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linter.sh b/lib/linter.sh index f72f3e03..021fa960 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -1116,7 +1116,7 @@ GetValidationInfo() # Set to false if not true # ############################ if [ "$DISABLE_ERRORS" != "true" ]; then - ACTIONS_RUNNER_DEBUG="false" + DISABLE_ERRORS="false" fi From 49c6b4fa7d7be72438a9a6c6cc437a2b542a1e28 Mon Sep 17 00:00:00 2001 From: Sean Killeen Date: Thu, 18 Jun 2020 15:26:21 -0400 Subject: [PATCH 06/51] Update lib/linter.sh --- lib/linter.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linter.sh b/lib/linter.sh index 021fa960..5c81665f 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -1899,7 +1899,7 @@ Footer() # Exit with 0 if errors disabled # ################################## - if ${ERRORS_DISABLED} then + if ${DISABLE_ERRORS} then exit 0 fi From 2ab14d961b3dfa0b7528d30529d7bfbe106d0384 Mon Sep 17 00:00:00 2001 From: Philip Mallegol-Hansen Date: Thu, 18 Jun 2020 13:23:45 -0700 Subject: [PATCH 07/51] Update README to indicate support for non-master defaults --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 35fe49c8..681796d9 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ This repository is for the **GitHub Action** to run a **Super-Linter**. It is a simple combination of various linters, written in `bash`, to help validate your source code. The end goal of this tool: -- Prevent broken code from being uploaded to *master* branches +- Prevent broken code from being uploaded to the default branch (Usually `master`) branches - Help establish coding best practices across multiple languages - Build guidelines for code layout and format - Automate the process to help streamline code reviews From 95af99a134d4cf50be67f4f856e14f7a32506e61 Mon Sep 17 00:00:00 2001 From: Sean Killeen Date: Thu, 18 Jun 2020 16:47:05 -0400 Subject: [PATCH 08/51] Update lib/linter.sh --- lib/linter.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linter.sh b/lib/linter.sh index 5c81665f..719aa9e0 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -109,7 +109,7 @@ DEFAULT_ACTIONS_RUNNER_DEBUG='false' # Default value for debugg RAW_FILE_ARRAY=() # Array of all files that were changed READ_ONLY_CHANGE_FLAG=0 # Flag set to 1 if files changed are not txt or md TEST_CASE_FOLDER='.automation/test' # Folder for test cases we should always ignore -DEFULAT_DISABLE_ERRORS='false' # Default to enabling errors +DEFAULT_DISABLE_ERRORS='false' # Default to enabling errors ########################## # Array of changed files # From dc881c2d1ab3196175244032eceb3a92d24d535c Mon Sep 17 00:00:00 2001 From: Sean Killeen Date: Thu, 18 Jun 2020 16:47:52 -0400 Subject: [PATCH 09/51] Update lib/linter.sh --- lib/linter.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linter.sh b/lib/linter.sh index 719aa9e0..6fa50fae 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -1110,7 +1110,7 @@ GetValidationInfo() ############################### # Convert string to lowercase # ############################### - DSIABLE_ERRORS=$(echo "$DISABLE_ERRORS" | awk '{print tolower($0)}') + DISABLE_ERRORS=$(echo "$DISABLE_ERRORS" | awk '{print tolower($0)}') ############################ # Set to false if not true # From 33c2dd57f7de2300b5418a6966262bad9238d430 Mon Sep 17 00:00:00 2001 From: Philip Mallegol-Hansen Date: Thu, 18 Jun 2020 14:04:41 -0700 Subject: [PATCH 10/51] Update explicit references to master Wherever the script previously used the master branch, we now substitute our DEFAULT_BRANCH variable. We also create this variable at the beginning of the script, and default it to master if no value was passed in. --- Dockerfile | 1 + lib/linter.sh | 17 +++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 89eab906..84e50039 100644 --- a/Dockerfile +++ b/Dockerfile @@ -104,6 +104,7 @@ RUN curl -Ls "$(curl -Ls https://api.github.com/repos/terraform-linters/tflint/r ENV GITHUB_SHA=${GITHUB_SHA} \ GITHUB_EVENT_PATH=${GITHUB_EVENT_PATH} \ GITHUB_WORKSPACE=${GITHUB_WORKSPACE} \ + DEFAULT_BRANCH=${DEFAULT_BRANCH} \ VALIDATE_ALL_CODEBASE=${VALIDATE_ALL_CODEBASE} \ VALIDATE_YAML=${VALIDATE_YAML} \ VALIDATE_JSON=${VALIDATE_JSON} \ diff --git a/lib/linter.sh b/lib/linter.sh index 4ea4461b..624bb9b7 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -69,6 +69,7 @@ LANGUAGE_ARRAY=('YML' 'JSON' 'XML' 'MARKDOWN' 'BASH' 'PERL' 'RUBY' 'PYTHON' GITHUB_SHA="${GITHUB_SHA}" # GitHub sha from the commit GITHUB_EVENT_PATH="${GITHUB_EVENT_PATH}" # Github Event Path GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # Github Workspace +DEFAULT_BRANCH="${DEFAULT_BRANCH:-master}" # Default Git Branch to use (master by default) ANSIBLE_DIRECTORY="${ANSIBLE_DIRECTORY}" # Ansible Directory VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE}" # Boolean to validate all files VALIDATE_YAML="${VALIDATE_YAML}" # Boolean to validate language @@ -1154,10 +1155,10 @@ BuildFileList() echo "Pulling in code history and branches..." fi - ##################################################################### - # Switch codebase back to master to get a list of all files changed # - ##################################################################### - SWITCH_CMD=$(cd "$GITHUB_WORKSPACE" || exit; git pull --quiet; git checkout master 2>&1) + ################################################################################# + # Switch codebase back to the default branch to get a list of all files changed # + ################################################################################# + SWITCH_CMD=$(cd "$GITHUB_WORKSPACE" || exit; git pull --quiet; git checkout "$DEFAULT_BRANCH" 2>&1) ####################### # Load the error code # @@ -1169,7 +1170,7 @@ BuildFileList() ############################## if [ $ERROR_CODE -ne 0 ]; then # Error - echo "Failed to switch to master branch to get files changed!" + echo "Failed to switch to $DEFAULT_BRANCH branch to get files changed!" echo "ERROR:[$SWITCH_CMD]" exit 1 fi @@ -1180,14 +1181,14 @@ BuildFileList() if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then echo "" echo "----------------------------------------------" - echo "Generating Diff with:[git diff --name-only 'master..$GITHUB_SHA' --diff-filter=d]" + echo "Generating Diff with:[git diff --name-only '$DEFAULT_BRANCH..$GITHUB_SHA' --diff-filter=d]" fi ################################################ # Get the Array of files changed in the comits # ################################################ # shellcheck disable=SC2207 - RAW_FILE_ARRAY=($(cd "$GITHUB_WORKSPACE" || exit; git diff --name-only "master..$GITHUB_SHA" --diff-filter=d 2>&1)) + RAW_FILE_ARRAY=($(cd "$GITHUB_WORKSPACE" || exit; git diff --name-only "$DEFAULT_BRANCH..$GITHUB_SHA" --diff-filter=d 2>&1)) ####################### # Load the error code # @@ -1910,7 +1911,7 @@ RunTestCases() { # This loop will run the test cases and exclude user code # This is called from the automation process to validate new code - # When a PR is opened, the new code is validated with the master branch + # When a PR is opened, the new code is validated with the default branch # version of linter.sh, and a new container is built with the latest codebase # for testing. That container is spun up, and ran, # with the flag: TEST_CASE_RUN=true From f4153396ae3f5d607eefb8dcb1140d64195250a0 Mon Sep 17 00:00:00 2001 From: Philip Mallegol-Hansen Date: Thu, 18 Jun 2020 14:06:52 -0700 Subject: [PATCH 11/51] Add documentation for the flag --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 681796d9..b7c8809f 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,7 @@ and won't run anything unexpected. | **ENV VAR** | **Default Value** | **Notes** | | --- | --- | --- | | **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. | | **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. | From 41deecee1576e86169e2a7a6d892e1093459150d Mon Sep 17 00:00:00 2001 From: Tony Brix Date: Thu, 18 Jun 2020 16:29:06 -0500 Subject: [PATCH 12/51] update coffeelint --- Dockerfile | 4 ++-- README.md | 2 +- docs/disabling-linters.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 89eab906..ff8496b5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,7 +43,7 @@ RUN npm config set package-lock false \ && npm -g --no-cache install \ markdownlint-cli \ jsonlint prettyjson \ - coffeelint \ + @coffeelint/cli \ typescript eslint \ standard \ babel-eslint \ @@ -53,7 +53,7 @@ RUN npm config set package-lock false \ && npm --no-cache install \ markdownlint-cli \ jsonlint prettyjson \ - coffeelint \ + @coffeelint/cli \ typescript eslint \ standard \ babel-eslint \ diff --git a/README.md b/README.md index 35fe49c8..cd0a06e9 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Developers on **GitHub** can call the **GitHub Action** to lint their code base | *Language* | *Linter* | | --- | --- | | **Ansible** | [ansible-lint](https://github.com/ansible/ansible-lint) | -| **CoffeeScript** | [coffeelint](http://www.coffeelint.org/) | +| **CoffeeScript** | [coffeelint](https://coffeelint.github.io/) | | **Dockerfile** | [dockerfilelint](https://github.com/replicatedhq/dockerfilelint.git) | | **Golang** | [golangci-lint](https://github.com/golangci/golangci-lint) | | **JavaScript** | [eslint](https://eslint.org/) [standard js](https://standardjs.com/) | diff --git a/docs/disabling-linters.md b/docs/disabling-linters.md index a885c9f4..14e5139f 100644 --- a/docs/disabling-linters.md +++ b/docs/disabling-linters.md @@ -319,7 +319,7 @@ Here is more data -------------------------------------------------------------------------------- ## Coffeescript -- [coffeelint](http://www.coffeelint.org/) +- [coffeelint](https://coffeelint.github.io/) ### coffeelint Config file - `.github/linters/.coffee-lint.yml` From e22eb00151aae0a8beda1292790ef918dcc453f8 Mon Sep 17 00:00:00 2001 From: iggy Date: Thu, 18 Jun 2020 16:15:52 -0700 Subject: [PATCH 13/51] Update to latest golangci-lint In setting super-linter up on one of my repo's, I ran into golangci/golangci-lint#827 which is apparently fixed in v1.23.8 (and has improved error messages in v1.24.0). I'm not sure if there's a reason for using the version that is there now, but if the latest doesn't work, please at least update to 1.24.0. Signed-off-by: iggy --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 89eab906..50c5778c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -89,7 +89,7 @@ RUN wget -qO- "https://github.com/koalaman/shellcheck/releases/download/stable/s ##################### # Install Go Linter # ##################### -ARG GO_VERSION='v1.23.7' +ARG GO_VERSION='v1.27.0' RUN wget -O- -nvq https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s "$GO_VERSION" ################## From 2cf1ae7cd850882e2871c8b3a2667f1faff25032 Mon Sep 17 00:00:00 2001 From: altanstalker Date: Thu, 18 Jun 2020 19:40:41 -0400 Subject: [PATCH 14/51] Add stylelint support to super-linter Added tests Updated readme with usage notes (disabling lines etc) to match existing content --- .automation/test/css/README.md | 13 ++++++ .automation/test/css/css_bad_01.css | 9 ++++ .automation/test/css/css_good_01.css | 22 ++++++++++ .github/linters/.stylelintrc.json | 3 ++ Dockerfile | 7 ++- README.md | 2 + TEMPLATES/.stylelintrc.json | 3 ++ docs/disabling-linters.md | 33 ++++++++++++++ lib/linter.sh | 64 ++++++++++++++++++++++++++-- 9 files changed, 151 insertions(+), 5 deletions(-) create mode 100644 .automation/test/css/README.md create mode 100644 .automation/test/css/css_bad_01.css create mode 100644 .automation/test/css/css_good_01.css create mode 100644 .github/linters/.stylelintrc.json create mode 100644 TEMPLATES/.stylelintrc.json diff --git a/.automation/test/css/README.md b/.automation/test/css/README.md new file mode 100644 index 00000000..04c7121a --- /dev/null +++ b/.automation/test/css/README.md @@ -0,0 +1,13 @@ +# CSS Test Cases +This folder holds the test cases for **CSS**. + +## Additional Docs +No Additional information is needed for this test case. + +## Good Test Cases +The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. +- **Note:** They are linted utilizing the default linter rules. + +## Bad Test Cases +The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. +- **Note:** They are linted utilizing the default linter rules. diff --git a/.automation/test/css/css_bad_01.css b/.automation/test/css/css_bad_01.css new file mode 100644 index 00000000..3c600b36 --- /dev/null +++ b/.automation/test/css/css_bad_01.css @@ -0,0 +1,9 @@ +/* Bad */ +/* Multiline */ +/* Comment */ +.selector-3[type="text"] { + background: linear-gradient(#FFFFFF, rgba(0, 0, 0, 0.8)); + box-sizing: border-box; + display: block; + color: #AAAAAA; +} diff --git a/.automation/test/css/css_good_01.css b/.automation/test/css/css_good_01.css new file mode 100644 index 00000000..a126e5b2 --- /dev/null +++ b/.automation/test/css/css_good_01.css @@ -0,0 +1,22 @@ +/** + * Multi-line comment + */ + +.selector-1, +.selector-2, +.selector-3[type="text"] { + background: linear-gradient(#fff, rgba(0, 0, 0, 0.8)); + box-sizing: border-box; + display: block; + color: #333; +} + +.selector-a, +.selector-b:not(:first-child) { + padding: 10px !important; + top: calc(calc(1em * 2) / 3); +} + +.selector-x { width: 10%; } +.selector-y { width: 20%; } +.selector-z { width: 30%; } diff --git a/.github/linters/.stylelintrc.json b/.github/linters/.stylelintrc.json new file mode 100644 index 00000000..40db42c6 --- /dev/null +++ b/.github/linters/.stylelintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "stylelint-config-standard" +} diff --git a/Dockerfile b/Dockerfile index 89eab906..36e25542 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,6 +50,8 @@ RUN npm config set package-lock false \ @typescript-eslint/eslint-plugin \ @typescript-eslint/parser \ eslint-plugin-jest \ + stylelint \ + stylelint-config-standard \ && npm --no-cache install \ markdownlint-cli \ jsonlint prettyjson \ @@ -61,7 +63,9 @@ RUN npm config set package-lock false \ eslint-config-prettier \ @typescript-eslint/eslint-plugin \ @typescript-eslint/parser \ - eslint-plugin-jest + eslint-plugin-jest \ + stylelint \ + stylelint-config-standard #################################### # Install dockerfilelint from repo # @@ -122,6 +126,7 @@ ENV GITHUB_SHA=${GITHUB_SHA} \ VALIDATE_TYPESCRIPT_STANDARD=${VALIDATE_TYPESCRIPT_STANDARD} \ VALIDATE_GO=${VALIDATE_GO} \ VALIDATE_TERRAFORM=${VALIDATE_TERRAFORM} \ + VALIDATE_CSS=${VALIDATE_CSS} \ ANSIBLE_DIRECTORY=${ANSIBLE_DIRECTORY} \ RUN_LOCAL=${RUN_LOCAL} \ TEST_CASE_RUN=${TEST_CASE_RUN} \ diff --git a/README.md b/README.md index f60cdaad..85a10a5f 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ Developers on **GitHub** can call the **GitHub Action** to lint their code base | --- | --- | | **Ansible** | [ansible-lint](https://github.com/ansible/ansible-lint) | | **CoffeeScript** | [coffeelint](http://www.coffeelint.org/) | +| **CSS** | [stylelint](https://stylelint.io/) | | **Dockerfile** | [dockerfilelint](https://github.com/replicatedhq/dockerfilelint.git) | | **Golang** | [golangci-lint](https://github.com/golangci/golangci-lint) | | **JavaScript** | [eslint](https://eslint.org/) [standard js](https://standardjs.com/) | @@ -130,6 +131,7 @@ and won't run anything unexpected. | **VALIDATE_DOCKER** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_GO** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_TERRAFORM** | `true` | Flag to enable or disable the linting process of the language. | +| **VALIDATE_CSS** | `true` | Flag to enable or disable the linting process of the language. | | **ANSIBLE_DIRECTORY** | `/ansible` | Flag to set the root directory for Ansible file location(s). | | **ACTIONS_RUNNER_DEBUG** | `false` | Flag to enable additional information about the linter, versions, and additional output. | diff --git a/TEMPLATES/.stylelintrc.json b/TEMPLATES/.stylelintrc.json new file mode 100644 index 00000000..40db42c6 --- /dev/null +++ b/TEMPLATES/.stylelintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "stylelint-config-standard" +} diff --git a/docs/disabling-linters.md b/docs/disabling-linters.md index a885c9f4..d425f078 100644 --- a/docs/disabling-linters.md +++ b/docs/disabling-linters.md @@ -20,6 +20,7 @@ Below is examples and documentation for each language and the various methods to - [Golang](#golang) - [Dockerfile](#dockerfile) - [Terraform](#terraform) +- [CSS](#stylelint) @@ -511,3 +512,35 @@ alert('foo') - There is currently **No** way to disable rules inline of the file(s) -------------------------------------------------------------------------------- + +## CSS +- [stylelint](https://stylelint.io/) + +### stylelint standard Config file +- `.github/linters/.stylelintrc.json` + +### stylelint disable single line +```css +#id { + /* stylelint-disable-next-line declaration-no-important */ + color: pink !important; +} +``` + +### stylelint disable code block +```css +/* stylelint-disable */ +a {} +/* stylelint-enable */ +``` + +### stylelint disable entire file +- You can disable entire files with the `ignoreFiles` property in `.stylelintrc.json` +```json +{ + "ignoreFiles": [ + "styles/ignored/wildcards/*.css", + "styles/ignored/specific-file.css" + ] +} +``` diff --git a/lib/linter.sh b/lib/linter.sh index 4ea4461b..84ec72b5 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -48,20 +48,25 @@ GO_LINTER_RULES="$DEFAULT_RULES_LOCATION/$GO_FILE_NAME" # Path to th # Terraform Vars TERRAFORM_FILE_NAME='.tflint.hcl' # Name of the file TERRAFORM_LINTER_RULES="$DEFAULT_RULES_LOCATION/$TERRAFORM_FILE_NAME" # Path to the Terraform lint rules +# CSS Vars +CSS_FILE_NAME='.stylelintrc.json' # Name of the file +CSS_LINTER_RULES="$DEFAULT_RULES_LOCATION/$CSS_FILE_NAME" # Path to the CSS lint rules + ####################################### # Linter array for information prints # ####################################### LINTER_ARRAY=("jsonlint" "yamllint" "xmllint" "markdownlint" "shellcheck" "pylint" "perl" "rubocop" "coffeelint" "eslint" "standard" - "ansible-lint" "/dockerfilelint/bin/dockerfilelint" "golangci-lint" "tflint") + "ansible-lint" "/dockerfilelint/bin/dockerfilelint" "golangci-lint" "tflint" + "stylelint") ############################# # Language array for prints # ############################# LANGUAGE_ARRAY=('YML' 'JSON' 'XML' 'MARKDOWN' 'BASH' 'PERL' 'RUBY' 'PYTHON' 'COFFEESCRIPT' 'ANSIBLE' 'JAVASCRIPT_STANDARD' 'JAVASCRIPT_ES' - 'TYPESCRIPT_STANDARD' 'TYPESCRIPT_ES' 'DOCKER' 'GO' 'TERRAFORM') + 'TYPESCRIPT_STANDARD' 'TYPESCRIPT_ES' 'DOCKER' 'GO' 'TERRAFORM' 'CSS') ################### # GitHub ENV Vars # @@ -88,6 +93,7 @@ VALIDATE_TYPESCRIPT_STANDARD="${VALIDATE_TYPESCRIPT_STANDARD}" # Boolean to val VALIDATE_DOCKER="${VALIDATE_DOCKER}" # Boolean to validate language VALIDATE_GO="${VALIDATE_GO}" # Boolean to validate language VALIDATE_TERRAFORM="${VALIDATE_TERRAFORM}" # Boolean to validate language +VALIDATE_CSS="${VALIDATE_CSS}" # Boolean to validate language TEST_CASE_RUN="${TEST_CASE_RUN}" # Boolean to validate only test cases ############## @@ -128,6 +134,7 @@ FILE_ARRAY_TYPESCRIPT_STANDARD=() # Array of files to check FILE_ARRAY_DOCKER=() # Array of files to check FILE_ARRAY_GO=() # Array of files to check FILE_ARRAY_TERRAFORM=() # Array of files to check +FILE_ARRAY_CSS=() # Array of files to check ############ # Counters # @@ -149,6 +156,7 @@ ERRORS_FOUND_TYPESCRIPT_ES=0 # Count of errors found ERRORS_FOUND_DOCKER=0 # Count of errors found ERRORS_FOUND_GO=0 # Count of errors found ERRORS_FOUND_TERRAFORM=0 # Count of errors found +ERRORS_FOUND_CSS=0 # Count of errors found ################################################################################ ########################## FUNCTIONS BELOW ##################################### @@ -725,6 +733,7 @@ GetValidationInfo() VALIDATE_DOCKER=$(echo "$VALIDATE_DOCKER" | awk '{print tolower($0)}') VALIDATE_GO=$(echo "$VALIDATE_GO" | awk '{print tolower($0)}') VALIDATE_TERRAFORM=$(echo "$VALIDATE_TERRAFORM" | awk '{print tolower($0)}') + VALIDATE_CSS=$(echo "$VALIDATE_CSS" | awk '{print tolower($0)') ################################################ # Determine if any linters were explicitly set # @@ -746,7 +755,8 @@ GetValidationInfo() -n "$VALIDATE_TYPESCRIPT_STANDARD" || \ -n "$VALIDATE_DOCKER" || \ -n "$VALIDATE_GO" || \ - -n "$VALIDATE_TERRAFORM" ]]; then + -n "$VALIDATE_TERRAFORM" || \ + -n "$VALIDATE_CSS" ]]; then ANY_SET="true" fi @@ -988,6 +998,20 @@ GetValidationInfo() VALIDATE_TERRAFORM="true" fi + ################################### + # Validate if we should check CSS # + ################################### + if [[ "$ANY_SET" == "true" ]]; then + # Some linter flags were set - only run those set to true + if [[ -z "$VALIDATE_CSS" ]]; then + # CSS flag was not set - default to false + VALIDATE_CSS="false" + fi + else + # No linter flags were set - default all to true + VALIDATE_CSS="true" + fi + ####################################### # Print which linters we are enabling # ####################################### @@ -1076,6 +1100,11 @@ GetValidationInfo() else PRINT_ARRAY+=("- Excluding [TERRAFORM] files in code base...") fi + if [[ "$VALIDATE_CSS" == "true" ]]; then + PRINT_ARRAY+=("- Validating [CSS] files in code base...") + else + PRINT_ARRAY+=("- Excluding [CSS] files in code base...") + fi ############################## # Validate Ansible Directory # @@ -1383,6 +1412,15 @@ BuildFileList() # Set the READ_ONLY_CHANGE_FLAG since this could be exec # ########################################################## READ_ONLY_CHANGE_FLAG=1 + elif [ "$FILE_TYPE" == "css" ]; then + ################################ + # Append the file to the array # + ################################ + FILE_ARRAY_CSS+=("$FILE") + ########################################################## + # Set the READ_ONLY_CHANGE_FLAG since this could be exec # + ########################################################## + READ_ONLY_CHANGE_FLAG=1 elif [ "$FILE" == "Dockerfile" ]; then ################################ # Append the file to the array # @@ -1888,7 +1926,8 @@ Footer() [ "$ERRORS_FOUND_DOCKER" -ne 0 ] || \ [ "$ERRORS_FOUND_GO" -ne 0 ] || \ [ "$ERRORS_FOUND_TERRAFORM" -ne 0 ] || \ - [ "$ERRORS_FOUND_RUBY" -ne 0 ]; then + [ "$ERRORS_FOUND_RUBY" -ne 0 ] || \ + [ "$ERRORS_FOUND_CSS" -ne 0 ]; then # Failed exit echo "Exiting with errors found!" exit 1 @@ -1945,6 +1984,7 @@ RunTestCases() TestCodebase "DOCKER" "/dockerfilelint/bin/dockerfilelint" "/dockerfilelint/bin/dockerfilelint" ".*\(Dockerfile\)\$" TestCodebase "ANSIBLE" "ansible-lint" "ansible-lint -v -c $ANSIBLE_LINTER_RULES" "ansible-lint" TestCodebase "TERRAFORM" "tflint" "tflint -c $TERRAFORM_LINTER_RULES" ".*\.\(tf\)\$" + TestCodebase "CSS" "stylelint" "stylelint --config $CSS_LINTER_RULES" ".*\.\(css\)\$" ################# # Footer prints # @@ -1999,6 +2039,8 @@ GetLinterRules "$GO_FILE_NAME" "$GO_LINTER_RULES" GetLinterRules "$DOCKER_FILE_NAME" "$DOCKER_LINTER_RULES" # Get Terraform rules GetLinterRules "$TERRAFORM_FILE_NAME" "$TERRAFORM_LINTER_RULES" +# Get CSS rules +GetLinterRules "$CSS_FILE_NAME" "$CSS_LINTER_RULES" ################################# # Check if were in verbose mode # @@ -2214,6 +2256,20 @@ if [ "$VALIDATE_TYPESCRIPT_STANDARD" == "true" ]; then LintCodebase "TYPESCRIPT_STANDARD" "standard" "standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin $TYPESCRIPT_STANDARD_LINTER_RULES" ".*\.\(ts\)\$" "${FILE_ARRAY_TYPESCRIPT_STANDARD[@]}" fi +############### +# CSS LINTING # +############### +if [ "$VALIDATE_CSS" == "true" ]; then + ################################# + # Get CSS standard rules # + ################################# + GetStandardRules "stylelint" + ############################# + # Lint the CSS files # + ############################# + LintCodebase "CSS" "stylelint" "stylelint --config $CSS_LINTER_RULES" ".*\.\(css\)\$" "${FILE_ARRAY_CSS[@]}" +fi + ################## # DOCKER LINTING # ################## From fd416152eb24eacbc11afd824fd7a24ed8aa4b04 Mon Sep 17 00:00:00 2001 From: Zack Koppert Date: Thu, 18 Jun 2020 22:27:23 -0700 Subject: [PATCH 15/51] Update README.md Co-authored-by: Philip Mallegol-Hansen --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1981b2fa..6391bb73 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ This repository is for the **GitHub Action** to run a **Super-Linter**. It is a simple combination of various linters, written in `bash`, to help validate your source code. The end goal of this tool: -- Prevent broken code from being uploaded to the default branch (Usually `master`) branches +- Prevent broken code from being uploaded to the default branch (Usually `master`) - Help establish coding best practices across multiple languages - Build guidelines for code layout and format - Automate the process to help streamline code reviews From d20d93fec3068fca5c8d03b31e3f56745a4eeb47 Mon Sep 17 00:00:00 2001 From: Jason Lenny Date: Fri, 19 Jun 2020 11:47:45 +0200 Subject: [PATCH 16/51] Allow for workspace location to be provided by the end user This will give more flexibility to anyone who doesn't happen to keep their files in /tmp/lint. --- lib/linter.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linter.sh b/lib/linter.sh index 4ea4461b..3ca9dd3d 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -100,7 +100,7 @@ ACTIONS_RUNNER_DEBUG="${ACTIONS_RUNNER_DEBUG}" # Boolean to see even more info # Default Vars # ################ DEFAULT_VALIDATE_ALL_CODEBASE='true' # Default value for validate all files -DEFAULT_WORKSPACE='/tmp/lint' # Default workspace if running locally +DEFAULT_WORKSPACE="${DEFAULT_WORKSPACE:-/tmp/lint}" # Default workspace if running locally DEFAULT_ANSIBLE_DIRECTORY="$GITHUB_WORKSPACE/ansible" # Default Ansible Directory DEFAULT_RUN_LOCAL='false' # Default value for debugging locally DEFAULT_TEST_CASE_RUN='false' # Flag to tell code to run only test cases From 14828eb478fbbe843ab1af973d2e2df0578ebb39 Mon Sep 17 00:00:00 2001 From: Jason Lenny Date: Fri, 19 Jun 2020 11:50:35 +0200 Subject: [PATCH 17/51] Add environment variable for running locally --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ef3de4fe..8e584d75 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,7 @@ and won't run anything unexpected. | **VALIDATE_TERRAFORM** | `true` | Flag to enable or disable the linting process of the language. | | **ANSIBLE_DIRECTORY** | `/ansible` | Flag to set the root directory for Ansible file location(s). | | **ACTIONS_RUNNER_DEBUG** | `false` | Flag to enable additional information about the linter, versions, and additional output. | +| **DEFAULT_WORKSPACE** | `/tmp/lint` | The location containing files to lint if you are running locally. | ### Template rules files You can use the **GitHub** **Super-Linter** *with* or *without* your own personal rules sets. This allows for greater flexibility for each individual code base. The Template rules all try to follow the standards we believe should be enabled at the basic level. From 248c421eda0031527e1461095269b4115f79ad8d Mon Sep 17 00:00:00 2001 From: Jason Lenny Date: Fri, 19 Jun 2020 11:52:14 +0200 Subject: [PATCH 18/51] Add instruction to running local page --- docs/run-linter-locally.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/run-linter-locally.md b/docs/run-linter-locally.md index d552f3f1..c28418b4 100644 --- a/docs/run-linter-locally.md +++ b/docs/run-linter-locally.md @@ -20,6 +20,7 @@ Once the container has been downloaded to your local environment, you can then b - `docker run -e RUN_LOCAL=true -v /path/to/local/codebase:/tmp/lint github/super-linter` - To run against a single file you can use: `docker run -e RUN_LOCAL=true -v /path/to/local/codebase/file:/tmp/lint/file github/super-linter` - **NOTE:** You need to pass the `RUN_LOCAL` flag to bypass some of the GitHub Actions checks, as well as the mapping of your local codebase to `/tmp/lint` so that the linter can pick up the code + - **NOTE:** If you want to override the `/tmp/lint` folder, you can set the `DEFAULT_WORKSPACE` environment variable to point to the folder you'd prefer to scan. - **NOTE:** The flag:`RUN_LOCAL` will set: `VALIDATE_ALL_CODEBASE` to true. This means it will scan **all** the files in the directory you have mapped. If you want to only validate a subset of your codebase, map a folder with only the files you wish to have linted ### Flags for running Locally From 7ee5d3d66a7e2c9db0bd4710f20833e49c010464 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Fri, 19 Jun 2020 06:51:04 -0700 Subject: [PATCH 19/51] Fix Links Links pointed to github-demo which is 404, updated to point to super-linter --- .github/CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 960b4afe..f553dcfc 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -40,6 +40,6 @@ If you are the current maintainer of this action: - [Using Pull Requests](https://help.github.com/articles/about-pull-requests/) - [GitHub Help](https://help.github.com) -[pulls]: https://github.com/github/github-demo-stack/pulls -[pr]: https://github.com/github/github-demo-stack/compare -[fork]: https://github.com/github/github-demo-stack/fork +[pulls]: https://github.com/github/super-linter/pulls +[pr]: https://github.com/github/super-linter/compare +[fork]: https://github.com/github/super-linter/fork From 1cb6bc76d285118aa46e6310df50c64a809e7607 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Fri, 19 Jun 2020 10:18:45 -0500 Subject: [PATCH 20/51] fixing docs --- README.md | 4 +++- TEMPLATES/README.md | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 541937e2..9e9ee22e 100644 --- a/README.md +++ b/README.md @@ -93,13 +93,15 @@ jobs: # Run Linter against code base # ################################ - name: Lint Code Base - uses: github/super-linter@v2.0.0 + uses: docker://github/super-linter:v2.0.0 env: VALIDATE_ALL_CODEBASE: false VALIDATE_ANSIBLE: false ... ``` +**NOTE:** Using the line:`uses: docker://github/super-linter:v2.0.0` will pull the image down from **DockerHub** and run the **GitHub Super-Linter**. Using the line: `uses: github/super-linter@v2.0.0` will build and compile the **GitHub Super-Linter** at build time. This can be far more costly in time... + ## Environment variables The super-linter allows you to pass the following `ENV` variables to be able to trigger different functionality. diff --git a/TEMPLATES/README.md b/TEMPLATES/README.md index bcd84269..c1ed7152 100644 --- a/TEMPLATES/README.md +++ b/TEMPLATES/README.md @@ -2,7 +2,5 @@ The files in this folder are template rules for the linters that will run against your code base. If you chose to copy these to your local repository in the directory: `.github/` they will be used at runtime. If they are not present, they will be used by default in the linter run. - - The file(s) will be parsed at run time on the local branch to load all rules needed to run the **Super-Linter** **GitHub** Action. The **GitHub** Action will inform the user via the **Checks API** on the status and success of the process. From df54ef21376c80b507ec13381f600bf989710478 Mon Sep 17 00:00:00 2001 From: Artem Medvedev Date: Fri, 19 Jun 2020 20:32:07 +0300 Subject: [PATCH 21/51] Add dotenv-linter support to super-linter (#173) --- .automation/test/env/README.md | 13 +++++++ .automation/test/env/env_bad_1.env | 5 +++ .automation/test/env/env_good_1.env | 4 +++ Dockerfile | 7 ++++ README.md | 2 ++ docs/disabling-linters.md | 20 +++++++++++ lib/linter.sh | 54 ++++++++++++++++++++++++++--- 7 files changed, 101 insertions(+), 4 deletions(-) create mode 100644 .automation/test/env/README.md create mode 100644 .automation/test/env/env_bad_1.env create mode 100644 .automation/test/env/env_good_1.env diff --git a/.automation/test/env/README.md b/.automation/test/env/README.md new file mode 100644 index 00000000..d2ef659d --- /dev/null +++ b/.automation/test/env/README.md @@ -0,0 +1,13 @@ +# ENV Test Cases +This folder holds the test cases for **ENV**. + +## Additional Docs +No Additional information is needed for this test case. + +## Good Test Cases +The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. +- **Note:** They are linted utilizing the default linter rules. + +## Bad Test Cases +The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. +- **Note:** They are linted utilizing the default linter rules. diff --git a/.automation/test/env/env_bad_1.env b/.automation/test/env/env_bad_1.env new file mode 100644 index 00000000..7361eb11 --- /dev/null +++ b/.automation/test/env/env_bad_1.env @@ -0,0 +1,5 @@ + LOGGER_LEVEL=info +MY_ENV +DB-NAME=testing +DEbUG_hTTP=true +DB_NAME=development diff --git a/.automation/test/env/env_good_1.env b/.automation/test/env/env_good_1.env new file mode 100644 index 00000000..112599ec --- /dev/null +++ b/.automation/test/env/env_good_1.env @@ -0,0 +1,4 @@ +DB_NAME=development +DEBUG_HTTP=true +LOGGER_LEVEL=info +MY_ENV= diff --git a/Dockerfile b/Dockerfile index 7f655c31..04eaa5b6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -102,6 +102,12 @@ RUN wget -O- -nvq https://raw.githubusercontent.com/golangci/golangci-lint/maste RUN curl -Ls "$(curl -Ls https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E "https://.+?_linux_amd64.zip")" -o tflint.zip && unzip tflint.zip && rm tflint.zip \ && mv "tflint" /usr/bin/ +################## +# Install dotenv-linter # +################## +RUN wget "https://github.com/dotenv-linter/dotenv-linter/releases/latest/download/dotenv-linter-alpine-x86_64.tar.gz" -O - -q | tar -xzf - \ + && mv "dotenv-linter" /usr/bin + ########################################### # Load GitHub Env Vars for GitHub Actions # ########################################### @@ -128,6 +134,7 @@ ENV GITHUB_SHA=${GITHUB_SHA} \ VALIDATE_GO=${VALIDATE_GO} \ VALIDATE_TERRAFORM=${VALIDATE_TERRAFORM} \ VALIDATE_CSS=${VALIDATE_CSS} \ + VALIDATE_ENV=${VALIDATE_ENV} \ ANSIBLE_DIRECTORY=${ANSIBLE_DIRECTORY} \ RUN_LOCAL=${RUN_LOCAL} \ TEST_CASE_RUN=${TEST_CASE_RUN} \ diff --git a/README.md b/README.md index b7f5455d..f2d11029 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ Developers on **GitHub** can call the **GitHub Action** to lint their code base | **TypeScript** | [eslint](https://eslint.org/) [standard js](https://standardjs.com/) | | **XML** | [LibXML](http://xmlsoft.org/) | | **YAML** | [YamlLint](https://github.com/adrienverge/yamllint) | +| **ENV** | [dotenv-linter](https://github.com/dotenv-linter/dotenv-linter) | ## How to use To use this **GitHub** Action you will need to complete the following: @@ -135,6 +136,7 @@ and won't run anything unexpected. | **VALIDATE_GO** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_TERRAFORM** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_CSS** | `true` | Flag to enable or disable the linting process of the language. | +| **VALIDATE_ENV** | `true` | Flag to enable or disable the linting process of the language. | | **ANSIBLE_DIRECTORY** | `/ansible` | Flag to set the root directory for Ansible file location(s). | | **ACTIONS_RUNNER_DEBUG** | `false` | Flag to enable additional information about the linter, versions, and additional output. | | **DEFAULT_WORKSPACE** | `/tmp/lint` | The location containing files to lint if you are running locally. | diff --git a/docs/disabling-linters.md b/docs/disabling-linters.md index 92187192..00a6a2dd 100644 --- a/docs/disabling-linters.md +++ b/docs/disabling-linters.md @@ -21,6 +21,7 @@ Below is examples and documentation for each language and the various methods to - [Dockerfile](#dockerfile) - [Terraform](#terraform) - [CSS](#stylelint) +- [ENV](#dotenv-linter) @@ -544,3 +545,22 @@ a {} ] } ``` + +-------------------------------------------------------------------------------- + +## ENV +- [dotenv-linter](https://github.com/dotenv-linter/dotenv-linter) + +### dotenv-linter Config file +- There is no top level *configuration file* available at this time + +### dotenv-linter disable single line +``` +# Comment line will be ignored +``` + +### dotenv-linter disable code block +- There is currently **No** way to disable rules inline of the file(s) + +### dotenv-linter disable entire file +- There is currently **No** way to disable rules inline of the file(s) diff --git a/lib/linter.sh b/lib/linter.sh index b96f44ec..945caf21 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -59,14 +59,14 @@ CSS_LINTER_RULES="$DEFAULT_RULES_LOCATION/$CSS_FILE_NAME" # Path to th LINTER_ARRAY=("jsonlint" "yamllint" "xmllint" "markdownlint" "shellcheck" "pylint" "perl" "rubocop" "coffeelint" "eslint" "standard" "ansible-lint" "/dockerfilelint/bin/dockerfilelint" "golangci-lint" "tflint" - "stylelint") + "stylelint" "dotenv-linter") ############################# # Language array for prints # ############################# LANGUAGE_ARRAY=('YML' 'JSON' 'XML' 'MARKDOWN' 'BASH' 'PERL' 'RUBY' 'PYTHON' 'COFFEESCRIPT' 'ANSIBLE' 'JAVASCRIPT_STANDARD' 'JAVASCRIPT_ES' - 'TYPESCRIPT_STANDARD' 'TYPESCRIPT_ES' 'DOCKER' 'GO' 'TERRAFORM' 'CSS') + 'TYPESCRIPT_STANDARD' 'TYPESCRIPT_ES' 'DOCKER' 'GO' 'TERRAFORM' 'CSS' "ENV") ################### # GitHub ENV Vars # @@ -95,6 +95,7 @@ VALIDATE_DOCKER="${VALIDATE_DOCKER}" # Boolean to validate lang VALIDATE_GO="${VALIDATE_GO}" # Boolean to validate language VALIDATE_TERRAFORM="${VALIDATE_TERRAFORM}" # Boolean to validate language VALIDATE_CSS="${VALIDATE_CSS}" # Boolean to validate language +VALIDATE_ENV="${VALIDATE_ENV}" # Boolean to validate language TEST_CASE_RUN="${TEST_CASE_RUN}" # Boolean to validate only test cases ############## @@ -136,6 +137,7 @@ FILE_ARRAY_DOCKER=() # Array of files to check FILE_ARRAY_GO=() # Array of files to check FILE_ARRAY_TERRAFORM=() # Array of files to check FILE_ARRAY_CSS=() # Array of files to check +FILE_ARRAY_ENV=() # Array of files to check ############ # Counters # @@ -158,6 +160,7 @@ ERRORS_FOUND_DOCKER=0 # Count of errors found ERRORS_FOUND_GO=0 # Count of errors found ERRORS_FOUND_TERRAFORM=0 # Count of errors found ERRORS_FOUND_CSS=0 # Count of errors found +ERRORS_FOUND_ENV=0 # Count of errors found ################################################################################ ########################## FUNCTIONS BELOW ##################################### @@ -735,6 +738,7 @@ GetValidationInfo() VALIDATE_GO=$(echo "$VALIDATE_GO" | awk '{print tolower($0)}') VALIDATE_TERRAFORM=$(echo "$VALIDATE_TERRAFORM" | awk '{print tolower($0)}') VALIDATE_CSS=$(echo "$VALIDATE_CSS" | awk '{print tolower($0)') + VALIDATE_ENV=$(echo "$VALIDATE_ENV" | awk '{print tolower($0)') ################################################ # Determine if any linters were explicitly set # @@ -757,7 +761,8 @@ GetValidationInfo() -n "$VALIDATE_DOCKER" || \ -n "$VALIDATE_GO" || \ -n "$VALIDATE_TERRAFORM" || \ - -n "$VALIDATE_CSS" ]]; then + -n "$VALIDATE_CSS" || \ + -n "$VALIDATE_ENV" ]]; then ANY_SET="true" fi @@ -1013,6 +1018,20 @@ GetValidationInfo() VALIDATE_CSS="true" fi + #################################### + # Validate if we should check ENV # + #################################### + if [[ "$ANY_SET" == "true" ]]; then + # Some linter flags were set - only run those set to true + if [[ -z "$VALIDATE_ENV" ]]; then + # ENV flag was not set - default to false + VALIDATE_ENV="false" + fi + else + # No linter flags were set - default all to true + VALIDATE_ENV="true" + fi + ####################################### # Print which linters we are enabling # ####################################### @@ -1106,6 +1125,11 @@ GetValidationInfo() else PRINT_ARRAY+=("- Excluding [CSS] files in code base...") fi + if [[ "$VALIDATE_ENV" == "true" ]]; then + PRINT_ARRAY+=("- Validating [ENV] files in code base...") + else + PRINT_ARRAY+=("- Excluding [ENV] files in code base...") + fi ############################## # Validate Ansible Directory # @@ -1422,6 +1446,15 @@ BuildFileList() # Set the READ_ONLY_CHANGE_FLAG since this could be exec # ########################################################## READ_ONLY_CHANGE_FLAG=1 + elif [ "$FILE_TYPE" == "env" ]; then + ################################ + # Append the file to the array # + ################################ + FILE_ARRAY_ENV+=("$FILE") + ########################################################## + # Set the READ_ONLY_CHANGE_FLAG since this could be exec # + ########################################################## + READ_ONLY_CHANGE_FLAG=1 elif [ "$FILE" == "Dockerfile" ]; then ################################ # Append the file to the array # @@ -1928,7 +1961,8 @@ Footer() [ "$ERRORS_FOUND_GO" -ne 0 ] || \ [ "$ERRORS_FOUND_TERRAFORM" -ne 0 ] || \ [ "$ERRORS_FOUND_RUBY" -ne 0 ] || \ - [ "$ERRORS_FOUND_CSS" -ne 0 ]; then + [ "$ERRORS_FOUND_CSS" -ne 0 ] || \ + [ "$ERRORS_FOUND_ENV" -ne 0 ]; then # Failed exit echo "Exiting with errors found!" exit 1 @@ -1986,6 +2020,7 @@ RunTestCases() TestCodebase "ANSIBLE" "ansible-lint" "ansible-lint -v -c $ANSIBLE_LINTER_RULES" "ansible-lint" TestCodebase "TERRAFORM" "tflint" "tflint -c $TERRAFORM_LINTER_RULES" ".*\.\(tf\)\$" TestCodebase "CSS" "stylelint" "stylelint --config $CSS_LINTER_RULES" ".*\.\(css\)\$" + TestCodebase "ENV" "dotenv-linter" "dotenv-linter" ".*\.\(env\)\$" ################# # Footer prints # @@ -2271,6 +2306,17 @@ if [ "$VALIDATE_CSS" == "true" ]; then LintCodebase "CSS" "stylelint" "stylelint --config $CSS_LINTER_RULES" ".*\.\(css\)\$" "${FILE_ARRAY_CSS[@]}" fi +################ +# ENV LINTING # +################ +if [ "$VALIDATE_ENV" == "true" ]; then + ####################### + # Lint the env files # + ####################### + # LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY" + LintCodebase "ENV" "dotenv-linter" "dotenv-linter" ".*\.\(env\)\$" "${FILE_ARRAY_ENV[@]}" +fi + ################## # DOCKER LINTING # ################## From 2f7f03efe36ee55c6cb58b2a33554f70b2affbf4 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Fri, 19 Jun 2020 12:39:08 -0500 Subject: [PATCH 22/51] fixing logic --- lib/linter.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index 6fa50fae..01e85333 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -1096,7 +1096,7 @@ GetValidationInfo() # Set the value ANSIBLE_DIRECTORY="$TEMP_ANSIBLE_DIRECTORY" fi - + ############################### # Get the disable errors flag # ############################### @@ -1119,8 +1119,6 @@ GetValidationInfo() DISABLE_ERRORS="false" fi - - ############################ # Get the run verbose flag # ############################ @@ -1898,15 +1896,13 @@ Footer() ################################## # Exit with 0 if errors disabled # ################################## - - if ${DISABLE_ERRORS} then + if [ "$DISABLE_ERRORS" == "true" ]; then + echo "WARN! Exiting with exit code:[0] as:[DISABLE_ERRORS] was set to:[$DISABLE_ERRORS]" exit 0 - fi - ############################### # Exit with 1 if errors found # ############################### - if [ "$ERRORS_FOUND_YML" -ne 0 ] || \ + elif [ "$ERRORS_FOUND_YML" -ne 0 ] || \ [ "$ERRORS_FOUND_JSON" -ne 0 ] || \ [ "$ERRORS_FOUND_XML" -ne 0 ] || \ [ "$ERRORS_FOUND_MARKDOWN" -ne 0 ] || \ From d5fa264b0def91474e83749540f38b97e3a0f3a2 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Fri, 19 Jun 2020 12:40:53 -0500 Subject: [PATCH 23/51] Adding flag to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2fd43bf2..5dff4639 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,7 @@ and won't run anything unexpected. | **VALIDATE_TERRAFORM** | `true` | Flag to enable or disable the linting process of the language. | | **ANSIBLE_DIRECTORY** | `/ansible` | Flag to set the root directory for Ansible file location(s). | | **ACTIONS_RUNNER_DEBUG** | `false` | Flag to enable additional information about the linter, versions, and additional output. | +| **DISABLE_ERRORS** | `false` | Flag to have the linter complete with exit code 0 even if errors were detected. | ### Template rules files You can use the **GitHub** **Super-Linter** *with* or *without* your own personal rules sets. This allows for greater flexibility for each individual code base. The Template rules all try to follow the standards we believe should be enabled at the basic level. From 8409d58d6900954eae648afa6669e49e0895dc94 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Fri, 19 Jun 2020 12:59:06 -0500 Subject: [PATCH 24/51] adding fence language --- docs/disabling-linters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/disabling-linters.md b/docs/disabling-linters.md index 00a6a2dd..0a2af8b6 100644 --- a/docs/disabling-linters.md +++ b/docs/disabling-linters.md @@ -555,7 +555,7 @@ a {} - There is no top level *configuration file* available at this time ### dotenv-linter disable single line -``` +```env # Comment line will be ignored ``` From ca81f52818e84f8fae685da5a09b0fd7ac044a72 Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Fri, 19 Jun 2020 20:20:20 +0200 Subject: [PATCH 25/51] Fix typo this repositories -> this repository's --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cf28abd1..2e390774 100644 --- a/README.md +++ b/README.md @@ -145,7 +145,7 @@ and won't run anything unexpected. ### Template rules files You can use the **GitHub** **Super-Linter** *with* or *without* your own personal rules sets. This allows for greater flexibility for each individual code base. The Template rules all try to follow the standards we believe should be enabled at the basic level. - Copy **any** or **all** template rules files from `TEMPLATES/` into your repository in the location: `.github/linters/` of your repository - - If your repository does not have rules files, they will fall back to defaults in this repositories `TEMPLATE` folder + - If your repository does not have rules files, they will fall back to defaults in [this repository's `TEMPLATE` folder](https://github.com/github/super-linter/tree/master/TEMPLATES) ## Disabling rules If you need to disable certain *rules* and *functionality*, you can view [Disable Rules](https://github.com/github/super-linter/blob/master/docs/disabling-linters.md) From 37a1605ba023bae727bbb57e29f996fbffe7ddc6 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Fri, 19 Jun 2020 13:31:05 -0500 Subject: [PATCH 26/51] Adding it --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cf28abd1..900996de 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ jobs: # Run Linter against code base # ################################ - name: Lint Code Base - uses: docker://github/super-linter:v2.0.0 + uses: docker://github/super-linter:v2.1.0 env: VALIDATE_ALL_CODEBASE: false VALIDATE_ANSIBLE: false From 005c8b3fcd9e65c7f0a759a5113cca928bd9344e Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Fri, 19 Jun 2020 13:32:46 -0500 Subject: [PATCH 27/51] another one... --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 900996de..de23b12c 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ jobs: ... ``` -**NOTE:** Using the line:`uses: docker://github/super-linter:v2.0.0` will pull the image down from **DockerHub** and run the **GitHub Super-Linter**. Using the line: `uses: github/super-linter@v2.0.0` will build and compile the **GitHub Super-Linter** at build time. This can be far more costly in time... +**NOTE:** Using the line:`uses: docker://github/super-linter:v2.1.0` will pull the image down from **DockerHub** and run the **GitHub Super-Linter**. Using the line: `uses: github/super-linter@v2.1.0` will build and compile the **GitHub Super-Linter** at build time. This can be far more costly in time... ## Environment variables The super-linter allows you to pass the following `ENV` variables to be able to trigger different functionality. From 871291057e153b96a6869c8645086532c279bfd5 Mon Sep 17 00:00:00 2001 From: Ricardo Fearing Date: Fri, 19 Jun 2020 16:12:20 -0400 Subject: [PATCH 28/51] The word "disable" was misspelled --- TEMPLATES/.yaml-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TEMPLATES/.yaml-lint.yml b/TEMPLATES/.yaml-lint.yml index faccea80..2aa49bd1 100644 --- a/TEMPLATES/.yaml-lint.yml +++ b/TEMPLATES/.yaml-lint.yml @@ -3,7 +3,7 @@ # These are the rules used for # # linting all the yaml files in the stack # # NOTE: # -# You can disble line with: # +# You can disable line with: # # # yamllint disable-line # ########################################### rules: From f13251355513f7dff2119bfdd5d730f21f591e3d Mon Sep 17 00:00:00 2001 From: Zack Koppert Date: Fri, 19 Jun 2020 14:21:23 -0700 Subject: [PATCH 29/51] Add link to wiki for new language support --- .github/ISSUE_TEMPLATE/feature_request.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 11fc491e..670c0420 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -18,3 +18,6 @@ A clear and concise description of any alternative solutions or features you've **Additional context** Add any other context or screenshots about the feature request here. + +**Note** +If this is a request to add a new language, after submitting this issue check out [the wiki](https://github.com/github/super-linter/wiki/Adding-new-language-support) for more info on how to accomplish that. From 79ebca41ac61010ed3ee89e0fbe1c4ea4a5023a2 Mon Sep 17 00:00:00 2001 From: Zack Koppert Date: Fri, 19 Jun 2020 14:23:15 -0700 Subject: [PATCH 30/51] Remove EOL space --- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 670c0420..caee45bc 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -20,4 +20,4 @@ A clear and concise description of any alternative solutions or features you've Add any other context or screenshots about the feature request here. **Note** -If this is a request to add a new language, after submitting this issue check out [the wiki](https://github.com/github/super-linter/wiki/Adding-new-language-support) for more info on how to accomplish that. +If this is a request to add a new language, after submitting this issue check out [the wiki](https://github.com/github/super-linter/wiki/Adding-new-language-support) for more info on how to accomplish that. From ea7a07f1d35af844113ac35a30c39e650462bbdb Mon Sep 17 00:00:00 2001 From: Philip Mallegol-Hansen Date: Fri, 19 Jun 2020 16:13:19 -0700 Subject: [PATCH 31/51] Add missing closing curly brackets --- lib/linter.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index d57c205c..ca88f558 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -739,8 +739,8 @@ GetValidationInfo() VALIDATE_DOCKER=$(echo "$VALIDATE_DOCKER" | awk '{print tolower($0)}') VALIDATE_GO=$(echo "$VALIDATE_GO" | awk '{print tolower($0)}') VALIDATE_TERRAFORM=$(echo "$VALIDATE_TERRAFORM" | awk '{print tolower($0)}') - VALIDATE_CSS=$(echo "$VALIDATE_CSS" | awk '{print tolower($0)') - VALIDATE_ENV=$(echo "$VALIDATE_ENV" | awk '{print tolower($0)') + VALIDATE_CSS=$(echo "$VALIDATE_CSS" | awk '{print tolower($0)}') + VALIDATE_ENV=$(echo "$VALIDATE_ENV" | awk '{print tolower($0)}') ################################################ # Determine if any linters were explicitly set # From 111ffcb69136b5f0890737fa5b7cf5121b03d55e Mon Sep 17 00:00:00 2001 From: Eduardo Sebastian Date: Sat, 20 Jun 2020 06:00:01 +0200 Subject: [PATCH 32/51] Fix some typos --- .automation/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.automation/README.md b/.automation/README.md index 76d3b1e4..812c2aae 100644 --- a/.automation/README.md +++ b/.automation/README.md @@ -1,12 +1,12 @@ # .automation This folder holds automation scripts to help `deploy` and `cleanup` **DockerHub** images of the **Super-Linter** -## cleanup-docker.md +## cleanup-docker.sh This script uses **GitHub Actions** so that when a PR is merged and closed, the **GitHub Action** is triggered. It will then search **DockerHub** for the image that was deployed during the development, and remove it. ## upload-docker.sh -This script uses **GitHub Actions** so that a push to the repository is committed, it will complete the following: +This script uses **GitHub Actions** so that when a push to the repository is committed, it will complete the following: - Checkout the source code - Build the **Docker** container for **Super-Linter** using that source code - Upload the container to **DockerHub** @@ -16,7 +16,7 @@ When the script is triggered in a branch, it will push with the tag:**NameOfBran - *testing* - *troubleshooting* - *debugging* -- **Note:** The branch name will be reduced to AlpaNumeric for consistency and uploading +- **Note:** The branch name will be reduced to alphanumeric for consistency and uploading ## test This folder holds all **Test Cases** to help run the *CI/CT/CD* process for the **Super-Linter**. From f5b22dfefd45fa6137d7bb3de05a24dcf1751e49 Mon Sep 17 00:00:00 2001 From: Grachev Mikhail Date: Sat, 20 Jun 2020 11:42:58 +0300 Subject: [PATCH 33/51] Fix typo --- docs/disabling-linters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/disabling-linters.md b/docs/disabling-linters.md index 0a2af8b6..b972d31c 100644 --- a/docs/disabling-linters.md +++ b/docs/disabling-linters.md @@ -477,7 +477,7 @@ alert('foo') -------------------------------------------------------------------------------- ## Dockerfile --[dockerfilelint](https://github.com/replicatedhq/dockerfilelint.git) +- [dockerfilelint](https://github.com/replicatedhq/dockerfilelint.git) ### Dockerfilelint standard Config file - `.github/linters/.dockerfilelintrc` From 46a1d1eb25a82872c9a41d9f58b9c7415a0d059e Mon Sep 17 00:00:00 2001 From: Antoine Leblanc Date: Sat, 20 Jun 2020 12:18:41 +0200 Subject: [PATCH 34/51] Update anchor for both CSS and Env linter in the table of content Signed-off-by: Antoine Leblanc --- docs/disabling-linters.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/disabling-linters.md b/docs/disabling-linters.md index 0a2af8b6..bb418456 100644 --- a/docs/disabling-linters.md +++ b/docs/disabling-linters.md @@ -20,8 +20,8 @@ Below is examples and documentation for each language and the various methods to - [Golang](#golang) - [Dockerfile](#dockerfile) - [Terraform](#terraform) -- [CSS](#stylelint) -- [ENV](#dotenv-linter) +- [CSS](#css) +- [ENV](#env) From a6c760f672f4527a5de337f65aadd42f8aa9c633 Mon Sep 17 00:00:00 2001 From: Philip Mallegol-Hansen Date: Sat, 20 Jun 2020 10:15:07 -0700 Subject: [PATCH 35/51] Advertise newest version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Our documentation should probably prompt people to use the version that doesn't contain a bug 😅 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ab2353f1..8e6d6f39 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ jobs: # Run Linter against code base # ################################ - name: Lint Code Base - uses: docker://github/super-linter:v2.1.0 + uses: docker://github/super-linter:v2.1.1 env: VALIDATE_ALL_CODEBASE: false VALIDATE_ANSIBLE: false From 502883f2245651e783baa15423f06c161084d511 Mon Sep 17 00:00:00 2001 From: Nicholas Chambers Date: Sat, 20 Jun 2020 12:51:24 -0500 Subject: [PATCH 36/51] Turn the pipe operator into the proper or operator --- lib/linter.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linter.sh b/lib/linter.sh index ca88f558..d96c55c0 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -223,7 +223,7 @@ GetLinterVersions() ############################## # Check the shell for errors # ############################## - if [ $ERROR_CODE -ne 0 ] | [ -z "${GET_VERSION_CMD[*]}" ]; then + if [ $ERROR_CODE -ne 0 ] || [ -z "${GET_VERSION_CMD[*]}" ]; then echo "WARN! Failed to get version info for:[$LINTER]" echo "---------------------------------------------" else From e4fecc1c8d69da71ccdda926050cfdf8bd2fc559 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sat, 20 Jun 2020 23:49:32 -0400 Subject: [PATCH 37/51] spelling: against --- lib/linter.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linter.sh b/lib/linter.sh index ca88f558..4874df78 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -2018,7 +2018,7 @@ RunTestCases() # version of linter.sh, and a new container is built with the latest codebase # for testing. That container is spun up, and ran, # with the flag: TEST_CASE_RUN=true - # So that the new code can be validated againt the test cases + # So that the new code can be validated against the test cases ################# # Header prints # From 246396b570fe0f270a76d011f5f1de3030d061f4 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sat, 20 Jun 2020 23:50:18 -0400 Subject: [PATCH 38/51] spelling: changeset --- lib/linter.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linter.sh b/lib/linter.sh index 4874df78..86ce20a4 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -1636,7 +1636,7 @@ LintCodebase() if [ ${#FILE_ARRAY[@]} -eq 0 ] && [ "$VALIDATE_ALL_CODEBASE" == "false" ]; then # No files found in commit and user has asked to not validate code base SKIP_FLAG=1 - # echo " - No files found in chageset to lint for language:[$FILE_TYPE]" + # echo " - No files found in changeset to lint for language:[$FILE_TYPE]" elif [ ${#FILE_ARRAY[@]} -ne 0 ]; then # We have files added to array of files to check LIST_FILES=("${FILE_ARRAY[@]}") # Copy the array into list From 44cade916171621afc84af741b3c339d126d3158 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sat, 20 Jun 2020 23:50:46 -0400 Subject: [PATCH 39/51] spelling: commits --- lib/linter.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index 86ce20a4..f9b3fbfb 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -1261,9 +1261,9 @@ BuildFileList() echo "Generating Diff with:[git diff --name-only '$DEFAULT_BRANCH..$GITHUB_SHA' --diff-filter=d]" fi - ################################################ - # Get the Array of files changed in the comits # - ################################################ + ################################################# + # Get the Array of files changed in the commits # + ################################################# # shellcheck disable=SC2207 RAW_FILE_ARRAY=($(cd "$GITHUB_WORKSPACE" || exit; git diff --name-only "$DEFAULT_BRANCH..$GITHUB_SHA" --diff-filter=d 2>&1)) From f5039368ca473977461511680de661b2a1e3c5a6 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sat, 20 Jun 2020 23:53:07 -0400 Subject: [PATCH 40/51] spelling: commencing --- .automation/test/coffeescript/coffeescript_bad_1.coffee | 2 +- .automation/test/coffeescript/coffeescript_good_1.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.automation/test/coffeescript/coffeescript_bad_1.coffee b/.automation/test/coffeescript/coffeescript_bad_1.coffee index 624cb3cd..5efeeacb 100644 --- a/.automation/test/coffeescript/coffeescript_bad_1.coffee +++ b/.automation/test/coffeescript/coffeescript_bad_1.coffee @@ -60,7 +60,7 @@ module.exports = (robot) -> ) # Drop the hammer # ################### robot.respond /drop the hammer/i, (msg) -> - msg.send "Commmencing the hammer dropping..." + msg.send "Commencing the hammer dropping..." msg.send msg.random dropHammer ############### diff --git a/.automation/test/coffeescript/coffeescript_good_1.coffee b/.automation/test/coffeescript/coffeescript_good_1.coffee index 40bc1264..62f2a4fe 100644 --- a/.automation/test/coffeescript/coffeescript_good_1.coffee +++ b/.automation/test/coffeescript/coffeescript_good_1.coffee @@ -62,7 +62,7 @@ module.exports = (robot) -> # Drop the hammer # ################### robot.respond /drop the hammer/i, (msg) -> - msg.send "Commmencing the hammer dropping..." + msg.send "Commencing the hammer dropping..." msg.send msg.random dropHammer ############### From 6e8aa549cb27e87febc9d5f920131bfbe61d6257 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sat, 20 Jun 2020 23:53:54 -0400 Subject: [PATCH 41/51] spelling: disable --- .github/linters/.yaml-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/linters/.yaml-lint.yml b/.github/linters/.yaml-lint.yml index faccea80..2aa49bd1 100644 --- a/.github/linters/.yaml-lint.yml +++ b/.github/linters/.yaml-lint.yml @@ -3,7 +3,7 @@ # These are the rules used for # # linting all the yaml files in the stack # # NOTE: # -# You can disble line with: # +# You can disable line with: # # # yamllint disable-line # ########################################### rules: From 8ec0bd8f61576c876b5eeddf466f7176b418004d Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sat, 20 Jun 2020 23:54:43 -0400 Subject: [PATCH 42/51] spelling: iterate --- lib/linter.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index f9b3fbfb..9fd5af02 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -1282,9 +1282,9 @@ BuildFileList() exit 1 fi - ################################################# - # Itterate through the array of all files found # - ################################################# + ################################################ + # Iterate through the array of all files found # + ################################################ echo "" echo "----------------------------------------------" echo "Files that have been modified in the commit(s):" From 566cd3d5574d553e598a1bd62522d146a1f8a464 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sat, 20 Jun 2020 23:55:10 -0400 Subject: [PATCH 43/51] spelling: languages --- lib/linter.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index 9fd5af02..4ca5911f 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -2075,9 +2075,9 @@ Header # needed to connect back and update checks GetGitHubVars -########################################## -# Get the langugages we need to validate # -########################################## +######################################### +# Get the languages we need to validate # +######################################### GetValidationInfo ######################## From d542dc4d76efa259a95840b3938cf2111652136f Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sat, 20 Jun 2020 23:56:56 -0400 Subject: [PATCH 44/51] spelling: numeric --- .automation/cleanup-docker.sh | 6 +++--- .automation/upload-docker.sh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.automation/cleanup-docker.sh b/.automation/cleanup-docker.sh index ba2cb758..131daf6a 100755 --- a/.automation/cleanup-docker.sh +++ b/.automation/cleanup-docker.sh @@ -115,9 +115,9 @@ ValidateInput() # Check if we need to get the name of the branch # ################################################## if [[ "$IMAGE_VERSION" != "latest" ]]; then - ################################### - # Remove non alpha-numberic chars # - ################################### + ################################## + # Remove non alpha-numeric chars # + ################################## IMAGE_VERSION=$(echo "$IMAGE_VERSION" | tr -cd '[:alnum:]') else ############################################# diff --git a/.automation/upload-docker.sh b/.automation/upload-docker.sh index 644bee8d..c41adb33 100755 --- a/.automation/upload-docker.sh +++ b/.automation/upload-docker.sh @@ -120,9 +120,9 @@ ValidateInput() exit 1 fi - ################################### - # Remove non alpha-numberic chars # - ################################### + ################################## + # Remove non alpha-numeric chars # + ################################## BRANCH_NAME=$(echo "$BRANCH_NAME" | tr -cd '[:alnum:]') ############################################ From 64c1dfe67b5304569b5edad72b89a978f0467d56 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sat, 20 Jun 2020 23:57:39 -0400 Subject: [PATCH 45/51] spelling: promote --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a93c72bc..de08dd4d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -81,7 +81,7 @@ RUN git clone https://github.com/replicatedhq/dockerfilelint.git && cd /dockerfi RUN gem install rubocop:0.74.0 rubocop-rails rubocop-github:0.13.0 # Need to fix the version as it installs 'rubocop:0.85.1' as a dep, and forces the default -# We then need to promot the correct verion, uninstall, and fix deps +# We then need to promote the correct verion, uninstall, and fix deps RUN sh -c 'gem install --default rubocop:0.74.0; yes | gem uninstall rubocop:0.85.1 -a -x -I; gem install rubocop:0.74.0' ###################### From f3b12894a2996f8829c42522ce4065bb055d5501 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sun, 21 Jun 2020 00:00:08 -0400 Subject: [PATCH 46/51] spelling: settings --- .../ansible/ghe-initialize/tasks/collectd-settings.yml | 6 +++--- .../ghe-initialize/tasks/ghe-initial-configuration.yml | 8 ++++---- .../test/ansible/ghe-initialize/tasks/splunk-settings.yml | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.automation/test/ansible/ghe-initialize/tasks/collectd-settings.yml b/.automation/test/ansible/ghe-initialize/tasks/collectd-settings.yml index f6f08485..0c73fc94 100644 --- a/.automation/test/ansible/ghe-initialize/tasks/collectd-settings.yml +++ b/.automation/test/ansible/ghe-initialize/tasks/collectd-settings.yml @@ -42,9 +42,9 @@ group: admin mode: 0644 - ######################################################### - # Set up Admin password, License, and Initial Setttings # - ######################################################### + ######################################################## + # Set up Admin password, License, and Initial Settings # + ######################################################## - name: Setup Grafana # yamllint disable shell: curl --fail -Lk \ diff --git a/.automation/test/ansible/ghe-initialize/tasks/ghe-initial-configuration.yml b/.automation/test/ansible/ghe-initialize/tasks/ghe-initial-configuration.yml index 91865d3c..d44e2101 100644 --- a/.automation/test/ansible/ghe-initialize/tasks/ghe-initial-configuration.yml +++ b/.automation/test/ansible/ghe-initialize/tasks/ghe-initial-configuration.yml @@ -57,10 +57,10 @@ group: admin mode: 0644 - ######################################################### - # Set up Admin password, License, and Initial Setttings # - ######################################################### - - name: Setup License, Admin Password, and Initial Setttings + ######################################################## + # Set up Admin password, License, and Initial Settings # + ######################################################## + - name: Setup License, Admin Password, and Initial Settings command: curl --fail -Lk \ -X POST "https://{{ ansible_host }}:8443/setup/api/start" \ -F license=@/tmp/ghe-license.ghl \ diff --git a/.automation/test/ansible/ghe-initialize/tasks/splunk-settings.yml b/.automation/test/ansible/ghe-initialize/tasks/splunk-settings.yml index 33919111..aaaa0780 100644 --- a/.automation/test/ansible/ghe-initialize/tasks/splunk-settings.yml +++ b/.automation/test/ansible/ghe-initialize/tasks/splunk-settings.yml @@ -42,9 +42,9 @@ group: admin mode: 0644 - ######################################################### - # Set up Admin password, License, and Initial Setttings # - ######################################################### + ######################################################## + # Set up Admin password, License, and Initial Settings # + ######################################################## - name: Setup Splunk # yamllint disable shell: curl --fail -Lk \ From 0408343139e86064e48d8aeb888cd83ba9ae83f1 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sun, 21 Jun 2020 00:00:46 -0400 Subject: [PATCH 47/51] spelling: typescript --- lib/linter.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linter.sh b/lib/linter.sh index 4ca5911f..2a925646 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -32,7 +32,7 @@ COFFEESCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$COFFEE_FILE_NAME" # Path to JAVASCRIPT_FILE_NAME='.eslintrc.yml' # Name of the file JAVASCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$JAVASCRIPT_FILE_NAME" # Path to the Javascript lint rules JAVASCRIPT_STANDARD_LINTER_RULES='' # ENV string to pass when running js standard -# Typecript Vars +# Typescript Vars TYPESCRIPT_FILE_NAME='.eslintrc.yml' # Name of the file TYPESCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$TYPESCRIPT_FILE_NAME" # Path to the Typescript lint rules TYPESCRIPT_STANDARD_LINTER_RULES='' # ENV string to pass when running js standard From 3bf84dbb9ca86f601618b9b318b5cfd9200a2d0c Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sun, 21 Jun 2020 00:01:16 -0400 Subject: [PATCH 48/51] spelling: version --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index de08dd4d..fc6a0212 100644 --- a/Dockerfile +++ b/Dockerfile @@ -81,7 +81,7 @@ RUN git clone https://github.com/replicatedhq/dockerfilelint.git && cd /dockerfi RUN gem install rubocop:0.74.0 rubocop-rails rubocop-github:0.13.0 # Need to fix the version as it installs 'rubocop:0.85.1' as a dep, and forces the default -# We then need to promote the correct verion, uninstall, and fix deps +# We then need to promote the correct version, uninstall, and fix deps RUN sh -c 'gem install --default rubocop:0.74.0; yes | gem uninstall rubocop:0.85.1 -a -x -I; gem install rubocop:0.74.0' ###################### From aed53d0ee5aca96103393f41d0a916ef8f9922db Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sun, 21 Jun 2020 00:02:45 -0400 Subject: [PATCH 49/51] spelling: visible --- .automation/test/javascript/javascript_bad_1.js | 2 +- .automation/test/javascript/javascript_good_1.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.automation/test/javascript/javascript_bad_1.js b/.automation/test/javascript/javascript_bad_1.js index 0ed075fc..98e5ee29 100644 --- a/.automation/test/javascript/javascript_bad_1.js +++ b/.automation/test/javascript/javascript_bad_1.js @@ -7,7 +7,7 @@ var userArray = [ 'user1' ] here is some garbage = that var teamDescription = Team of Robots -var teamPrivacy = 'closed' // closed (visibile) / secret (hidden) are options here +var teamPrivacy = 'closed' // closed (visible) / secret (hidden) are options here var teamName = process.env.GHES_TEAM_NAME var teamAccess = 'pull' // pull,push,admin options here diff --git a/.automation/test/javascript/javascript_good_1.js b/.automation/test/javascript/javascript_good_1.js index 09417a6b..ad32089f 100644 --- a/.automation/test/javascript/javascript_good_1.js +++ b/.automation/test/javascript/javascript_good_1.js @@ -5,7 +5,7 @@ var handler = createHandler({ path: '/webhook', secret: (process.env.SECRET) }) var userArray = ['user1'] var teamDescription = 'Team of Robots' -var teamPrivacy = 'closed' // closed (visibile) / secret (hidden) are options here +var teamPrivacy = 'closed' // closed (visible) / secret (hidden) are options here var teamName = process.env.GHES_TEAM_NAME var teamAccess = 'pull' // pull,push,admin options here From b2836561770b0afa46793b640e0011672576dfb4 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sun, 21 Jun 2020 00:03:30 -0400 Subject: [PATCH 50/51] spelling: whitespace --- lib/linter.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index 2a925646..d88d0a6d 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -354,9 +354,9 @@ GetStandardRules() ENV_STRING+="--env ${ENV} " done - ######################################## - # Remove trailing and ending witespace # - ######################################## + ######################################### + # Remove trailing and ending whitespace # + ######################################### if [[ "$LINTER" == "javascript" ]]; then JAVASCRIPT_STANDARD_LINTER_RULES="$(echo -e "${ENV_STRING}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" elif [[ "$LINTER" == "typescript" ]]; then From 865f6005fdda6c1cfe88238f0c68a728bd5a0001 Mon Sep 17 00:00:00 2001 From: Zack Koppert Date: Sun, 21 Jun 2020 11:02:36 -0700 Subject: [PATCH 51/51] spelling fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8e6d6f39..1cf0539b 100644 --- a/README.md +++ b/README.md @@ -163,7 +163,7 @@ The **Super-Linter** has *CI/CT/CD* configured utilizing **GitHub** Actions. - `.automation/test` contains all test cases for each language that should be validated - These **GitHub** Actions utilize the Checks API and Protected Branches to help follow the SDLC - When the Pull Request is merged to master, the **Super-Linter** **Docker** container is then updated and deployed with the new codebase - - **Note:** The branches **Docker** container is also removed from **DockerHub** to cleanup after itself + - **Note:** The branch's **Docker** container is also removed from **DockerHub** to cleanup after itself ## Limitations Below are a list of the known limitations for the **GitHub Super-Linter**: