From 574bef0b3cf0a707a4b44008242d7d939b709aad Mon Sep 17 00:00:00 2001 From: goedelsoup Date: Fri, 19 Jun 2020 14:30:28 -0400 Subject: [PATCH 01/67] Add support for Clojure with clj-kondo --- .automation/test/clojure/README.md | 13 +++++ .automation/test/clojure/clojure_bad_1.clj | 64 +++++++++++++++++++++ .automation/test/clojure/clojure_good_1.clj | 35 +++++++++++ Dockerfile | 9 +++ README.md | 2 + lib/linter.sh | 58 ++++++++++++++++++- 6 files changed, 178 insertions(+), 3 deletions(-) create mode 100644 .automation/test/clojure/README.md create mode 100644 .automation/test/clojure/clojure_bad_1.clj create mode 100644 .automation/test/clojure/clojure_good_1.clj diff --git a/.automation/test/clojure/README.md b/.automation/test/clojure/README.md new file mode 100644 index 00000000..6606ef5b --- /dev/null +++ b/.automation/test/clojure/README.md @@ -0,0 +1,13 @@ +# Clojure Test Cases +This folder holds the test cases for **Clojure**. + +## 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/clojure/clojure_bad_1.clj b/.automation/test/clojure/clojure_bad_1.clj new file mode 100644 index 00000000..c8366066 --- /dev/null +++ b/.automation/test/clojure/clojure_bad_1.clj @@ -0,0 +1,64 @@ +(ns foo + (:require + [clojure.string :as str] + ;; We're never using this namespace. Also, the namespaces aren't sorted. + [clojure.set :as set])) + +;; Here we made a typo, so the symbol is unresolved: +(but-last [1 2 3]) + +;; Clj-kondo knows about arities of clojure namespaces, but you can also teach +;; it about your libraries or own namespaces +(str/join) + +;; foo has an arity of 2, but we're not actually using y +(defn foo-fn [x y] + ;; this do is redundant: + (do + ;; this is handy for debugging, but please remove it before pushing your code: + (def tmp_x x) + (let [y (fn [] (inc x))] + ;; the next let can be squashed together with the previous: + (let [z y] + ;; whoopsy, calling a local function with an incorrect number of args: + (y x) + ;; also wrong: + (recur))))) + +(letfn + [(f [] (h 1)) + (h [] (f 1))]) + +(defn- private-fn []) +;; redefining it... +(defn- private-fn []) + +(defn foo [] :foo) +;; Type error, because foo doesn't return a number! +(inc (foo)) + +;; I'm tired now, let's sleep... +;; Oops, not happening because of wrong amount of args: +(Thread/sleep 1000 1 2) + +;; Here we switch to another namespace and require the previous: +(ns bar (:require [foo :as f])) + +;; Wrong arity when calling a function from the previous namespace: +(f/foo-fn) + +;; private: +(f/private-fn) + +;; this won't pass the reader: +{:a 1 :a 2} +;; and neither will this: +#{1 1} +;; nor this: +{:a 1 :b} + +(ns bar-test (:require [clojure.test :as t])) + +(t/deftest my-tests + ;; you're not actually testing something here: + (odd? (inc 1))) \ No newline at end of file diff --git a/.automation/test/clojure/clojure_good_1.clj b/.automation/test/clojure/clojure_good_1.clj new file mode 100644 index 00000000..7ea739e1 --- /dev/null +++ b/.automation/test/clojure/clojure_good_1.clj @@ -0,0 +1,35 @@ +(ns foo + (:require + [clojure.string :as str])) + +(butlast [1 2 3]) + +(str/join "" "") + +(defn foo-fn [x] + (let [y (fn [] (inc x)) + z y] + (y))) + +(letfn + [(f [g] (h g)) + (h [i] (f i))]) + +(defn foo [] 1) +(inc (foo)) + +(Thread/sleep 1000 1) + +;; Here we switch to another namespace and require the previous: +(ns bar (:require [foo :as f])) + +(f/foo-fn 1) + +{:a 1 :b 2} +#{1 2} +{:a 1 :b 2} + +(ns bar-test (:require [clojure.test :as t])) + +(t/deftest my-tests + (t/is (odd? (inc 1)))) \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 7f655c31..f66fb596 100644 --- a/Dockerfile +++ b/Dockerfile @@ -102,6 +102,14 @@ 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 clj-kondo # +##################### +RUN curl -sLO https://github.com/borkdude/clj-kondo/releases/download/v2020.06.12/clj-kondo-2020.06.12-linux-static-amd64.zip \ + && unzip clj-kondo-2020.06.12-linux-static-amd64.zip \ + && rm clj-kondo-2020.06.12-linux-static-amd64.zip \ + && mv clj-kondo /usr/bin/ + ########################################### # Load GitHub Env Vars for GitHub Actions # ########################################### @@ -128,6 +136,7 @@ ENV GITHUB_SHA=${GITHUB_SHA} \ VALIDATE_GO=${VALIDATE_GO} \ VALIDATE_TERRAFORM=${VALIDATE_TERRAFORM} \ VALIDATE_CSS=${VALIDATE_CSS} \ + VALIDATE_CLOJURE=${VALIDATE_CLOJURE} \ ANSIBLE_DIRECTORY=${ANSIBLE_DIRECTORY} \ RUN_LOCAL=${RUN_LOCAL} \ TEST_CASE_RUN=${TEST_CASE_RUN} \ diff --git a/README.md b/README.md index b7f5455d..4a001385 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) | | **CSS** | [stylelint](https://stylelint.io/) | +| **Clojure** | [clj-kondo](https://github.com/borkdude/clj-kondo) | | **CoffeeScript** | [coffeelint](https://coffeelint.github.io/) | | **Dockerfile** | [dockerfilelint](https://github.com/replicatedhq/dockerfilelint.git) | | **Golang** | [golangci-lint](https://github.com/golangci/golangci-lint) | @@ -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_CLOJURE** | `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/lib/linter.sh b/lib/linter.sh index b96f44ec..c1c46b7a 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -51,6 +51,9 @@ TERRAFORM_LINTER_RULES="$DEFAULT_RULES_LOCATION/$TERRAFORM_FILE_NAME" # Path # 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 +# Clojure Vars +CLOJURE_FILE_NAME='.clj-kondo/config.edn' +CLOJURE_LINTER_RULES="$DEFAULT_RULES_LOCATION/$CLOJURE_FILE_NAME" ####################################### @@ -59,14 +62,15 @@ 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" "clj-kondo") ############################# # 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' + 'CLOJURE') ################### # GitHub ENV Vars # @@ -95,6 +99,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_CLOJURE="${VALIDATE_CLOJURE}" # Boolean to validate language TEST_CASE_RUN="${TEST_CASE_RUN}" # Boolean to validate only test cases ############## @@ -136,6 +141,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_ARRAAY_CLOJURE=() # Array of files to check ############ # Counters # @@ -158,6 +164,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_CLOJURE=0 # Count of errors found ################################################################################ ########################## FUNCTIONS BELOW ##################################### @@ -735,6 +742,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_CLOJURE=$(echo "$VALIDATE_CLOJURE" | awk '{print tolower($0)') ################################################ # Determine if any linters were explicitly set # @@ -757,7 +765,8 @@ GetValidationInfo() -n "$VALIDATE_DOCKER" || \ -n "$VALIDATE_GO" || \ -n "$VALIDATE_TERRAFORM" || \ - -n "$VALIDATE_CSS" ]]; then + -n "$VALIDATE_CSS" || \ + -n "$VALIDATE_CLOJURE" ]]; then ANY_SET="true" fi @@ -1013,6 +1022,20 @@ GetValidationInfo() VALIDATE_CSS="true" fi + ####################################### + # Validate if we should check Clojure # + ####################################### + if [[ "$ANY_SET" == "true" ]]; then + # Some linter flags were set - only run those set to true + if [[ -z "$VALIDATE_CLOJURE" ]]; then + # Clojure flag was not set - default to false + VALIDATE_CLOJURE="false" + fi + else + # No linter flags were set - default all to true + VALIDATE_CLOJURE="true" + fi + ####################################### # Print which linters we are enabling # ####################################### @@ -1106,6 +1129,11 @@ GetValidationInfo() else PRINT_ARRAY+=("- Excluding [CSS] files in code base...") fi + if [[ "$VALIDATE_CLOJURE" == "true" ]]; then + PRINT_ARRAY+=("- Validating [CLOJURE] files in code base...") + else + PRINT_ARRAY+=("- Excluding [CLOJURE] files in code base...") + fi ############################## # Validate Ansible Directory # @@ -1431,6 +1459,15 @@ BuildFileList() # Set the READ_ONLY_CHANGE_FLAG since this could be exec # ########################################################## READ_ONLY_CHANGE_FLAG=1 + elif [ "$FILE" == "clj" ] || [ "$FILE" == "cljs" ] || [ "$FILE" == "cljc" ] || [ "$FILE" == "edn" ]; then + ################################ + # Append the file to the array # + ################################ + FILE_ARRAY_CLOJURE+=("$FILE") + ########################################################## + # Set the READ_ONLY_CHANGE_FLAG since this could be exec # + ########################################################## + READ_ONLY_CHANGE_FLAG=1 else ############################################## # Use file to see if we can parse what it is # @@ -1986,6 +2023,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 "CLOJURE" "clj-kondo" "clj-kondo --config $CLOJURE_LINTER_RULES" ".*\.\(clj\)\$" ################# # Footer prints # @@ -2282,6 +2320,20 @@ if [ "$VALIDATE_DOCKER" == "true" ]; then LintCodebase "DOCKER" "/dockerfilelint/bin/dockerfilelint" "/dockerfilelint/bin/dockerfilelint" ".*\(Dockerfile\)\$" "${FILE_ARRAY_DOCKER[@]}" fi +################### +# CLOJURE LINTING # +################### +if [ "$VALIDATE_CLOJURE" == "true" ]; then + ################################# + # Get Clojure standard rules # + ################################# + GetStandardRules "clj-kondo" + ######################### + # Lint the Clojure files # + ######################### + LintCodebase "CLOJURE" "clj-kondo" "clj-kondo --config $CLOJURE_LINTER_RULES" ".*\.\(clj\)\$" "${FILE_ARRAY_CLOJURE[@]}" +fi + ########## # Footer # ########## From 69b98486a3645a62d769dd34389072e0338e660d Mon Sep 17 00:00:00 2001 From: goedelsoup Date: Fri, 19 Jun 2020 14:31:50 -0400 Subject: [PATCH 02/67] fix typo in variable name --- lib/linter.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linter.sh b/lib/linter.sh index c1c46b7a..53828113 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -141,7 +141,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_ARRAAY_CLOJURE=() # Array of files to check +FILE_ARRAY_CLOJURE=() # Array of files to check ############ # Counters # From 8a5be8d448427c01a2eb38aec156fab7333fa7cf Mon Sep 17 00:00:00 2001 From: goedelsoup Date: Fri, 19 Jun 2020 14:34:53 -0400 Subject: [PATCH 03/67] make clj-kondo version a build arg --- Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index f66fb596..2529279a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -105,9 +105,10 @@ RUN curl -Ls "$(curl -Ls https://api.github.com/repos/terraform-linters/tflint/r ##################### # Install clj-kondo # ##################### -RUN curl -sLO https://github.com/borkdude/clj-kondo/releases/download/v2020.06.12/clj-kondo-2020.06.12-linux-static-amd64.zip \ - && unzip clj-kondo-2020.06.12-linux-static-amd64.zip \ - && rm clj-kondo-2020.06.12-linux-static-amd64.zip \ +ARG CLJ_KONDO_VERSION='2020.06.12' +RUN curl -sLO https://github.com/borkdude/clj-kondo/releases/download/v${CLJ_KONDO_VERSION}/clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip \ + && unzip clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip \ + && rm clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip \ && mv clj-kondo /usr/bin/ ########################################### From 21c3bb86e95fa847b8b158d4552fa34b6b0b3159 Mon Sep 17 00:00:00 2001 From: sayboras Date: Fri, 19 Jun 2020 15:11:54 +1000 Subject: [PATCH 04/67] 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 # ########################## From 5063d7cb6c03e3aa8c7031b5b7e3bdb46e63e4f7 Mon Sep 17 00:00:00 2001 From: goedelsoup Date: Mon, 22 Jun 2020 08:39:32 -0400 Subject: [PATCH 05/67] fix clojure file regex --- lib/linter.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index 82a3ebaf..e4c7d218 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -2088,7 +2088,7 @@ RunTestCases() 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\)\$" - TestCodebase "CLOJURE" "clj-kondo" "clj-kondo --config $CLOJURE_LINTER_RULES" ".*\.\(clj\)\$" + TestCodebase "CLOJURE" "clj-kondo" "clj-kondo --config $CLOJURE_LINTER_RULES" ".*\.\(clj\|cljs\|cljc\|edn\)\$" ################# # Footer prints # @@ -2407,7 +2407,7 @@ if [ "$VALIDATE_CLOJURE" == "true" ]; then ######################### # Lint the Clojure files # ######################### - LintCodebase "CLOJURE" "clj-kondo" "clj-kondo --config $CLOJURE_LINTER_RULES" ".*\.\(clj\)\$" "${FILE_ARRAY_CLOJURE[@]}" + LintCodebase "CLOJURE" "clj-kondo" "clj-kondo --config $CLOJURE_LINTER_RULES" ".*\.\(clj\|cljs\|cljc\|edn\)\$" "${FILE_ARRAY_CLOJURE[@]}" fi ########## From 665906af6a99cf7db6c2056ebeb2522a4ce7885f Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 23 Jun 2020 07:58:56 -0500 Subject: [PATCH 06/67] fixed some logic and names --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e6a9652d..edb96af6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -116,7 +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} \ + LINTER_RULES_PATH=${LINTER_RULES_PATH} \ VALIDATE_YAML=${VALIDATE_YAML} \ VALIDATE_JSON=${VALIDATE_JSON} \ VALIDATE_XML=${VALIDATE_XML} \ From ae13786085817cae424be56fc646b593ff9c6229 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 23 Jun 2020 07:59:14 -0500 Subject: [PATCH 07/67] now with it saved --- README.md | 2 +- lib/linter.sh | 34 ++++++++++++---------------------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index e1db8751..5a960ad1 100644 --- a/README.md +++ b/README.md @@ -118,7 +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. | +| **LINTER_RULES_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 cbda9146..9c9ec2f5 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -12,7 +12,7 @@ ########### # Default Vars DEFAULT_RULES_LOCATION='/action/lib/.automation' # Default rules files location -LINTER_PATH='.github/linters' # Default linter path +DEFAULT_LINTER_RULES_PATH='.github/linters' # Default linter path # YAML Vars YAML_FILE_NAME='.yaml-lint.yml' # Name of the file YAML_LINTER_RULES="$DEFAULT_RULES_LOCATION/$YAML_FILE_NAME" # Path to the yaml lint rules @@ -91,14 +91,14 @@ VALIDATE_JAVASCRIPT_ES="${VALIDATE_JAVASCRIPT_ES}" # Boolean to val VALIDATE_JAVASCRIPT_STANDARD="${VALIDATE_JAVASCRIPT_STANDARD}" # Boolean to validate language VALIDATE_TYPESCRIPT_ES="${VALIDATE_TYPESCRIPT_ES}" # Boolean to validate language VALIDATE_TYPESCRIPT_STANDARD="${VALIDATE_TYPESCRIPT_STANDARD}" # Boolean to validate language -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 -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 +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 +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_RULES_PATH="${LINTER_RULES_PATH:-.github/linters}" # Linter Path Directory ############## # Debug Vars # @@ -251,14 +251,14 @@ GetLinterRules() ##################################### # Validate we have the linter rules # ##################################### - if [ -f "$GITHUB_WORKSPACE/$LINTER_PATH/$FILE_NAME" ]; then + if [ -f "$GITHUB_WORKSPACE/$LINTER_RULES_PATH/$FILE_NAME" ]; then echo "----------------------------------------------" echo "User provided file:[$FILE_NAME], setting rules file..." #################################### # Copy users into default location # #################################### - CP_CMD=$(cp "$GITHUB_WORKSPACE/$LINTER_PATH/$FILE_NAME" "$FILE_LOCATION" 2>&1) + CP_CMD=$(cp "$GITHUB_WORKSPACE/$LINTER_RULES_PATH/$FILE_NAME" "$FILE_LOCATION" 2>&1) ################### # Load Error code # @@ -278,7 +278,7 @@ GetLinterRules() # No user default provided, using the template default # ######################################################## if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then - echo " -> Codebase does NOT have file:[$LINTER_PATH/$FILE_NAME], using Default rules at:[$FILE_LOCATION]" + echo " -> Codebase does NOT have file:[$LINTER_RULES_PATH/$FILE_NAME], using Default rules at:[$FILE_LOCATION]" fi fi } @@ -570,16 +570,6 @@ 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 # ########################## From 8ee90e6e35dfe1fc2a58ef894283a98bf6bf352c Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 23 Jun 2020 08:23:14 -0500 Subject: [PATCH 08/67] fixed var name --- lib/linter.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index 9c9ec2f5..33cccd05 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -12,7 +12,7 @@ ########### # Default Vars DEFAULT_RULES_LOCATION='/action/lib/.automation' # Default rules files location -DEFAULT_LINTER_RULES_PATH='.github/linters' # Default linter path +LINTER_RULES_PATH="${LINTER_RULES_PATH:-.github/linters}" # Linter Path Directory # YAML Vars YAML_FILE_NAME='.yaml-lint.yml' # Name of the file YAML_LINTER_RULES="$DEFAULT_RULES_LOCATION/$YAML_FILE_NAME" # Path to the yaml lint rules @@ -91,14 +91,13 @@ VALIDATE_JAVASCRIPT_ES="${VALIDATE_JAVASCRIPT_ES}" # Boolean to val VALIDATE_JAVASCRIPT_STANDARD="${VALIDATE_JAVASCRIPT_STANDARD}" # Boolean to validate language VALIDATE_TYPESCRIPT_ES="${VALIDATE_TYPESCRIPT_ES}" # Boolean to validate language VALIDATE_TYPESCRIPT_STANDARD="${VALIDATE_TYPESCRIPT_STANDARD}" # Boolean to validate language -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 -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_RULES_PATH="${LINTER_RULES_PATH:-.github/linters}" # Linter Path Directory +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 +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 ############## # Debug Vars # From 10c6787b1ef8efe2a8d16c13e3f3377ce0930b6f Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 23 Jun 2020 08:28:38 -0500 Subject: [PATCH 09/67] fixed collision --- lib/linter.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index d399b175..e1115cd6 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -95,10 +95,15 @@ VALIDATE_JAVASCRIPT_ES="${VALIDATE_JAVASCRIPT_ES}" # Boolean to val VALIDATE_JAVASCRIPT_STANDARD="${VALIDATE_JAVASCRIPT_STANDARD}" # Boolean to validate language VALIDATE_TYPESCRIPT_ES="${VALIDATE_TYPESCRIPT_ES}" # Boolean to validate language VALIDATE_TYPESCRIPT_STANDARD="${VALIDATE_TYPESCRIPT_STANDARD}" # Boolean to validate language +VALIDATE_DOCKER="${VALIDATE_DOCKER}" # Boolean to validate language +VALIDATE_GO="${VALIDATE_GO}" # Boolean to validate language +VALIDATE_CSS="${VALIDATE_CSS}" # Boolean to validate language +VALIDATE_ENV="${VALIDATE_ENV}" # Boolean to validate language +VALIDATE_TERRAFORM="${VALIDATE_TERRAFORM}" # Boolean to validate language VALIDATE_POWERSHELL="${VALIDATE_POWERSHELL}" # Boolean to validate language VALIDATE_KOTLIN="${VALIDATE_KOTLIN}" # 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 +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 # From 956d9863f229879d5791d18de6569743a5aa0a01 Mon Sep 17 00:00:00 2001 From: Zack Koppert Date: Tue, 23 Jun 2020 06:41:52 -0700 Subject: [PATCH 10/67] update docs to v2.2.0 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5cc133b3..414c0de4 100644 --- a/README.md +++ b/README.md @@ -98,14 +98,14 @@ jobs: # Run Linter against code base # ################################ - name: Lint Code Base - uses: docker://github/super-linter:v2.1.0 + uses: docker://github/super-linter:v2.2.0 env: VALIDATE_ALL_CODEBASE: false VALIDATE_ANSIBLE: false ... ``` -**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... +**NOTE:** Using the line:`uses: docker://github/super-linter:v2.2.0` will pull the image down from **DockerHub** and run the **GitHub Super-Linter**. Using the line: `uses: github/super-linter@v2.2.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 7a298710713bbbe52efc450161aa7770ccc59fb8 Mon Sep 17 00:00:00 2001 From: goedelsoup Date: Tue, 23 Jun 2020 09:43:29 -0400 Subject: [PATCH 11/67] add documentation to configuration --- .github/linters/.clj-kondo/config.edn | 2 ++ .gitignore | 3 +++ docs/disabling-linters.md | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 .github/linters/.clj-kondo/config.edn diff --git a/.github/linters/.clj-kondo/config.edn b/.github/linters/.clj-kondo/config.edn new file mode 100644 index 00000000..30cae4c6 --- /dev/null +++ b/.github/linters/.clj-kondo/config.edn @@ -0,0 +1,2 @@ +{:linters {:unresolved-symbol {:exclude [(compojure.api.sweet/defroutes)]} + :refer-all {:exclude [clj-time.jdbc]}}} diff --git a/.gitignore b/.gitignore index ad46b308..ae755b39 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,6 @@ typings/ # next.js build output .next + +# clj-kondo cache +.cache \ No newline at end of file diff --git a/docs/disabling-linters.md b/docs/disabling-linters.md index 0efb4d27..45fa6957 100644 --- a/docs/disabling-linters.md +++ b/docs/disabling-linters.md @@ -607,3 +607,22 @@ import package.b.* ### ktlint disable entire file - There is currently **No** way to disable rules inline of the file(s) + +-------------------------------------------------------------------------------- + +## Clojure +- [clj-kondo](https://github.com/borkdude/clj-kondo) + +### clj-kondo standard Config file +- `.github/linters/.clj-kondo/config.edn` + +### clj-kondo disable single line +- There is currently **No** way to disable rules in a single line + +### clj-kondo disable code block +- There is currently **No** way to disable rules in a code block + +### clj-kondo disable entire file +```clojure +{:output {:exclude-files ["path/to/file"]}} +``` From a52fd6a5fe44eb9dc13b729519847081665fcb4e Mon Sep 17 00:00:00 2001 From: goedelsoup Date: Tue, 23 Jun 2020 09:46:15 -0400 Subject: [PATCH 12/67] link to clj-kondo docs --- docs/disabling-linters.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/disabling-linters.md b/docs/disabling-linters.md index 45fa6957..5b11ee51 100644 --- a/docs/disabling-linters.md +++ b/docs/disabling-linters.md @@ -612,6 +612,7 @@ import package.b.* ## Clojure - [clj-kondo](https://github.com/borkdude/clj-kondo) +- Since clj-kondo approaches static analysis in a very Clojure way, it is advised to read the [configuration docs](https://github.com/borkdude/clj-kondo/blob/master/doc/config.md) ### clj-kondo standard Config file - `.github/linters/.clj-kondo/config.edn` From f7ae986830849198cbbb4394693881be3a6dce25 Mon Sep 17 00:00:00 2001 From: Thomas Hughes Date: Tue, 23 Jun 2020 09:05:21 -0500 Subject: [PATCH 13/67] Update cleanup-dev to point to proper docker image --- .github/workflows/cleanup-DEV.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cleanup-DEV.yml b/.github/workflows/cleanup-DEV.yml index 63d46c7a..53ef1f6a 100644 --- a/.github/workflows/cleanup-DEV.yml +++ b/.github/workflows/cleanup-DEV.yml @@ -47,7 +47,7 @@ jobs: # Set the Env Vars DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - IMAGE_REPO: admiralawkbar/super-linter + IMAGE_REPO: github/super-linter IMAGE_VERSION: ${{ github.event.pull_request.head.ref }} shell: bash run: .automation/cleanup-docker.sh From db4662123ef0e24f13b190bf2d9f0563889f2e29 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 23 Jun 2020 09:56:16 -0500 Subject: [PATCH 14/67] Adding deploy --- .github/workflows/deploy-RELEASE.yml | 66 ++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/deploy-RELEASE.yml diff --git a/.github/workflows/deploy-RELEASE.yml b/.github/workflows/deploy-RELEASE.yml new file mode 100644 index 00000000..263dbe26 --- /dev/null +++ b/.github/workflows/deploy-RELEASE.yml @@ -0,0 +1,66 @@ +--- +######################### +######################### +## Deploy Docker Image ## +######################### +######################### + +# +# Documentation: +# https://help.github.com/en/articles/workflow-syntax-for-github-actions +# + +####################################### +# Start the job on all push to master # +####################################### +on: + release: + # Want to run the automation when a release is created + types: ['created'] + +############### +# Set the Job # +############### +jobs: + build: + # Name the Job + name: Deploy Docker Image - Release + # Set the agent to run on + runs-on: ubuntu-latest + ################## + # Load all steps # + ################## + steps: + ########################## + # Checkout the code base # + ########################## + - name: Checkout Code + uses: actions/checkout@v2 + + ################################### + # Run Deploy script for Dockerhub # + ################################### + - name: Deploy Release image to Dockerhub + env: + # Set the Env Vars + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + IMAGE_REPO: github/super-linter + IMAGE_VERSION: ${{ github.ref }} + DOCKERFILE_PATH: Dockerfile + shell: bash + run: .automation/upload-docker.sh + + ############################# + # Run Deploy script for GPR # + ############################# + - name: Deploy Release image to GitHub Package Registry + env: + # Set the Env Vars + DOCKER_USERNAME: ${{ secrets.GPR_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.GPR_PASSWORD }} + IMAGE_REPO: github/super-linter + IMAGE_VERSION: ${{ github.ref }} + DOCKERFILE_PATH: Dockerfile + shell: bash + run: .automation/upload-docker.sh From 60a6b9eb63763d99eb61e57218d71a3696e78226 Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Tue, 23 Jun 2020 11:02:45 -0500 Subject: [PATCH 15/67] Use portable shebang --- .automation/cleanup-docker.sh | 2 +- .../test/ansible/ghe-initialize/templates/ghe-config-apply.sh | 2 +- .automation/test/shell/shell_bad_1.sh | 2 +- .automation/test/shell/shell_good_1.sh | 2 +- .automation/upload-docker.sh | 2 +- lib/linter.sh | 2 +- lib/possum.sh | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.automation/cleanup-docker.sh b/.automation/cleanup-docker.sh index 131daf6a..e6a81770 100755 --- a/.automation/cleanup-docker.sh +++ b/.automation/cleanup-docker.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash ################################################################################ ############# Cleanup Image on DockerHub @admiralawkbar ######################## diff --git a/.automation/test/ansible/ghe-initialize/templates/ghe-config-apply.sh b/.automation/test/ansible/ghe-initialize/templates/ghe-config-apply.sh index 06e2e712..6ddf4d71 100644 --- a/.automation/test/ansible/ghe-initialize/templates/ghe-config-apply.sh +++ b/.automation/test/ansible/ghe-initialize/templates/ghe-config-apply.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash ################################################################################ # Script to run ghe-config-apply on the primary GHES instance diff --git a/.automation/test/shell/shell_bad_1.sh b/.automation/test/shell/shell_bad_1.sh index 041c57ae..aa2a95e7 100644 --- a/.automation/test/shell/shell_bad_1.sh +++ b/.automation/test/shell/shell_bad_1.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # CMD HELLO_WORLD=($(echo "Hello World" | cut -f1 -d' ' 2>&1)) diff --git a/.automation/test/shell/shell_good_1.sh b/.automation/test/shell/shell_good_1.sh index 66430423..9a1f5bc5 100644 --- a/.automation/test/shell/shell_good_1.sh +++ b/.automation/test/shell/shell_good_1.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # CMD HELLO_WORLD=$(echo "Hello World" | cut -f1 -d' ' 2>&1) diff --git a/.automation/upload-docker.sh b/.automation/upload-docker.sh index c41adb33..2ee2b144 100755 --- a/.automation/upload-docker.sh +++ b/.automation/upload-docker.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash ################################################################################ ############# Deploy Container to DockerHub @admiralawkbar ##################### diff --git a/lib/linter.sh b/lib/linter.sh index e1115cd6..188edf92 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # shellcheck disable=SC1003,SC2016 ################################################################################ diff --git a/lib/possum.sh b/lib/possum.sh index f23e60a7..dd87d952 100755 --- a/lib/possum.sh +++ b/lib/possum.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash cat < Date: Tue, 23 Jun 2020 12:06:12 -0500 Subject: [PATCH 16/67] Updating code to allow for both registry --- .automation/upload-docker.sh | 147 +++++++++++++++++++++++++++-------- 1 file changed, 116 insertions(+), 31 deletions(-) diff --git a/.automation/upload-docker.sh b/.automation/upload-docker.sh index c41adb33..500e9535 100755 --- a/.automation/upload-docker.sh +++ b/.automation/upload-docker.sh @@ -20,6 +20,9 @@ GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace DOCKER_USERNAME="${DOCKER_USERNAME}" # Username to login to DockerHub DOCKER_PASSWORD="${DOCKER_PASSWORD}" # Password to login to DockerHub +GPR_USERNAME="${GPR_USERNAME}" # Username to login to GitHub package registry +GPR_TOKEN="${GPR_TOKEN}" # Password to login to GitHub package registry +REGISTRY="${REGISTRY}" # What registry to upload | or IMAGE_REPO="${IMAGE_REPO}" # Image repo to upload the image IMAGE_VERSION="${IMAGE_VERSION}" # Version to tag the image DOCKERFILE_PATH="${DOCKERFILE_PATH}" # Path to the Dockerfile to be uploaded @@ -33,7 +36,7 @@ Header() { echo "" echo "-------------------------------------------------------" - echo "------ GitHub Actions Upload image to DockerHub -------" + echo "---- GitHub Actions Upload image to [$REGISTRY] ----" echo "-------------------------------------------------------" echo "" } @@ -51,9 +54,9 @@ ValidateInput() echo "----------------------------------------------" echo "" - ############################ + ############################# # Validate GITHUB_WORKSPACE # - ############################ + ############################# if [ -z "$GITHUB_WORKSPACE" ]; then echo "ERROR! Failed to get [GITHUB_WORKSPACE]!" echo "ERROR:[$GITHUB_WORKSPACE]" @@ -62,28 +65,77 @@ ValidateInput() echo "Successfully found:[GITHUB_WORKSPACE], value:[$GITHUB_WORKSPACE]" fi - ############################ - # Validate DOCKER_USERNAME # - ############################ - if [ -z "$DOCKER_USERNAME" ]; then - echo "ERROR! Failed to get [DOCKER_USERNAME]!" - echo "ERROR:[$DOCKER_USERNAME]" + ##################### + # Validate REGISTRY # + ##################### + if [ -z "$REGISTRY" ]; then + echo "ERROR! Failed to get [REGISTRY]!" + echo "ERROR:[$REGISTRY]" exit 1 else - echo "Successfully found:[DOCKER_USERNAME], value:[$DOCKER_USERNAME]" + echo "Successfully found:[REGISTRY], value:[$REGISTRY]" fi - ############################ - # Validate DOCKER_PASSWORD # - ############################ - if [ -z "$DOCKER_PASSWORD" ]; then - echo "ERROR! Failed to get [DOCKER_PASSWORD]!" - echo "ERROR:[$DOCKER_PASSWORD]" - exit 1 + ##################################################### + # See if we need values for GitHub package Registry # + ##################################################### + if [[ "$REGISTRY" == "GPR" ]]; then + ######################### + # Validate GPR_USERNAME # + ######################### + if [ -z "$GPR_USERNAME" ]; then + echo "ERROR! Failed to get [GPR_USERNAME]!" + echo "ERROR:[$GPR_USERNAME]" + exit 1 + else + echo "Successfully found:[GPR_USERNAME], value:[$GPR_USERNAME]" + fi + + ###################### + # Validate GPR_TOKEN # + ###################### + if [ -z "$GPR_TOKEN" ]; then + echo "ERROR! Failed to get [GPR_TOKEN]!" + echo "ERROR:[$GPR_TOKEN]" + exit 1 + else + echo "Successfully found:[GPR_TOKEN], value:[********]" + fi + ######################################## + # See if we need values for Ducker hub # + ######################################## + elif [[ "$REGISTRY" == "Docker" ]]; then + ############################ + # Validate DOCKER_USERNAME # + ############################ + if [ -z "$DOCKER_USERNAME" ]; then + echo "ERROR! Failed to get [DOCKER_USERNAME]!" + echo "ERROR:[$DOCKER_USERNAME]" + exit 1 + else + echo "Successfully found:[DOCKER_USERNAME], value:[$DOCKER_USERNAME]" + fi + + ############################ + # Validate DOCKER_PASSWORD # + ############################ + if [ -z "$DOCKER_PASSWORD" ]; then + echo "ERROR! Failed to get [DOCKER_PASSWORD]!" + echo "ERROR:[$DOCKER_PASSWORD]" + exit 1 + else + echo "Successfully found:[DOCKER_PASSWORD], value:[********]" + fi + ########################################### + # We were not passed a registry to update # + ########################################### else - echo "Successfully found:[DOCKER_PASSWORD], value:[********]" + echo "ERROR! Failed to find a valid registry!" + echo "Registry:[$REGISTRY]" + exit 1 fi + ####################### # Validate IMAGE_REPO # ####################### @@ -93,6 +145,14 @@ ValidateInput() exit 1 else echo "Successfully found:[IMAGE_REPO], value:[$IMAGE_REPO]" + ############################################### + # Need to see if GPR registry and update name # + ############################################### + if [[ "$REGISTRY" == "GPR" ]]; then + NAME="docker.pkg.github/$IMAGE_REPO" + IMAGE_REPO="$NAME" + echo "Updated [IMAGE_REPO] to:[$IMAGE_REPO] for GPR" + fi fi ########################## @@ -146,22 +206,30 @@ ValidateInput() fi } ################################################################################ -#### Function LoginToDocker #################################################### -LoginToDocker() +#### Function Authenticate ##################################################### +Authenticate() { + ################ + # Pull in Vars # + ################ + USERNAME="$1" # Name to auth with + PASSWD="$2" # Password to auth with + URL="$3" # Url to auth towards + NAME="$4" # name of the service + ################ # Print header # ################ echo "" echo "----------------------------------------------" - echo "Login to DockerHub..." + echo "Login to $NAME..." echo "----------------------------------------------" echo "" - ###################### - # Login to DockerHub # - ###################### - LOGIN_CMD=$(docker login --username "$DOCKER_USERNAME" --password "$DOCKER_PASSWORD" 2>&1) + ################### + # Auth to service # + ################### + LOGIN_CMD=$(docker login "$URL" --username "$USERNAME" --password "$PASSWORD" 2>&1) ####################### # Load the error code # @@ -173,12 +241,12 @@ LoginToDocker() ############################## if [ $ERROR_CODE -ne 0 ]; then # ERROR - echo "ERROR! Failed to authenticate to DockerHub!" + echo "ERROR! Failed to authenticate to $NAME!" echo "ERROR:[$LOGIN_CMD]" exit 1 else # SUCCESS - echo "Successfully authenticated to DockerHub!" + echo "Successfully authenticated to $NAME!" fi } ################################################################################ @@ -194,7 +262,6 @@ BuildImage() echo "----------------------------------------------" echo "" - ################################ # Validate the DOCKERFILE_PATH # ################################ @@ -238,7 +305,7 @@ UploadImage() ################ echo "" echo "----------------------------------------------" - echo "Uploading the DockerFile image..." + echo "Uploading the DockerFile image to $REGISTRY..." echo "----------------------------------------------" echo "" @@ -261,7 +328,7 @@ UploadImage() exit 1 else # SUCCESS - echo "Successfully Uploaded Docker image to DockerHub!" + echo "Successfully Uploaded Docker image to $REGISTRY!" fi ######################### @@ -332,7 +399,25 @@ ValidateInput ###################### # Login to DockerHub # ###################### -LoginToDocker +if [[ "$REGISTRY" == "Docker" ]]; then + # Authenticate "Username" "Password" "Url" "Name" + Authenticate "$DOCKER_USERNAME" "$DOCKER_PASSWORD" "https://docker.com" "Dockerhub" + +#################################### +# Login to GitHub Package Registry # +#################################### +elif [[ "$REGISTRY" == "GPR" ]]; then + # Authenticate "Username" "Password" "Url" "Name" + Authenticate "$GPR_USERNAME" "$GPR_TOKEN" "https://docker.pkg.github.com" "GitHub Package Registry" + +else + ######### + # ERROR # + ######### + echo "ERROR! Registry not set correctly!" + echo "Registry:[$REGISTRY]" + exit 1 +fi ################### # Build the image # From 509fc7c7bbbe336fdcecb90358886883ef3b57ab Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 23 Jun 2020 12:08:33 -0500 Subject: [PATCH 17/67] Updating workflows --- .github/workflows/deploy-DEV.yml | 3 ++- .github/workflows/deploy-PROD.yml | 3 ++- .github/workflows/deploy-RELEASE.yml | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index 4b6975d7..d9af1b44 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -43,13 +43,14 @@ jobs: ##################### # Run Deploy script # ##################### - - name: Deploy image to DockerHub + - name: Deploy DEV image to DockerHub env: # Set the Env Vars DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} IMAGE_REPO: github/super-linter DOCKERFILE_PATH: Dockerfile + REGISTRY: Docker shell: bash run: .automation/upload-docker.sh diff --git a/.github/workflows/deploy-PROD.yml b/.github/workflows/deploy-PROD.yml index fd39563b..b2306c80 100644 --- a/.github/workflows/deploy-PROD.yml +++ b/.github/workflows/deploy-PROD.yml @@ -40,7 +40,7 @@ jobs: ##################### # Run Deploy script # ##################### - - name: Deploy image to DockerHub + - name: Deploy latest image to DockerHub env: # Set the Env Vars DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} @@ -48,5 +48,6 @@ jobs: IMAGE_REPO: github/super-linter IMAGE_VERSION: latest DOCKERFILE_PATH: Dockerfile + REGISTRY: Docker shell: bash run: .automation/upload-docker.sh diff --git a/.github/workflows/deploy-RELEASE.yml b/.github/workflows/deploy-RELEASE.yml index 263dbe26..27a3a4a4 100644 --- a/.github/workflows/deploy-RELEASE.yml +++ b/.github/workflows/deploy-RELEASE.yml @@ -48,6 +48,7 @@ jobs: IMAGE_REPO: github/super-linter IMAGE_VERSION: ${{ github.ref }} DOCKERFILE_PATH: Dockerfile + REGISTRY: Docker shell: bash run: .automation/upload-docker.sh @@ -62,5 +63,6 @@ jobs: IMAGE_REPO: github/super-linter IMAGE_VERSION: ${{ github.ref }} DOCKERFILE_PATH: Dockerfile + REGISTRY: GPR shell: bash run: .automation/upload-docker.sh From f3fbf867fcc3055434f11aa9070cd8cbb0380889 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 23 Jun 2020 12:10:36 -0500 Subject: [PATCH 18/67] fix var name --- .automation/upload-docker.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.automation/upload-docker.sh b/.automation/upload-docker.sh index 500e9535..74e3f0aa 100755 --- a/.automation/upload-docker.sh +++ b/.automation/upload-docker.sh @@ -212,10 +212,10 @@ Authenticate() ################ # Pull in Vars # ################ - USERNAME="$1" # Name to auth with - PASSWD="$2" # Password to auth with - URL="$3" # Url to auth towards - NAME="$4" # name of the service + USERNAME="$1" # Name to auth with + PASSWORD="$2" # Password to auth with + URL="$3" # Url to auth towards + NAME="$4" # name of the service ################ # Print header # From 57cd6822980f8b6e63a8f0dbeed703ad9a795711 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 23 Jun 2020 12:19:37 -0500 Subject: [PATCH 19/67] Change of order --- .automation/upload-docker.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.automation/upload-docker.sh b/.automation/upload-docker.sh index 74e3f0aa..8564ef28 100755 --- a/.automation/upload-docker.sh +++ b/.automation/upload-docker.sh @@ -396,6 +396,11 @@ Header ################## ValidateInput +################### +# Build the image # +################### +BuildImage + ###################### # Login to DockerHub # ###################### @@ -419,11 +424,6 @@ else exit 1 fi -################### -# Build the image # -################### -BuildImage - #################### # Upload the image # #################### From 1084ce762c80b991e08c5f74ae43e15a9e0e52ad Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 23 Jun 2020 12:26:28 -0500 Subject: [PATCH 20/67] less verbose --- .automation/upload-docker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.automation/upload-docker.sh b/.automation/upload-docker.sh index 8564ef28..b814de01 100755 --- a/.automation/upload-docker.sh +++ b/.automation/upload-docker.sh @@ -406,7 +406,7 @@ BuildImage ###################### if [[ "$REGISTRY" == "Docker" ]]; then # Authenticate "Username" "Password" "Url" "Name" - Authenticate "$DOCKER_USERNAME" "$DOCKER_PASSWORD" "https://docker.com" "Dockerhub" + Authenticate "$DOCKER_USERNAME" "$DOCKER_PASSWORD" "" "Dockerhub" #################################### # Login to GitHub Package Registry # From 1f27f86381c55a79a4e6b339615c6a7972443160 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 23 Jun 2020 12:39:07 -0500 Subject: [PATCH 21/67] updated doc --- .github/CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index e2302dd8..253b1933 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -33,8 +33,8 @@ Draft pull requests are also welcome to get feedback early on, or if there is so If you are the current maintainer of this action: 1. Update `README.md` and the wiki to reflect new version number in the example workflow file sections 2. Draft [Release](https://help.github.com/en/github/administering-a-repository/managing-releases-in-a-repository) with a summarized changelog -3. Publish the docker image to GitHub package registry -4. Publish the docker image to Docker Hub +3. A GitHub Action will Publish the Docker image to GitHub Package Registry once a Release is created +4. A GitHub Action will Publish the Docker image to Docker Hub once a Release is created 5. Look for approval from [CODEOWNERS](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners) ## Resources From b922ece707b9a57c7ad42c9159fdd6bdbab7c217 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 23 Jun 2020 12:45:57 -0500 Subject: [PATCH 22/67] found missing var --- lib/linter.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/linter.sh b/lib/linter.sh index 5c8042bd..5f7af0c9 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -150,7 +150,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_POWERSHELL=() # Array of files to check +FILE_ARRAY_POWERSHELL=() # Array of files to check FILE_ARRAY_CSS=() # Array of files to check FILE_ARRAY_ENV=() # Array of files to check FILE_ARRAY_CLOJURE=() # Array of files to check @@ -2159,6 +2159,7 @@ Footer() [ "$ERRORS_FOUND_RUBY" -ne 0 ] || \ [ "$ERRORS_FOUND_CSS" -ne 0 ] || \ [ "$ERRORS_FOUND_ENV" -ne 0 ] || \ + [ "$ERRORS_FOUND_CLOJURE" -ne 0 ] || \ [ "$ERRORS_FOUND_KOTLIN" -ne 0 ]; then # Failed exit echo "Exiting with errors found!" From e03f876d8217d2efa2fdabf779daf0cb77b433b7 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 23 Jun 2020 14:13:19 -0500 Subject: [PATCH 23/67] fixed space --- .automation/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.automation/README.md b/.automation/README.md index 812c2aae..485e97ec 100644 --- a/.automation/README.md +++ b/.automation/README.md @@ -19,4 +19,5 @@ When the script is triggered in a branch, it will push with the tag:**NameOfBran - **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 beaa2de473471622be6810cef25e81cf4268b20a Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 23 Jun 2020 14:38:23 -0500 Subject: [PATCH 24/67] fixed relase version --- .github/workflows/deploy-RELEASE.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-RELEASE.yml b/.github/workflows/deploy-RELEASE.yml index 27a3a4a4..4a3a1d2a 100644 --- a/.github/workflows/deploy-RELEASE.yml +++ b/.github/workflows/deploy-RELEASE.yml @@ -37,6 +37,13 @@ jobs: - name: Checkout Code uses: actions/checkout@v2 + ########################## + # Get the Relase version # + ########################## + - name: Extract Release Version + shell: bash + run: echo "::set-env name=RELEASE_VERSION::$(echo ${GITHUB_REF/refs\/tags\//})" + ################################### # Run Deploy script for Dockerhub # ################################### @@ -46,7 +53,7 @@ jobs: DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} IMAGE_REPO: github/super-linter - IMAGE_VERSION: ${{ github.ref }} + IMAGE_VERSION: ${RELEASE_VERSION} DOCKERFILE_PATH: Dockerfile REGISTRY: Docker shell: bash @@ -61,7 +68,7 @@ jobs: DOCKER_USERNAME: ${{ secrets.GPR_USERNAME }} DOCKER_PASSWORD: ${{ secrets.GPR_PASSWORD }} IMAGE_REPO: github/super-linter - IMAGE_VERSION: ${{ github.ref }} + IMAGE_VERSION: ${RELEASE_VERSION} DOCKERFILE_PATH: Dockerfile REGISTRY: GPR shell: bash From b8608095da9f6ef8d934302576b3a49daa6cef01 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 23 Jun 2020 14:43:59 -0500 Subject: [PATCH 25/67] fixed the var --- .github/workflows/deploy-RELEASE.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/deploy-RELEASE.yml b/.github/workflows/deploy-RELEASE.yml index 4a3a1d2a..ea103f7b 100644 --- a/.github/workflows/deploy-RELEASE.yml +++ b/.github/workflows/deploy-RELEASE.yml @@ -37,13 +37,6 @@ jobs: - name: Checkout Code uses: actions/checkout@v2 - ########################## - # Get the Relase version # - ########################## - - name: Extract Release Version - shell: bash - run: echo "::set-env name=RELEASE_VERSION::$(echo ${GITHUB_REF/refs\/tags\//})" - ################################### # Run Deploy script for Dockerhub # ################################### @@ -53,7 +46,7 @@ jobs: DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} IMAGE_REPO: github/super-linter - IMAGE_VERSION: ${RELEASE_VERSION} + IMAGE_VERSION: ${{ github.event.release.tag_name }} DOCKERFILE_PATH: Dockerfile REGISTRY: Docker shell: bash @@ -68,7 +61,7 @@ jobs: DOCKER_USERNAME: ${{ secrets.GPR_USERNAME }} DOCKER_PASSWORD: ${{ secrets.GPR_PASSWORD }} IMAGE_REPO: github/super-linter - IMAGE_VERSION: ${RELEASE_VERSION} + IMAGE_VERSION: ${{ github.event.release.tag_name }} DOCKERFILE_PATH: Dockerfile REGISTRY: GPR shell: bash From f94c19f8e2303ce8c4a0a116e5e75ad99b171a9f Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 23 Jun 2020 14:57:30 -0500 Subject: [PATCH 26/67] typo --- .github/workflows/deploy-RELEASE.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-RELEASE.yml b/.github/workflows/deploy-RELEASE.yml index ea103f7b..4417ed4b 100644 --- a/.github/workflows/deploy-RELEASE.yml +++ b/.github/workflows/deploy-RELEASE.yml @@ -58,8 +58,8 @@ jobs: - name: Deploy Release image to GitHub Package Registry env: # Set the Env Vars - DOCKER_USERNAME: ${{ secrets.GPR_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.GPR_PASSWORD }} + GPR_USERNAME: ${{ secrets.GPR_USERNAME }} + GPR_TOKEN: ${{ secrets.GPR_TOKEN }} IMAGE_REPO: github/super-linter IMAGE_VERSION: ${{ github.event.release.tag_name }} DOCKERFILE_PATH: Dockerfile From 52d6e690b2b8202b7a67a74cb3decb00d6515130 Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Tue, 23 Jun 2020 22:18:46 +0200 Subject: [PATCH 27/67] linter.sh: fix align After Powershell PR --- lib/linter.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linter.sh b/lib/linter.sh index 188edf92..9bad8c8b 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -145,7 +145,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_POWERSHELL=() # Array of files to check +FILE_ARRAY_POWERSHELL=() # Array of files to check FILE_ARRAY_CSS=() # Array of files to check FILE_ARRAY_ENV=() # Array of files to check FILE_ARRAY_KOTLIN=() # Array of files to check From a3a4ba3369872c700735bbcdda4f77b5ab5f071f Mon Sep 17 00:00:00 2001 From: Akash Date: Wed, 24 Jun 2020 02:07:28 +0530 Subject: [PATCH 28/67] Fix Typo In .ansible-lint.yml fixed a typo of that to then and added a comma between push and add. --- TEMPLATES/.ansible-lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TEMPLATES/.ansible-lint.yml b/TEMPLATES/.ansible-lint.yml index 0007c68d..a84da4b0 100644 --- a/TEMPLATES/.ansible-lint.yml +++ b/TEMPLATES/.ansible-lint.yml @@ -29,9 +29,9 @@ quiet: true ################ skip_list: - '602' # Allow compare to empty string - - '204' # Allow string length greater that 160 chars + - '204' # Allow string length greater than 160 chars - '301' # False positives for running command shells - - '303' # Allow git commands for push add, etc... + - '303' # Allow git commands for push, add, etc... - '305' # Allow use of shell when you want - '503' # Allow step to run like handler From 01a32fba76f165d32d2b835eb21bef05aec18e91 Mon Sep 17 00:00:00 2001 From: Akash Date: Wed, 24 Jun 2020 02:25:33 +0530 Subject: [PATCH 29/67] Fixed Typo is examples -> are examples --- 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 0efb4d27..567a6e2a 100644 --- a/docs/disabling-linters.md +++ b/docs/disabling-linters.md @@ -1,7 +1,7 @@ # Disabling linters and Rules If you find you need to ignore certain **errors** and **warnings**, you will need to know the *format* to disable the **Super-Linter** rules. Below is examples and documentation for each language and the various methods to disable. - +Below are examples and documentation for each language and various methods to disable. ## Table of Linters - [Ruby](#ruby) - [Shell](#shell) From e15a4dc174afa34173cce5a355d53f5b973f2dca Mon Sep 17 00:00:00 2001 From: Gabo Date: Sun, 21 Jun 2020 18:41:24 -0500 Subject: [PATCH 30/67] Add check spelling workflow test bucket variable Add empty expect words add procjet varaible Add excludes file add patters for urls Add newline at eof Changing lorem ipsum for proper words Add admiralawkbar to expected words Exclude lint templates files Add api apk and ansible as expected words add expected words for cleanup-docker.sh add expected words for ghe-config-apply.sh Fix add-ons spelling Add a bunch new words Simpler url pattern Use common baz word Fix coffeescript spelling Add expected words for ghe-api-config-apply.yml Add ecpected words for linter.sh Fix Multi-line spelling Add more linter.sh expected words Add a whole lot of expected words Add pattern for repeated single char Add space Add expected words for Dockerfile Add more expected words for ghe-api-config-apply.yml Add expected words for he-initial-configuration.yml Add expected words for ghe-ldap-configuration.yml Move spelling/expect -> spelling/allow Set workflow name Fix @admiralawkbar capitalization Fix requirements spelling Add last docker allow words Add last ghe-config-apply allow words Add last linter.sh allow words add last general allow words Add .gitignore allow words Add main.yml allow words Add settings.json.j2 allow words Add empty expect words Test gitignore.txt Fix patter for repeated chars Add some more allowed words more words Add disabling-linters.md allow words commit --- .automation/cleanup-docker.sh | 2 +- .../coffeescript/coffeescript_bad_1.coffee | 2 +- .../coffeescript/coffeescript_good_1.coffee | 2 +- .automation/test/css/css_bad_01.css | 2 +- .automation/test/perl/perl_bad_1.pl | 2 +- .automation/test/perl/perl_good_1.pl | 2 +- .automation/upload-docker.sh | 2 +- .github/actions/spelling/allow/Dockerfile.txt | 9 + .../spelling/allow/cleanup-docker.sh.txt | 1 + .../spelling/allow/disabling-linters.md.txt | 3 + .../allow/ghe-api-config-apply.yml.txt | 2 + .../spelling/allow/ghe-config-apply.sh.txt | 3 + .../allow/ghe-initial-configuration.yml.txt | 1 + .../allow/ghe-ldap-configuration.yml.txt | 2 + .github/actions/spelling/allow/gitignore.txt | 8 + .github/actions/spelling/allow/linter.sh.txt | 7 + .github/actions/spelling/allow/main.yml.txt | 8 + .../spelling/allow/settings.json.j2.txt | 4 + .github/actions/spelling/allow/words.txt | 159 ++++++++++++++++++ .github/actions/spelling/excludes.txt | 2 + .github/actions/spelling/expect.words.txt | 0 .github/actions/spelling/patterns.txt | 3 + .github/workflows/check-spelling.yml | 47 ++++++ .gitignore | 2 +- docs/disabling-linters.md | 10 +- lib/linter.sh | 4 +- 26 files changed, 274 insertions(+), 15 deletions(-) create mode 100644 .github/actions/spelling/allow/Dockerfile.txt create mode 100644 .github/actions/spelling/allow/cleanup-docker.sh.txt create mode 100644 .github/actions/spelling/allow/disabling-linters.md.txt create mode 100644 .github/actions/spelling/allow/ghe-api-config-apply.yml.txt create mode 100644 .github/actions/spelling/allow/ghe-config-apply.sh.txt create mode 100644 .github/actions/spelling/allow/ghe-initial-configuration.yml.txt create mode 100644 .github/actions/spelling/allow/ghe-ldap-configuration.yml.txt create mode 100644 .github/actions/spelling/allow/gitignore.txt create mode 100644 .github/actions/spelling/allow/linter.sh.txt create mode 100644 .github/actions/spelling/allow/main.yml.txt create mode 100644 .github/actions/spelling/allow/settings.json.j2.txt create mode 100644 .github/actions/spelling/allow/words.txt create mode 100644 .github/actions/spelling/excludes.txt create mode 100644 .github/actions/spelling/expect.words.txt create mode 100644 .github/actions/spelling/patterns.txt create mode 100644 .github/workflows/check-spelling.yml diff --git a/.automation/cleanup-docker.sh b/.automation/cleanup-docker.sh index 131daf6a..b2c96257 100755 --- a/.automation/cleanup-docker.sh +++ b/.automation/cleanup-docker.sh @@ -8,7 +8,7 @@ # Its based on being built from a GitHub Action, but could be easily updated # To be ran in a different medium. # -# PRE-Reqs: +# PRE-Requirements: # - Dockerfile # - System with Docker installed # - Global variables met diff --git a/.automation/test/coffeescript/coffeescript_bad_1.coffee b/.automation/test/coffeescript/coffeescript_bad_1.coffee index 5efeeacb..e388e7cc 100644 --- a/.automation/test/coffeescript/coffeescript_bad_1.coffee +++ b/.automation/test/coffeescript/coffeescript_bad_1.coffee @@ -6,7 +6,7 @@ # `mona echo *` - repeats what you say # # Author: -# admiralAwkbar@github.com +# admiralawkbar@github.com ############################### # Drop Hammer array of images # diff --git a/.automation/test/coffeescript/coffeescript_good_1.coffee b/.automation/test/coffeescript/coffeescript_good_1.coffee index 62f2a4fe..064f850e 100644 --- a/.automation/test/coffeescript/coffeescript_good_1.coffee +++ b/.automation/test/coffeescript/coffeescript_good_1.coffee @@ -6,7 +6,7 @@ # `mona echo *` - repeats what you say # # Author: -# admiralAwkbar@github.com +# admiralawkbar@github.com ############################### # Drop Hammer array of images # diff --git a/.automation/test/css/css_bad_01.css b/.automation/test/css/css_bad_01.css index 3c600b36..6ae90d7e 100644 --- a/.automation/test/css/css_bad_01.css +++ b/.automation/test/css/css_bad_01.css @@ -1,5 +1,5 @@ /* Bad */ -/* Multiline */ +/* Multi-line */ /* Comment */ .selector-3[type="text"] { background: linear-gradient(#FFFFFF, rgba(0, 0, 0, 0.8)); diff --git a/.automation/test/perl/perl_bad_1.pl b/.automation/test/perl/perl_bad_1.pl index e3626f88..7b127b99 100644 --- a/.automation/test/perl/perl_bad_1.pl +++ b/.automation/test/perl/perl_bad_1.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl ################################################################################ ################################################################################ -######### Script action @admiralAwkbar ######################################### +######### Script action @admiralawkbar ######################################### ################################################################################ ############# diff --git a/.automation/test/perl/perl_good_1.pl b/.automation/test/perl/perl_good_1.pl index f35c1409..caca0994 100644 --- a/.automation/test/perl/perl_good_1.pl +++ b/.automation/test/perl/perl_good_1.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl ################################################################################ ################################################################################ -######### Script action @admiralAwkbar ######################################### +######### Script action @admiralawkbar ######################################### ################################################################################ ############# diff --git a/.automation/upload-docker.sh b/.automation/upload-docker.sh index c41adb33..6cddd9de 100755 --- a/.automation/upload-docker.sh +++ b/.automation/upload-docker.sh @@ -9,7 +9,7 @@ # Its based on being built from a GitHub Action, but could be easily updated # To be ran in a different medium. # -# PRE-Reqs: +# PRE-Requirements: # - Dockerfile # - System with Docker installed # - Global variables met diff --git a/.github/actions/spelling/allow/Dockerfile.txt b/.github/actions/spelling/allow/Dockerfile.txt new file mode 100644 index 00000000..60348227 --- /dev/null +++ b/.github/actions/spelling/allow/Dockerfile.txt @@ -0,0 +1,9 @@ +musl +nvq +rdoc +setuptools +uninstall +Jv +wget +WORKDIR +xzf diff --git a/.github/actions/spelling/allow/cleanup-docker.sh.txt b/.github/actions/spelling/allow/cleanup-docker.sh.txt new file mode 100644 index 00000000..1efe4ad7 --- /dev/null +++ b/.github/actions/spelling/allow/cleanup-docker.sh.txt @@ -0,0 +1 @@ +alnum diff --git a/.github/actions/spelling/allow/disabling-linters.md.txt b/.github/actions/spelling/allow/disabling-linters.md.txt new file mode 100644 index 00000000..fe1303c8 --- /dev/null +++ b/.github/actions/spelling/allow/disabling-linters.md.txt @@ -0,0 +1,3 @@ +noqa +toc +todo diff --git a/.github/actions/spelling/allow/ghe-api-config-apply.yml.txt b/.github/actions/spelling/allow/ghe-api-config-apply.yml.txt new file mode 100644 index 00000000..8d39ee0b --- /dev/null +++ b/.github/actions/spelling/allow/ghe-api-config-apply.yml.txt @@ -0,0 +1,2 @@ +configcheck +nohup diff --git a/.github/actions/spelling/allow/ghe-config-apply.sh.txt b/.github/actions/spelling/allow/ghe-config-apply.sh.txt new file mode 100644 index 00000000..c35c2e96 --- /dev/null +++ b/.github/actions/spelling/allow/ghe-config-apply.sh.txt @@ -0,0 +1,3 @@ +aef +args +pid diff --git a/.github/actions/spelling/allow/ghe-initial-configuration.yml.txt b/.github/actions/spelling/allow/ghe-initial-configuration.yml.txt new file mode 100644 index 00000000..a09f0564 --- /dev/null +++ b/.github/actions/spelling/allow/ghe-initial-configuration.yml.txt @@ -0,0 +1 @@ +initialconfig diff --git a/.github/actions/spelling/allow/ghe-ldap-configuration.yml.txt b/.github/actions/spelling/allow/ghe-ldap-configuration.yml.txt new file mode 100644 index 00000000..04b1c12f --- /dev/null +++ b/.github/actions/spelling/allow/ghe-ldap-configuration.yml.txt @@ -0,0 +1,2 @@ +ldapconfig +openldap diff --git a/.github/actions/spelling/allow/gitignore.txt b/.github/actions/spelling/allow/gitignore.txt new file mode 100644 index 00000000..6fcb9a9c --- /dev/null +++ b/.github/actions/spelling/allow/gitignore.txt @@ -0,0 +1,8 @@ +cov +eslintcache +jscoverage +jspm +nyc +tgz +typings +wscript diff --git a/.github/actions/spelling/allow/linter.sh.txt b/.github/actions/spelling/allow/linter.sh.txt new file mode 100644 index 00000000..9bd25b2f --- /dev/null +++ b/.github/actions/spelling/allow/linter.sh.txt @@ -0,0 +1,7 @@ +cw +Mstrict +printenv +rcfile +tf +tolower +whoami diff --git a/.github/actions/spelling/allow/main.yml.txt b/.github/actions/spelling/allow/main.yml.txt new file mode 100644 index 00000000..877e71bb --- /dev/null +++ b/.github/actions/spelling/allow/main.yml.txt @@ -0,0 +1,8 @@ +Autobots +basemap +cas +cn +crt +rsa +tlsv +tmp diff --git a/.github/actions/spelling/allow/settings.json.j2.txt b/.github/actions/spelling/allow/settings.json.j2.txt new file mode 100644 index 00000000..7f01269b --- /dev/null +++ b/.github/actions/spelling/allow/settings.json.j2.txt @@ -0,0 +1,4 @@ +dotcom +identicons +oauth +timezone diff --git a/.github/actions/spelling/allow/words.txt b/.github/actions/spelling/allow/words.txt new file mode 100644 index 00000000..0995f947 --- /dev/null +++ b/.github/actions/spelling/allow/words.txt @@ -0,0 +1,159 @@ +admiralawkbar +ansible +api +apk +aws +baz +beardofedu +certs +changeset +codebase +CODEOWNERS +coffeelint +coffeescript +collectd +concat +config +configs +css +dest +devops +dirname +dockerfile +dockerfilelint +dockerfilelintrc +dotenv +elif +emails +entrypoint +Errorf +eslint +eslintrc +filetype +func +gcc +getenv +ghe +GHES +ghl +github +globals +golang +golangci +Google +gpg +gql +Grafana +graphql +grep +homepage +hookshot +hostname +hostvars +http +https +hubot +idp +ip +Jani +javascript +jq +json +jsonlint +jwiebalk +JWT +ldap +len +lfs +libxml +linted +linting +Lk +loadbalancer +localhost +loglevel +markdownlint +millis +mkdir +nodejs +NONINFRINGEMENT +noproxy +noreply +npm +ntp +opensource +opensourcefriday +perl +plugin +posix +pprint +Prego +prettyjson +Println +probot +px +py +pylint +rb +readlines +README +regex +regexp +resqued +rgba +rien +Rubo +rubocop +saml +screenshots +shellcheck +signup +smtp +snmp +socio +splunk +src +ssh +ssl +sso +stackoverflow +stacktraces +standardjs +stringify +stylelint +stylelintrc +subdomain +subfolders +sudo +sys +syslog +taz +terraform +tflint +tileserver +tls +typeof +ubuntu +udp +uid +undef +uniq +uri +url +urlencode +username +usr +utils +Vape +vnd +webhook +wiki +wildcards +workflow +xml +xmllint +yaml +yamllint +yml +yq +zkoppert diff --git a/.github/actions/spelling/excludes.txt b/.github/actions/spelling/excludes.txt new file mode 100644 index 00000000..549b89c5 --- /dev/null +++ b/.github/actions/spelling/excludes.txt @@ -0,0 +1,2 @@ +^\.github/linters/ +^TEMPLATES/\.\S* diff --git a/.github/actions/spelling/expect.words.txt b/.github/actions/spelling/expect.words.txt new file mode 100644 index 00000000..e69de29b diff --git a/.github/actions/spelling/patterns.txt b/.github/actions/spelling/patterns.txt new file mode 100644 index 00000000..80fbc23b --- /dev/null +++ b/.github/actions/spelling/patterns.txt @@ -0,0 +1,3 @@ +https?:\S* +# ignore long runs of a single character: +([A-Za-z])\1{3,} diff --git a/.github/workflows/check-spelling.yml b/.github/workflows/check-spelling.yml new file mode 100644 index 00000000..91cb6fd6 --- /dev/null +++ b/.github/workflows/check-spelling.yml @@ -0,0 +1,47 @@ +--- +#################### +## Check spelling ## +#################### + +# +# Documentation: +# https://help.github.com/en/articles/workflow-syntax-for-github-actions +# + +name: Spell checking +############################# +# Start the job on all push # +############################# +on: + push: + branches-ignore: + - 'master' + +############### +# Set the Job # +############### +jobs: + build: + # Name the Job + name: Spell checking + # Set the agent to run on + runs-on: ubuntu-latest + ################## + # Load all steps # + ################## + steps: + ########################## + # Checkout the code base # + ########################## + - name: Checkout Code + uses: actions/checkout@v2 + + ############################# + # Run check spelling action # + ############################# + - name: Check spelling + uses: check-spelling/check-spelling@0.0.16-alpha + with: + bucket: .github/actions + project: spelling + diff --git a/.gitignore b/.gitignore index ad46b308..0c70da66 100644 --- a/.gitignore +++ b/.gitignore @@ -29,7 +29,7 @@ bower_components # node-waf configuration .lock-wscript -# Compiled binary addons (https://nodejs.org/api/addons.html) +# Compiled binary add-ons (https://nodejs.org/api/addons.html) build/Release # Dependency directories diff --git a/docs/disabling-linters.md b/docs/disabling-linters.md index b972d31c..84107452 100644 --- a/docs/disabling-linters.md +++ b/docs/disabling-linters.md @@ -154,9 +154,9 @@ This line is waaaaaaaaaay too long # yamllint disable-line ### Yamllint disable code block ```yml # yamllint disable rule:colons -- Lorem : ipsum - dolor : sit amet, - consectetur : adipiscing elit +- Key : value + dolor : sit, + foo : bar # yamllint enable ``` @@ -220,9 +220,9 @@ class Foo(object): def meth3(self): """test one line disabling""" # no error - print(self.bla) # pylint: disable=no-member + print(self.baz) # pylint: disable=no-member # error - print(self.blop) + print(self.baz) ``` ### Pylint disable entire file diff --git a/lib/linter.sh b/lib/linter.sh index 45fd2ecf..c3d4be97 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -3,7 +3,7 @@ ################################################################################ ################################################################################ -########### Super-Linter (Lint all the code) @AdmiralAwkbar #################### +########### Super-Linter (Lint all the code) @Admiralawkbar #################### ################################################################################ ################################################################################ @@ -27,7 +27,7 @@ RUBY_FILE_NAME='.ruby-lint.yml' # Name of th RUBY_LINTER_RULES="$DEFAULT_RULES_LOCATION/$RUBY_FILE_NAME" # Path to the ruby lint rules # Coffee Vars COFFEE_FILE_NAME='.coffee-lint.json' # Name of the file -COFFEESCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$COFFEE_FILE_NAME" # Path to the coffescript lint rules +COFFEESCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$COFFEE_FILE_NAME" # Path to the coffeescript lint rules # Javascript Vars JAVASCRIPT_FILE_NAME='.eslintrc.yml' # Name of the file JAVASCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$JAVASCRIPT_FILE_NAME" # Path to the Javascript lint rules From fa6bad1cd9b99a116a8178a0e395ab67fc505efa Mon Sep 17 00:00:00 2001 From: Gabo Date: Tue, 23 Jun 2020 16:48:01 -0500 Subject: [PATCH 31/67] Fixing grammar --- .../test/ansible/ghe-initialize/templates/ghe-config-apply.sh | 4 ++-- .automation/test/markdown/markdown_bad_1.md | 2 +- .automation/test/markdown/markdown_good_1.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.automation/test/ansible/ghe-initialize/templates/ghe-config-apply.sh b/.automation/test/ansible/ghe-initialize/templates/ghe-config-apply.sh index 06e2e712..821a7678 100644 --- a/.automation/test/ansible/ghe-initialize/templates/ghe-config-apply.sh +++ b/.automation/test/ansible/ghe-initialize/templates/ghe-config-apply.sh @@ -35,7 +35,7 @@ CheckGHEPid() ################################################ if [ ! -f "$GHE_CONFIG_PID" ]; then # File not found - echo "Were good to move forward, no .pid file found at:[$GHE_CONFIG_PID]" + echo "We're good to move forward, no .pid file found at:[$GHE_CONFIG_PID]" else # Found the pid running, need to sleep echo "Current PID found, sleeping $SLEEP_SECONDS seconds before next check..." @@ -190,7 +190,7 @@ CheckGHEProcess RunConfigApply ########################################## -# Were going to run it again after a nap # +# We're going to run it again after a nap # # to make sure there is no crazy actions # ########################################## sleep 300s diff --git a/.automation/test/markdown/markdown_bad_1.md b/.automation/test/markdown/markdown_bad_1.md index 47aa18af..6599ac74 100644 --- a/.automation/test/markdown/markdown_bad_1.md +++ b/.automation/test/markdown/markdown_bad_1.md @@ -16,5 +16,5 @@ ls -la # Walk away -Were all done **here**. +We're all done **here**. - [Link Action]https://github.com diff --git a/.automation/test/markdown/markdown_good_1.md b/.automation/test/markdown/markdown_good_1.md index 5634a455..7a0aef45 100644 --- a/.automation/test/markdown/markdown_good_1.md +++ b/.automation/test/markdown/markdown_good_1.md @@ -16,5 +16,5 @@ ls -la ### Walk away -Were all done **here**. +We're all done **here**. - [Link Action](https://github.com) From 50053383e03fad37a91013f105afa869c8dda048 Mon Sep 17 00:00:00 2001 From: Gabo Date: Tue, 23 Jun 2020 16:59:50 -0500 Subject: [PATCH 32/67] Fix patter for cli args --- .github/actions/spelling/allow/Dockerfile.txt | 2 -- .github/actions/spelling/allow/ghe-config-apply.sh.txt | 1 - .github/actions/spelling/allow/words.txt | 1 - .github/actions/spelling/patterns.txt | 2 ++ 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/actions/spelling/allow/Dockerfile.txt b/.github/actions/spelling/allow/Dockerfile.txt index 60348227..bb490a92 100644 --- a/.github/actions/spelling/allow/Dockerfile.txt +++ b/.github/actions/spelling/allow/Dockerfile.txt @@ -3,7 +3,5 @@ nvq rdoc setuptools uninstall -Jv wget WORKDIR -xzf diff --git a/.github/actions/spelling/allow/ghe-config-apply.sh.txt b/.github/actions/spelling/allow/ghe-config-apply.sh.txt index c35c2e96..0570567b 100644 --- a/.github/actions/spelling/allow/ghe-config-apply.sh.txt +++ b/.github/actions/spelling/allow/ghe-config-apply.sh.txt @@ -1,3 +1,2 @@ -aef args pid diff --git a/.github/actions/spelling/allow/words.txt b/.github/actions/spelling/allow/words.txt index 0995f947..0e91754b 100644 --- a/.github/actions/spelling/allow/words.txt +++ b/.github/actions/spelling/allow/words.txt @@ -68,7 +68,6 @@ lfs libxml linted linting -Lk loadbalancer localhost loglevel diff --git a/.github/actions/spelling/patterns.txt b/.github/actions/spelling/patterns.txt index 80fbc23b..56512e46 100644 --- a/.github/actions/spelling/patterns.txt +++ b/.github/actions/spelling/patterns.txt @@ -1,3 +1,5 @@ https?:\S* # ignore long runs of a single character: ([A-Za-z])\1{3,} +# Any CLI args (-xzf -aef) +\ -\w+\b From 5147b5a8ad48c9c1ac1f391d70ffb1b8ad69761d Mon Sep 17 00:00:00 2001 From: Gabo Date: Tue, 23 Jun 2020 17:09:57 -0500 Subject: [PATCH 33/67] Add pattern for hex colors --- .github/actions/spelling/patterns.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/spelling/patterns.txt b/.github/actions/spelling/patterns.txt index 56512e46..9497a00e 100644 --- a/.github/actions/spelling/patterns.txt +++ b/.github/actions/spelling/patterns.txt @@ -3,3 +3,5 @@ https?:\S* ([A-Za-z])\1{3,} # Any CLI args (-xzf -aef) \ -\w+\b +# Hex colors (dummy group to not be treated as comment) +(#)([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}) From bfaad59af07f17903e0fb9b2952f0e4a90684466 Mon Sep 17 00:00:00 2001 From: Gabo Date: Tue, 23 Jun 2020 17:26:07 -0500 Subject: [PATCH 34/67] use non capturing group for hex regex --- .github/actions/spelling/patterns.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/spelling/patterns.txt b/.github/actions/spelling/patterns.txt index 9497a00e..5c595e9b 100644 --- a/.github/actions/spelling/patterns.txt +++ b/.github/actions/spelling/patterns.txt @@ -4,4 +4,4 @@ https?:\S* # Any CLI args (-xzf -aef) \ -\w+\b # Hex colors (dummy group to not be treated as comment) -(#)([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}) +(?:#)([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}) From 9b6af3d52baa1295e9b85524d750b6df1405e920 Mon Sep 17 00:00:00 2001 From: Gabo Date: Tue, 23 Jun 2020 17:34:16 -0500 Subject: [PATCH 35/67] Fix expect file name comm --- .github/actions/spelling/expect.txt | 1 + .github/actions/spelling/expect.words.txt | 0 2 files changed, 1 insertion(+) create mode 100644 .github/actions/spelling/expect.txt delete mode 100644 .github/actions/spelling/expect.words.txt diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/.github/actions/spelling/expect.txt @@ -0,0 +1 @@ + diff --git a/.github/actions/spelling/expect.words.txt b/.github/actions/spelling/expect.words.txt deleted file mode 100644 index e69de29b..00000000 From bae87a4c281819b641babe70554bcd84de16f541 Mon Sep 17 00:00:00 2001 From: Akash Date: Wed, 24 Jun 2020 10:20:54 +0530 Subject: [PATCH 36/67] Revert " Fixed Typo" This reverts commit 01a32fba76f165d32d2b835eb21bef05aec18e91. --- 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 567a6e2a..0efb4d27 100644 --- a/docs/disabling-linters.md +++ b/docs/disabling-linters.md @@ -1,7 +1,7 @@ # Disabling linters and Rules If you find you need to ignore certain **errors** and **warnings**, you will need to know the *format* to disable the **Super-Linter** rules. Below is examples and documentation for each language and the various methods to disable. -Below are examples and documentation for each language and various methods to disable. + ## Table of Linters - [Ruby](#ruby) - [Shell](#shell) From 0ec783ee6c4ff0453cd3f358b57360a052bc7a5a Mon Sep 17 00:00:00 2001 From: Akash Date: Wed, 24 Jun 2020 10:22:43 +0530 Subject: [PATCH 37/67] Fix typo is examples -> are examples --- 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 0efb4d27..c738bdbd 100644 --- a/docs/disabling-linters.md +++ b/docs/disabling-linters.md @@ -1,6 +1,6 @@ # Disabling linters and Rules If you find you need to ignore certain **errors** and **warnings**, you will need to know the *format* to disable the **Super-Linter** rules. -Below is examples and documentation for each language and the various methods to disable. +Below are examples and documentation for each language and the various methods to disable. ## Table of Linters - [Ruby](#ruby) From 26f16f42cb4990ceb8b80a4ed6f3ba3add40c2b6 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Wed, 24 Jun 2020 07:45:11 -0500 Subject: [PATCH 38/67] fixed ansible and powershell --- lib/linter.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linter.sh b/lib/linter.sh index 9bad8c8b..9ed553f6 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -1822,7 +1822,7 @@ LintCodebase() # Lint the file with the rules # ################################ # Need to append "'" to make the pwsh call syntax correct, also exit with exit code from inner subshell - LINT_CMD=$(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit; $LINTER_COMMAND "$FILE"; exit $? 2>&1) + LINT_CMD=$(cd "$GITHUB_WORKSPACE" || exit; $LINTER_COMMAND "$FILE"; exit $? 2>&1) else ################################ # Lint the file with the rules # From d9c21f2599a42f3ebaa18d5bca7aaaa2b7a9acbb Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Wed, 24 Jun 2020 07:58:27 -0500 Subject: [PATCH 39/67] Adding ansible --- lib/linter.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index 9ed553f6..9716eaa0 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -78,7 +78,7 @@ GITHUB_SHA="${GITHUB_SHA}" # GitHub sha from the comm 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 +ANSIBLE_DIRECTORY="${ANSIBLE_DIRECTORY:-ansible}" # Ansible Directory VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE}" # Boolean to validate all files VALIDATE_YAML="${VALIDATE_YAML}" # Boolean to validate language VALIDATE_JSON="${VALIDATE_JSON}" # Boolean to validate language @@ -114,16 +114,16 @@ 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="${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 -DEFAULT_ACTIONS_RUNNER_DEBUG='false' # Default value for debugging output -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 -DEFAULT_DISABLE_ERRORS='false' # Default to enabling errors +DEFAULT_VALIDATE_ALL_CODEBASE='true' # Default value for validate all files +DEFAULT_WORKSPACE="${DEFAULT_WORKSPACE:-/tmp/lint}" # Default workspace if running locally +DEFAULT_ANSIBLE_DIRECTORY="$GITHUB_WORKSPACE/$ANSIBLE_DIRECTORY" # 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 +DEFAULT_ACTIONS_RUNNER_DEBUG='false' # Default value for debugging output +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 +DEFAULT_DISABLE_ERRORS='false' # Default to enabling errors ########################## # Array of changed files # @@ -1922,7 +1922,7 @@ TestCodebase() # Get list of all files to lint # ################################# # shellcheck disable=SC2207,SC2086 - LIST_FILES=($(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit; find . -type f -regex "$FILE_EXTENSIONS" ! -path "*./ansible*" 2>&1)) + LIST_FILES=($(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit; find . -type f -regex "$FILE_EXTENSIONS" ! -path "*./$ANSIBLE_DIRECTORY*" 2>&1)) fi ################## @@ -1994,7 +1994,7 @@ TestCodebase() ################################ # Lint the file with the rules # ################################ - LINT_CMD=$(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/ansible" || exit; $LINTER_COMMAND "$FILE" 2>&1) + LINT_CMD=$(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/$ANSIBLE_DIRECTORY" || exit; $LINTER_COMMAND "$FILE" 2>&1) elif [[ "$FILE_TYPE" == "POWERSHELL" ]]; then ################################ # Lint the file with the rules # From 97612aab7eba9cf385024e71e6ee7cf74a3963dd Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Wed, 24 Jun 2020 08:12:53 -0500 Subject: [PATCH 40/67] put it back, its magic --- lib/linter.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index 9716eaa0..9099b04b 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -78,7 +78,7 @@ GITHUB_SHA="${GITHUB_SHA}" # GitHub sha from the comm 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}" # Ansible Directory +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 VALIDATE_JSON="${VALIDATE_JSON}" # Boolean to validate language @@ -114,9 +114,9 @@ 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="${DEFAULT_WORKSPACE:-/tmp/lint}" # Default workspace if running locally -DEFAULT_ANSIBLE_DIRECTORY="$GITHUB_WORKSPACE/$ANSIBLE_DIRECTORY" # Default Ansible Directory +DEFAULT_VALIDATE_ALL_CODEBASE='true' # Default value for validate all files +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 DEFAULT_ACTIONS_RUNNER_DEBUG='false' # Default value for debugging output @@ -1922,7 +1922,7 @@ TestCodebase() # Get list of all files to lint # ################################# # shellcheck disable=SC2207,SC2086 - LIST_FILES=($(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit; find . -type f -regex "$FILE_EXTENSIONS" ! -path "*./$ANSIBLE_DIRECTORY*" 2>&1)) + LIST_FILES=($(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit; find . -type f -regex "$FILE_EXTENSIONS" ! -path "*./ansible*" 2>&1)) fi ################## @@ -1994,7 +1994,7 @@ TestCodebase() ################################ # Lint the file with the rules # ################################ - LINT_CMD=$(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/$ANSIBLE_DIRECTORY" || exit; $LINTER_COMMAND "$FILE" 2>&1) + LINT_CMD=$(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER/ansible" || exit; $LINTER_COMMAND "$FILE" 2>&1) elif [[ "$FILE_TYPE" == "POWERSHELL" ]]; then ################################ # Lint the file with the rules # From e2eaf633277bc11514231f62dc9541fe47861740 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Wed, 24 Jun 2020 08:35:56 -0500 Subject: [PATCH 41/67] Adding config to templates --- TEMPLATES/.clj-kondo/config.edn | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 TEMPLATES/.clj-kondo/config.edn diff --git a/TEMPLATES/.clj-kondo/config.edn b/TEMPLATES/.clj-kondo/config.edn new file mode 100644 index 00000000..30cae4c6 --- /dev/null +++ b/TEMPLATES/.clj-kondo/config.edn @@ -0,0 +1,2 @@ +{:linters {:unresolved-symbol {:exclude [(compojure.api.sweet/defroutes)]} + :refer-all {:exclude [clj-time.jdbc]}}} From b26f7eda6d9c5f88cce367f34bad8bad8a78a8c4 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Wed, 24 Jun 2020 09:51:16 -0500 Subject: [PATCH 42/67] fixed command --- lib/linter.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index 74ea060a..39921b04 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -2221,7 +2221,7 @@ RunTestCases() TestCodebase "POWERSHELL" "pwsh" "pwsh -c Invoke-ScriptAnalyzer -EnableExit -Settings $POWERSHELL_LINTER_RULES -Path" ".*\.\(ps1\|psm1\|psd1\|ps1xml\|pssc\|psrc\|cdxml\)\$" TestCodebase "CSS" "stylelint" "stylelint --config $CSS_LINTER_RULES" ".*\.\(css\)\$" TestCodebase "ENV" "dotenv-linter" "dotenv-linter" ".*\.\(env\)\$" - TestCodebase "CLOJURE" "clj-kondo" "clj-kondo --config $CLOJURE_LINTER_RULES" ".*\.\(clj\|cljs\|cljc\|edn\)\$" + TestCodebase "CLOJURE" "clj-kondo" "clj-kondo --config $CLOJURE_LINTER_RULES --lint" ".*\.\(clj\|cljs\|cljc\|edn\)\$" TestCodebase "KOTLIN" "ktlint" "ktlint" ".*\.\(kt\|kts\)\$" ################# @@ -2565,7 +2565,7 @@ if [ "$VALIDATE_CLOJURE" == "true" ]; then ######################### # Lint the Clojure files # ######################### - LintCodebase "CLOJURE" "clj-kondo" "clj-kondo --config $CLOJURE_LINTER_RULES" ".*\.\(clj\|cljs\|cljc\|edn\)\$" "${FILE_ARRAY_CLOJURE[@]}" + LintCodebase "CLOJURE" "clj-kondo" "clj-kondo --config $CLOJURE_LINTER_RULES --lint" ".*\.\(clj\|cljs\|cljc\|edn\)\$" "${FILE_ARRAY_CLOJURE[@]}" fi ###################### From a22335bd62d4362b2631d2204f607a275179758a Mon Sep 17 00:00:00 2001 From: Gabo Date: Wed, 24 Jun 2020 11:47:18 -0500 Subject: [PATCH 43/67] Fix alignment --- .../ansible/ghe-initialize/templates/ghe-config-apply.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.automation/test/ansible/ghe-initialize/templates/ghe-config-apply.sh b/.automation/test/ansible/ghe-initialize/templates/ghe-config-apply.sh index 821a7678..7978c630 100644 --- a/.automation/test/ansible/ghe-initialize/templates/ghe-config-apply.sh +++ b/.automation/test/ansible/ghe-initialize/templates/ghe-config-apply.sh @@ -189,10 +189,10 @@ CheckGHEProcess #################### RunConfigApply -########################################## +########################################### # We're going to run it again after a nap # -# to make sure there is no crazy actions # -########################################## +# to make sure there is no crazy actions # +########################################### sleep 300s ###################### From 3333b232491061152e9840df4b0c669d533bf6fb Mon Sep 17 00:00:00 2001 From: Gabo Date: Wed, 24 Jun 2020 11:47:47 -0500 Subject: [PATCH 44/67] Fix @admiralawkbar capitalization --- lib/linter.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linter.sh b/lib/linter.sh index c3d4be97..5c9db08f 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -3,7 +3,7 @@ ################################################################################ ################################################################################ -########### Super-Linter (Lint all the code) @Admiralawkbar #################### +########### Super-Linter (Lint all the code) @admiralawkbar #################### ################################################################################ ################################################################################ From 9e835d296e4ca6b5b95ebdc758478f11c5bcb0f1 Mon Sep 17 00:00:00 2001 From: Zack Koppert Date: Wed, 24 Jun 2020 12:45:26 -0700 Subject: [PATCH 45/67] Add disclaimer about local development --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 218a30d5..6f4799f2 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ The end goal of this tool: The super-linter finds issues and reports them to the console output. Fixes are suggested in the console output but not automatically fixed, and a status check will show up as failed on the pull request. +The design of the **Super-Linter** is currently to allow linting to occur in **GitHub Actions** as a part of continuous integration occurring on pull requests as the commits get pushed. It works best when commits are being pushed early and often to a branch with an open or draft pull request. There is some desire to move this closer to local development for faster feedback on linting errors but this is not yet supported. + ## Supported Linters Developers on **GitHub** can call the **GitHub Action** to lint their code base with the following list of linters: @@ -163,6 +165,8 @@ The **Docker** container that is built from this repository is located at `https ## Running Super-Linter locally (troubleshooting/debugging/enhancements) If you find that you need to run super-linter locally, you can follow the documentation at [Running super-linter locally](https://github.com/github/super-linter/blob/master/docs/run-linter-locally.md) +Check out the [note](#how-it-works) in **How it Works** to understand more about the **Super-Linter** linting locally versus via continuous integration. + ### CI/CT/CD The **Super-Linter** has *CI/CT/CD* configured utilizing **GitHub** Actions. - When a branch is created and code is pushed, a **GitHub** Action is triggered for building the new **Docker** container with the new codebase From 4b0c348514aea83003d2076882d9cfbc10bfc200 Mon Sep 17 00:00:00 2001 From: Zack Koppert Date: Wed, 24 Jun 2020 15:54:36 -0700 Subject: [PATCH 46/67] Create welcome_new_people.yml Thought it would be fun to welcome newcomers to the repo since there have been so many! --- .github/workflows/welcome_new_people.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/workflows/welcome_new_people.yml diff --git a/.github/workflows/welcome_new_people.yml b/.github/workflows/welcome_new_people.yml new file mode 100644 index 00000000..985ee57e --- /dev/null +++ b/.github/workflows/welcome_new_people.yml @@ -0,0 +1,13 @@ +name: Greetings + +on: [pull_request, issues] + +jobs: + greeting: + runs-on: ubuntu-latest + steps: + - uses: actions/first-interaction@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + issue-message: 'Thanks for opening your first issue in the **super-linter** repo! :tada:' + pr-message: 'Thanks for opening your first pr in the **super-linter** repo! :tada: This project is built on contributions just like this.' From 78e5cd25526efdfcd71c3b8215d7a8acfad4fbe4 Mon Sep 17 00:00:00 2001 From: Zack Koppert Date: Wed, 24 Jun 2020 16:22:44 -0700 Subject: [PATCH 47/67] add github token Co-authored-by: Josh Soref --- .github/workflows/check-spelling.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-spelling.yml b/.github/workflows/check-spelling.yml index 91cb6fd6..b99524b0 100644 --- a/.github/workflows/check-spelling.yml +++ b/.github/workflows/check-spelling.yml @@ -44,4 +44,5 @@ jobs: with: bucket: .github/actions project: spelling - + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 097d6b4737d90e629300d459bf1a911c53644e0d Mon Sep 17 00:00:00 2001 From: Zack Koppert Date: Wed, 24 Jun 2020 16:49:11 -0700 Subject: [PATCH 48/67] Add words to the spelling dictionary that are not mispelled Signed-off-by: Zack Koppert --- .github/actions/spelling/expect.txt | 40 ++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index 8b137891..64d9960d 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -1 +1,39 @@ - +cdxml +changelog +chmod +Dockerhub +EOL +GPR +IAm +icu +jre +kotlin +krb +ktlint +libgcc +libintl +libssl +libstdc +linux +lttng +microsoft +ncurses +nq +openjdk +php +powershell +println +psd +psm +psrc +pssc +psscriptanalyzer +pwsh +rcu +rhc +ry +terminfo +tzdata +userspace +xargs +zlib From eac560b35b45c3850f4aa1b6d9ed0e52a37ee9d4 Mon Sep 17 00:00:00 2001 From: Justin Kalland Date: Thu, 25 Jun 2020 08:13:19 +0200 Subject: [PATCH 49/67] Add support for OpenAPI --- .automation/test/openapi/README.md | 13 +++ .automation/test/openapi/openapi_bad_1.yml | 1 + .automation/test/openapi/openapi_bad_2.json | 3 + .automation/test/openapi/openapi_good_1.yml | 13 +++ .automation/test/openapi/openapi_good_2.json | 23 ++++++ Dockerfile | 4 +- README.md | 2 + TEMPLATES/.openapirc.yml | 9 +++ lib/linter.sh | 83 +++++++++++++++++++- 9 files changed, 146 insertions(+), 5 deletions(-) create mode 100644 .automation/test/openapi/README.md create mode 100644 .automation/test/openapi/openapi_bad_1.yml create mode 100644 .automation/test/openapi/openapi_bad_2.json create mode 100644 .automation/test/openapi/openapi_good_1.yml create mode 100644 .automation/test/openapi/openapi_good_2.json create mode 100644 TEMPLATES/.openapirc.yml diff --git a/.automation/test/openapi/README.md b/.automation/test/openapi/README.md new file mode 100644 index 00000000..8e77fdbf --- /dev/null +++ b/.automation/test/openapi/README.md @@ -0,0 +1,13 @@ +# OpenAPI Test Cases +This folder holds the test cases for **OpenAPI**. + +## 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/openapi/openapi_bad_1.yml b/.automation/test/openapi/openapi_bad_1.yml new file mode 100644 index 00000000..6c86b1b4 --- /dev/null +++ b/.automation/test/openapi/openapi_bad_1.yml @@ -0,0 +1 @@ +openapi: '3.0.0' diff --git a/.automation/test/openapi/openapi_bad_2.json b/.automation/test/openapi/openapi_bad_2.json new file mode 100644 index 00000000..b0b97ddb --- /dev/null +++ b/.automation/test/openapi/openapi_bad_2.json @@ -0,0 +1,3 @@ +{ + "openapi": "3.0.0" +} diff --git a/.automation/test/openapi/openapi_good_1.yml b/.automation/test/openapi/openapi_good_1.yml new file mode 100644 index 00000000..eb4924a1 --- /dev/null +++ b/.automation/test/openapi/openapi_good_1.yml @@ -0,0 +1,13 @@ +openapi: 3.0.0 +info: + title: Example + version: '1.0' + contact: + name: Justin Kalland + email: justin@kalland.com + description: Test for super-linter +servers: + - url: 'http://localhost:3000' +paths: {} +tags: + - name: example diff --git a/.automation/test/openapi/openapi_good_2.json b/.automation/test/openapi/openapi_good_2.json new file mode 100644 index 00000000..93f59635 --- /dev/null +++ b/.automation/test/openapi/openapi_good_2.json @@ -0,0 +1,23 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Example", + "version": "1.0", + "contact": { + "name": "Justin Kalland", + "email": "justin@kalland.com" + }, + "description": "Test for super-linter" + }, + "servers": [ + { + "url": "http://localhost:3000" + } + ], + "paths": {}, + "tags": [ + { + "name": "example" + } + ] +} diff --git a/Dockerfile b/Dockerfile index 49a5dbb1..b25a7b1f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,7 @@ RUN apk add --no-cache \ libxml2-utils perl \ ruby ruby-dev ruby-bundler ruby-rdoc make \ py3-setuptools ansible-lint \ - go \ + go \ openjdk8-jre \ php7 \ ca-certificates less ncurses-terminfo-base \ @@ -72,6 +72,7 @@ RUN npm config set package-lock false \ eslint-plugin-jest \ stylelint \ stylelint-config-standard \ + @stoplight/spectral \ && npm --no-cache install \ markdownlint-cli \ jsonlint prettyjson \ @@ -168,6 +169,7 @@ ENV GITHUB_SHA=${GITHUB_SHA} \ VALIDATE_ENV=${VALIDATE_ENV} \ VALIDATE_KOTLIN=${VALIDATE_KOTLIN} \ VALIDATE_POWERSHELL=${VALIDATE_POWERSHELL} \ + VALIDATE_OPENAPI=${VALIDATE_OPENAPI} \ ANSIBLE_DIRECTORY=${ANSIBLE_DIRECTORY} \ RUN_LOCAL=${RUN_LOCAL} \ TEST_CASE_RUN=${TEST_CASE_RUN} \ diff --git a/README.md b/README.md index 218a30d5..638ed28b 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ Developers on **GitHub** can call the **GitHub Action** to lint their code base | **PowerShell** | [PSScriptAnalyzer](https://github.com/PowerShell/Psscriptanalyzer) | | **ENV** | [dotenv-linter](https://github.com/dotenv-linter/dotenv-linter) | | **Kotlin** | [ktlint](https://github.com/pinterest/ktlint) | +| **OpenAPI** | [spectral](https://github.com/stoplightio/spectral) | ## How to use To use this **GitHub** Action you will need to complete the following: @@ -144,6 +145,7 @@ and won't run anything unexpected. | **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. | | **VALIDATE_KOTLIN** | `true` | Flag to enable or disable the linting process of the language. | +| **VALIDATE_OPENAPI** | `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. | diff --git a/TEMPLATES/.openapirc.yml b/TEMPLATES/.openapirc.yml new file mode 100644 index 00000000..fdf641e1 --- /dev/null +++ b/TEMPLATES/.openapirc.yml @@ -0,0 +1,9 @@ +--- + +########################## +########################## +## OpenAPI Linter rules ## +########################## +########################## + +extends: spectral:oas diff --git a/lib/linter.sh b/lib/linter.sh index 9bad8c8b..7b90ae32 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -54,6 +54,9 @@ POWERSHELL_LINTER_RULES="$DEFAULT_RULES_LOCATION/$POWERSHELL_FILE_NAME" # Pat # 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 +# OpenAPI Vars +OPENAPI_FILE_NAME='.openapirc.yml' # Name of the file +OPENAPI_LINTER_RULES="$DEFAULT_RULES_LOCATION/$OPENAPI_FILE_NAME" # Path to the OpenAPI lint rules ####################################### # Linter array for information prints # @@ -61,7 +64,7 @@ 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" "dotenv-linter" "powershell" "ktlint") + "stylelint" "dotenv-linter" "powershell" "ktlint" "spectral") ############################# # Language array for prints # @@ -69,7 +72,7 @@ LINTER_ARRAY=("jsonlint" "yamllint" "xmllint" "markdownlint" "shellcheck" LANGUAGE_ARRAY=('YML' 'JSON' 'XML' 'MARKDOWN' 'BASH' 'PERL' 'PHP' 'RUBY' 'PYTHON' 'COFFEESCRIPT' 'ANSIBLE' 'JAVASCRIPT_STANDARD' 'JAVASCRIPT_ES' 'TYPESCRIPT_STANDARD' 'TYPESCRIPT_ES' 'DOCKER' 'GO' 'TERRAFORM' - 'ENV' 'POWERSHELL' 'KOTLIN') + 'ENV' 'POWERSHELL' 'KOTLIN' 'OPENAPI') ################### # GitHub ENV Vars # @@ -102,6 +105,7 @@ VALIDATE_ENV="${VALIDATE_ENV}" # Boolean to validate lang VALIDATE_TERRAFORM="${VALIDATE_TERRAFORM}" # Boolean to validate language VALIDATE_POWERSHELL="${VALIDATE_POWERSHELL}" # Boolean to validate language VALIDATE_KOTLIN="${VALIDATE_KOTLIN}" # Boolean to validate language +VALIDATE_OPENAPI="${VALIDATE_OPENAPI}" # 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 @@ -149,6 +153,7 @@ FILE_ARRAY_POWERSHELL=() # Array of files to check FILE_ARRAY_CSS=() # Array of files to check FILE_ARRAY_ENV=() # Array of files to check FILE_ARRAY_KOTLIN=() # Array of files to check +FILE_ARRAY_OPENAPI=() # Array of files to check ############ # Counters # @@ -175,6 +180,7 @@ ERRORS_FOUND_POWERSHELL=0 # Count of errors found ERRORS_FOUND_CSS=0 # Count of errors found ERRORS_FOUND_ENV=0 # Count of errors found ERRORS_FOUND_KOTLIN=0 # Count of errors found +ERRORS_FOUND_OPENAPI=0 # Count of errors found ################################################################################ ########################## FUNCTIONS BELOW ##################################### @@ -556,6 +562,19 @@ LintAnsibleFiles() fi fi } + +################################################################################ +#### Function DetectOpenAPIFile ################################################ +DetectOpenAPIFile() +{ + egrep '"openapi":|"swagger":|^openapi:|^swagger:' $GITHUB_WORKSPACE/$1 > /dev/null + if [ $? -eq 0 ]; then + return 0 + else + return 1 + fi +} + ################################################################################ #### Function GetGitHubVars #################################################### GetGitHubVars() @@ -756,6 +775,7 @@ GetValidationInfo() VALIDATE_CSS=$(echo "$VALIDATE_CSS" | awk '{print tolower($0)}') VALIDATE_ENV=$(echo "$VALIDATE_ENV" | awk '{print tolower($0)}') VALIDATE_KOTLIN=$(echo "$VALIDATE_KOTLIN" | awk '{print tolower($0)}') + VALIDATE_OPENAPI=$(echo "$VALIDATE_OPENAPI" | awk '{print tolower($0)}') ################################################ # Determine if any linters were explicitly set # @@ -782,7 +802,8 @@ GetValidationInfo() -n "$VALIDATE_POWERSHELL" || \ -n "$VALIDATE_CSS" || \ -n "$VALIDATE_ENV" || \ - -n "$VALIDATE_KOTLIN" ]]; then + -n "$VALIDATE_KOTLIN" || \ + -n "$VALIDATE_OPENAPI" ]]; then ANY_SET="true" fi @@ -1094,6 +1115,19 @@ GetValidationInfo() VALIDATE_KOTLIN="true" fi + ####################################### + # Validate if we should check OPENAPI # + ####################################### + if [[ "$ANY_SET" == "true" ]]; then + # Some linter flags were set - only run those set to true + if [[ -z "$VALIDATE_OPENAPI" ]]; then + # OPENAPI flag was not set - default to false + VALIDATE_OPENAPI="false" + fi + else + # No linter flags were set - default all to true + VALIDATE_OPENAPI="true" + fi ####################################### # Print which linters we are enabling # @@ -1208,6 +1242,11 @@ GetValidationInfo() else PRINT_ARRAY+=("- Excluding [KOTLIN] files in code base...") fi + if [[ "$VALIDATE_OPENAPI" == "true" ]]; then + PRINT_ARRAY+=("- Validating [OPENAPI] files in code base...") + else + PRINT_ARRAY+=("- Excluding [OPENAPI] files in code base...") + fi ############################## # Validate Ansible Directory # @@ -1391,6 +1430,12 @@ BuildFileList() # Append the file to the array # ################################ FILE_ARRAY_YML+=("$FILE") + ############################ + # Check if file is OpenAPI # + ############################ + if DetectOpenAPIFile $FILE; then + FILE_ARRAY_OPENAPI+=("$FILE") + fi ########################################################## # Set the READ_ONLY_CHANGE_FLAG since this could be exec # ########################################################## @@ -1403,6 +1448,12 @@ BuildFileList() # Append the file to the array # ################################ FILE_ARRAY_JSON+=("$FILE") + ############################ + # Check if file is OpenAPI # + ############################ + if DetectOpenAPIFile $FILE; then + FILE_ARRAY_OPENAPI+=("$FILE") + fi ########################################################## # Set the READ_ONLY_CHANGE_FLAG since this could be exec # ########################################################## @@ -2122,7 +2173,8 @@ Footer() [ "$ERRORS_FOUND_RUBY" -ne 0 ] || \ [ "$ERRORS_FOUND_CSS" -ne 0 ] || \ [ "$ERRORS_FOUND_ENV" -ne 0 ] || \ - [ "$ERRORS_FOUND_KOTLIN" -ne 0 ]; then + [ "$ERRORS_FOUND_KOTLIN" -ne 0 ] || \ + [ "$ERRORS_FOUND_OPENAPI" -ne 0 ]; then # Failed exit echo "Exiting with errors found!" exit 1 @@ -2184,6 +2236,7 @@ RunTestCases() TestCodebase "CSS" "stylelint" "stylelint --config $CSS_LINTER_RULES" ".*\.\(css\)\$" TestCodebase "ENV" "dotenv-linter" "dotenv-linter" ".*\.\(env\)\$" TestCodebase "KOTLIN" "ktlint" "ktlint" ".*\.\(kt\|kts\)\$" + TestCodebase "OPENAPI" "spectral" "spectral lint -r $OPENAPI_LINTER_RULES" ".*\.\(yml\|yaml\|json\)\$" ################# # Footer prints # @@ -2526,6 +2579,28 @@ if [ "$VALIDATE_POWERSHELL" == "true" ]; then LintCodebase "POWERSHELL" "pwsh" "pwsh -c Invoke-ScriptAnalyzer -EnableExit -Settings $POWERSHELL_LINTER_RULES -Path" ".*\.\(ps1\|psm1\|psd1\|ps1xml\|pssc\|psrc\|cdxml\)\$" "${FILE_ARRAY_POWERSHELL[@]}" fi +################### +# OPENAPI LINTING # +################### +if [ "$VALIDATE_OPENAPI" == "true" ]; then + # If we are validating all codebase we need to build file list because not every yml/json file is an OpenAPI file + if [ "$VALIDATE_ALL_CODEBASE" == "true" ]; then + LIST_FILES=($(cd "$GITHUB_WORKSPACE" || exit; find . -type f -regex ".*\.\(yml\|yaml\|json\)\$" 2>&1)) + for FILE in "${LIST_FILES[@]}" + do + if DetectOpenAPIFile $FILE; then + FILE_ARRAY_OPENAPI+=("$FILE") + fi + done + fi + + ########################## + # Lint the OpenAPI files # + ########################## + # LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY" + LintCodebase "OPENAPI" "spectral" "spectral lint -r $OPENAPI_LINTER_RULES" "disabledfileext" "${FILE_ARRAY_OPENAPI[@]}" +fi + ########## # Footer # ########## From b80ea7e335ae4c3a18007c3372e6d9b91a87e09d Mon Sep 17 00:00:00 2001 From: danielcompton Date: Thu, 25 Jun 2020 20:06:44 +1200 Subject: [PATCH 50/67] Remove unused binding from good Clojure test file Prevents clj-kondo from warning about an unused binding. --- .automation/test/clojure/clojure_good_1.clj | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.automation/test/clojure/clojure_good_1.clj b/.automation/test/clojure/clojure_good_1.clj index 7ea739e1..391f4688 100644 --- a/.automation/test/clojure/clojure_good_1.clj +++ b/.automation/test/clojure/clojure_good_1.clj @@ -7,8 +7,7 @@ (str/join "" "") (defn foo-fn [x] - (let [y (fn [] (inc x)) - z y] + (let [y (fn [] (inc x))] (y))) (letfn From 37f6828d1ecbb30ef3090caf46cfeb4f1fd3ab61 Mon Sep 17 00:00:00 2001 From: Justin Kalland Date: Thu, 25 Jun 2020 11:49:09 +0200 Subject: [PATCH 51/67] Fix OpenAPI tests being run by JSON & YAML Tests are run by file extension. The [JSON] and [YAML] tests were running the _bad_ [OPENAPI] tests and expecting them to fail. For [OPENAPI] the _bad_ tests are syntactically good JSON/YAML but bad OAS. --- .automation/test/openapi/README.md | 3 ++- .../openapi/{openapi_bad_1.yml => openapi_bad_1.ymlopenapi} | 0 .../openapi/{openapi_bad_2.json => openapi_bad_2.jsonopenapi} | 0 .../openapi/{openapi_good_1.yml => openapi_good_1.ymlopenapi} | 0 .../{openapi_good_2.json => openapi_good_2.jsonopenapi} | 0 lib/linter.sh | 2 +- 6 files changed, 3 insertions(+), 2 deletions(-) rename .automation/test/openapi/{openapi_bad_1.yml => openapi_bad_1.ymlopenapi} (100%) rename .automation/test/openapi/{openapi_bad_2.json => openapi_bad_2.jsonopenapi} (100%) rename .automation/test/openapi/{openapi_good_1.yml => openapi_good_1.ymlopenapi} (100%) rename .automation/test/openapi/{openapi_good_2.json => openapi_good_2.jsonopenapi} (100%) diff --git a/.automation/test/openapi/README.md b/.automation/test/openapi/README.md index 8e77fdbf..6f5d2c24 100644 --- a/.automation/test/openapi/README.md +++ b/.automation/test/openapi/README.md @@ -2,7 +2,8 @@ This folder holds the test cases for **OpenAPI**. ## Additional Docs -No Additional information is needed for this test case. +The `_bad_` tests are valid `.yml`/`.json` but invalid OpenAPI specs. +The test extensions used are `.ymlopenapi`/`.jsonopenapi` instead of `.yml`/`.json`. This is to prevent the [YAML] and [JSON] tests from picking them up. ## Good Test Cases The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. diff --git a/.automation/test/openapi/openapi_bad_1.yml b/.automation/test/openapi/openapi_bad_1.ymlopenapi similarity index 100% rename from .automation/test/openapi/openapi_bad_1.yml rename to .automation/test/openapi/openapi_bad_1.ymlopenapi diff --git a/.automation/test/openapi/openapi_bad_2.json b/.automation/test/openapi/openapi_bad_2.jsonopenapi similarity index 100% rename from .automation/test/openapi/openapi_bad_2.json rename to .automation/test/openapi/openapi_bad_2.jsonopenapi diff --git a/.automation/test/openapi/openapi_good_1.yml b/.automation/test/openapi/openapi_good_1.ymlopenapi similarity index 100% rename from .automation/test/openapi/openapi_good_1.yml rename to .automation/test/openapi/openapi_good_1.ymlopenapi diff --git a/.automation/test/openapi/openapi_good_2.json b/.automation/test/openapi/openapi_good_2.jsonopenapi similarity index 100% rename from .automation/test/openapi/openapi_good_2.json rename to .automation/test/openapi/openapi_good_2.jsonopenapi diff --git a/lib/linter.sh b/lib/linter.sh index 7b90ae32..b23b96e6 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -2236,7 +2236,7 @@ RunTestCases() TestCodebase "CSS" "stylelint" "stylelint --config $CSS_LINTER_RULES" ".*\.\(css\)\$" TestCodebase "ENV" "dotenv-linter" "dotenv-linter" ".*\.\(env\)\$" TestCodebase "KOTLIN" "ktlint" "ktlint" ".*\.\(kt\|kts\)\$" - TestCodebase "OPENAPI" "spectral" "spectral lint -r $OPENAPI_LINTER_RULES" ".*\.\(yml\|yaml\|json\)\$" + TestCodebase "OPENAPI" "spectral" "spectral lint -r $OPENAPI_LINTER_RULES" ".*\.\(ymlopenapi\|jsonopenapi\)\$" ################# # Footer prints # From 79671724a0b0142b773e1387c5ddf75fef2f7638 Mon Sep 17 00:00:00 2001 From: Justin Kalland Date: Thu, 25 Jun 2020 12:21:11 +0200 Subject: [PATCH 52/67] Add OpenAPI to disabling-linters doc --- .github/linters/.openapirc.yml | 9 +++++++++ docs/disabling-linters.md | 22 ++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 .github/linters/.openapirc.yml diff --git a/.github/linters/.openapirc.yml b/.github/linters/.openapirc.yml new file mode 100644 index 00000000..fdf641e1 --- /dev/null +++ b/.github/linters/.openapirc.yml @@ -0,0 +1,9 @@ +--- + +########################## +########################## +## OpenAPI Linter rules ## +########################## +########################## + +extends: spectral:oas diff --git a/docs/disabling-linters.md b/docs/disabling-linters.md index c738bdbd..2f36d22d 100644 --- a/docs/disabling-linters.md +++ b/docs/disabling-linters.md @@ -24,6 +24,7 @@ Below are examples and documentation for each language and the various methods t - [CSS](#stylelint) - [ENV](#dotenv-linter) - [Kotlin](#kotlin) +- [OpenAPI](#openapi) @@ -607,3 +608,24 @@ import package.b.* ### ktlint disable entire file - There is currently **No** way to disable rules inline of the file(s) + +-------------------------------------------------------------------------------- + +## OpenAPI +- [spectral](https://github.com/stoplightio/spectral) + +### OpenAPI Config file +- `.github/linters/.openapirc.yml` +- You can add, extend, and disable rules +- Documentation at [Spectral Custom Rulesets](https://stoplight.io/p/docs/gh/stoplightio/spectral/docs/guides/4-custom-rulesets.md) +- File should be located at: `.github/linters/.openapirc.yml` + +### OpenAPI disable single line +- There is currently **No** way to disable rules inline of the file(s) + +### OpenAPI disable code block +- There is currently **No** way to disable rules inline of the file(s) + +### OpenAPI disable entire file +- There is currently **No** way to disable rules inline of the file(s) +- However, you can make [rule exceptions](https://stoplight.io/p/docs/gh/stoplightio/spectral/docs/guides/6-exceptions.md?srn=gh/stoplightio/spectral/docs/guides/6-exceptions.md) in the config for individual file(s). From ce9b8526f85bd248fa4fe0167ccbdce89557f94e Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Thu, 25 Jun 2020 16:56:06 -0400 Subject: [PATCH 53/67] Proactively add GitHub markdown emojis --- .github/actions/spelling/allow/emoji.txt | 48 ++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/actions/spelling/allow/emoji.txt diff --git a/.github/actions/spelling/allow/emoji.txt b/.github/actions/spelling/allow/emoji.txt new file mode 100644 index 00000000..5b4b2b08 --- /dev/null +++ b/.github/actions/spelling/allow/emoji.txt @@ -0,0 +1,48 @@ +abcd +bangbang +bento +bullettrain +busstop +cn +couplekiss +dango +dvd +facepunch +feelsgood +finnadie +fuelpump +gb +goberserk +godmode +gua +hankey +heartpulse +hocho +hurtrealbad +icecream +inbox +iphone +izakaya +jp +keycap +mega +minidisc +moyai +neckbeard +octocat +oden +ramen +ru +scorpius +shipit +snowboarder +tada +tanabata +thumbsdown +thumbsup +tophat +trollface +tshirt +uk +vhs +zzz From aba407fff349a76dead6af5c60b45c26c57edcae Mon Sep 17 00:00:00 2001 From: powerOFMAX Date: Thu, 25 Jun 2020 21:08:05 -0300 Subject: [PATCH 54/67] Add Table of Contents to README --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 6f4799f2..7b89a709 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,20 @@ The end goal of this tool: - Build guidelines for code layout and format - Automate the process to help streamline code reviews + +## Table of Contents + +* [How it works](#how-it-works) +* [Supported linters](#supported-linters) +* [Usage](#how-to-use) +* [Environment variables](#environment-variables) +* [Disable rules](#disabling-rules) +* [Docker Hub](#docker-hub) +* [Run Super-Linter locally](#running-super-linter-locally-troubleshootingdebuggingenhancements) + * [CI / CT/ CD](#cictcd) +* [Limitations](#limitations) + + ## How it Works The super-linter finds issues and reports them to the console output. Fixes are suggested in the console output but not automatically fixed, and a status check will show up as failed on the pull request. From 04e7807d4e7ff7203650d421ca3d6564f0cf0253 Mon Sep 17 00:00:00 2001 From: Thomas Hughes Date: Thu, 25 Jun 2020 19:19:12 -0500 Subject: [PATCH 55/67] Add contributing to ToC --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7b89a709..6aabfb51 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ The end goal of this tool: * [Run Super-Linter locally](#running-super-linter-locally-troubleshootingdebuggingenhancements) * [CI / CT/ CD](#cictcd) * [Limitations](#limitations) - +* [Contributing](#how-to-contribute) ## How it Works From b1a578b42c4c5469d47c453545cbdde7331eda64 Mon Sep 17 00:00:00 2001 From: Thomas Hughes Date: Thu, 25 Jun 2020 19:22:10 -0500 Subject: [PATCH 56/67] Change * for - for consistency --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 6aabfb51..d21b666b 100644 --- a/README.md +++ b/README.md @@ -11,16 +11,16 @@ The end goal of this tool: ## Table of Contents -* [How it works](#how-it-works) -* [Supported linters](#supported-linters) -* [Usage](#how-to-use) -* [Environment variables](#environment-variables) -* [Disable rules](#disabling-rules) -* [Docker Hub](#docker-hub) -* [Run Super-Linter locally](#running-super-linter-locally-troubleshootingdebuggingenhancements) - * [CI / CT/ CD](#cictcd) -* [Limitations](#limitations) -* [Contributing](#how-to-contribute) +- [How it works](#how-it-works) +- [Supported linters](#supported-linters) +- [Usage](#how-to-use) +- [Environment variables](#environment-variables) +- [Disable rules](#disabling-rules) +- [Docker Hub](#docker-hub) +- [Run Super-Linter locally](#running-super-linter-locally-troubleshootingdebuggingenhancements) + - [CI / CT/ CD](#cictcd) +- [Limitations](#limitations) +- [Contributing](#how-to-contribute) ## How it Works From 70f51ccd8fafdd647fa7846f8197efe0379100e9 Mon Sep 17 00:00:00 2001 From: past-due <30942300+past-due@users.noreply.github.com> Date: Thu, 25 Jun 2020 22:54:56 -0400 Subject: [PATCH 57/67] Add JAVASCRIPT_ES_CONFIG_FILE to specify eslintrc filename See: https://eslint.org/docs/user-guide/configuring#configuration-file-formats --- README.md | 1 + lib/linter.sh | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/README.md b/README.md index d21b666b..19a816cd 100644 --- a/README.md +++ b/README.md @@ -150,6 +150,7 @@ and won't run anything unexpected. | **VALIDATE_COFFEE** | `true` | Flag to enable or disable the linting process of the language . | | **VALIDATE_ANSIBLE** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_JAVASCRIPT_ES** | `true` | Flag to enable or disable the linting process of the language. (Utilizing: eslint) | +| **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`)| | **VALIDATE_JAVASCRIPT_STANDARD** | `true` | Flag to enable or disable the linting process of the language. (Utilizing: standard) | | **VALIDATE_TYPESCRIPT_ES** | `true` | Flag to enable or disable the linting process of the language. (Utilizing: eslint) | | **VALIDATE_TYPESCRIPT_STANDARD** | `true` | Flag to enable or disable the linting process of the language. (Utilizing: standard) | diff --git a/lib/linter.sh b/lib/linter.sh index e422ad9d..41d36428 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -92,6 +92,7 @@ VALIDATE_RUBY="${VALIDATE_RUBY}" # Boolean to validate lang VALIDATE_COFFEE="${VALIDATE_COFFEE}" # Boolean to validate language VALIDATE_ANSIBLE="${VALIDATE_ANSIBLE}" # Boolean to validate language VALIDATE_JAVASCRIPT_ES="${VALIDATE_JAVASCRIPT_ES}" # Boolean to validate language +JAVASCRIPT_ES_CONFIG_FILE="${JAVASCRIPT_ES_CONFIG_FILE}" # Filename for eslint configuration (ex: .eslintrc.yml, .eslintrc.json) VALIDATE_JAVASCRIPT_STANDARD="${VALIDATE_JAVASCRIPT_STANDARD}" # Boolean to validate language VALIDATE_TYPESCRIPT_ES="${VALIDATE_TYPESCRIPT_ES}" # Boolean to validate language VALIDATE_TYPESCRIPT_STANDARD="${VALIDATE_TYPESCRIPT_STANDARD}" # Boolean to validate language @@ -117,6 +118,7 @@ ACTIONS_RUNNER_DEBUG="${ACTIONS_RUNNER_DEBUG}" # Boolean to see even more info DEFAULT_VALIDATE_ALL_CODEBASE='true' # Default value for validate all files DEFAULT_WORKSPACE="${DEFAULT_WORKSPACE:-/tmp/lint}" # Default workspace if running locally DEFAULT_ANSIBLE_DIRECTORY="$GITHUB_WORKSPACE/ansible" # Default Ansible Directory +DEFAULT_JAVASCRIPT_ES_CONFIG_FILE=".eslintrc.yml" # Default eslint configuration filename DEFAULT_RUN_LOCAL='false' # Default value for debugging locally DEFAULT_TEST_CASE_RUN='false' # Flag to tell code to run only test cases DEFAULT_ACTIONS_RUNNER_DEBUG='false' # Default value for debugging output @@ -1226,6 +1228,19 @@ GetValidationInfo() # Set the value ANSIBLE_DIRECTORY="$TEMP_ANSIBLE_DIRECTORY" fi + + ######################################### + # Get the eslint configuration filename # + ######################################### + if [ -z "$JAVASCRIPT_ES_CONFIG_FILE" ]; then + ###################################### + # No filename passed, set to default # + ###################################### + JAVASCRIPT_ES_CONFIG_FILE="$DEFAULT_JAVASCRIPT_ES_CONFIG_FILE" + fi + # Set Javascript Vars based on JAVASCRIPT_ES_CONFIG_FILE + JAVASCRIPT_FILE_NAME='$JAVASCRIPT_ES_CONFIG_FILE' # Name of the file + JAVASCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$JAVASCRIPT_FILE_NAME" # Path to the Javascript lint rules ############################### # Get the disable errors flag # From 116698b03237fed27fa86ab9e4ebc1e4ac1266e0 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Fri, 26 Jun 2020 08:26:36 -0500 Subject: [PATCH 58/67] fixed linting errors --- lib/linter.sh | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index a89bb3fe..06bc0022 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -573,10 +573,33 @@ LintAnsibleFiles() #### Function DetectOpenAPIFile ################################################ DetectOpenAPIFile() { - egrep '"openapi":|"swagger":|^openapi:|^swagger:' $GITHUB_WORKSPACE/$1 > /dev/null - if [ $? -eq 0 ]; then + ################ + # Pull in vars # + ################ + FILE="$1" + + ############################### + # Check the file for keywords # + ############################### + egrep '"openapi":|"swagger":|^openapi:|^swagger:' "$GITHUB_WORKSPACE/$FILE" > /dev/null + + ####################### + # Load the error code # + ####################### + ERROR_CODE=$? + + ############################## + # Check the shell for errors # + ############################## + if [ $ERROR_CODE -eq 0 ]; then + ######################## + # Found string in file # + ######################## return 0 else + ################### + # No string match # + ################### return 1 fi } @@ -1460,7 +1483,7 @@ BuildFileList() ############################ # Check if file is OpenAPI # ############################ - if DetectOpenAPIFile $FILE; then + if DetectOpenAPIFile "$FILE"; then FILE_ARRAY_OPENAPI+=("$FILE") fi ########################################################## @@ -1478,7 +1501,7 @@ BuildFileList() ############################ # Check if file is OpenAPI # ############################ - if DetectOpenAPIFile $FILE; then + if DetectOpenAPIFile "$FILE"; then FILE_ARRAY_OPENAPI+=("$FILE") fi ########################################################## @@ -2640,7 +2663,7 @@ if [ "$VALIDATE_OPENAPI" == "true" ]; then LIST_FILES=($(cd "$GITHUB_WORKSPACE" || exit; find . -type f -regex ".*\.\(yml\|yaml\|json\)\$" 2>&1)) for FILE in "${LIST_FILES[@]}" do - if DetectOpenAPIFile $FILE; then + if DetectOpenAPIFile "$FILE"; then FILE_ARRAY_OPENAPI+=("$FILE") fi done From 063e48d9c4926a8353973adc9703bd2a143bfc7e Mon Sep 17 00:00:00 2001 From: Thomas Hughes Date: Fri, 26 Jun 2020 08:35:36 -0500 Subject: [PATCH 59/67] Remove spell-checker --- .github/actions/spelling/allow/Dockerfile.txt | 7 - .../spelling/allow/cleanup-docker.sh.txt | 1 - .../spelling/allow/disabling-linters.md.txt | 3 - .github/actions/spelling/allow/emoji.txt | 48 ------ .../allow/ghe-api-config-apply.yml.txt | 2 - .../spelling/allow/ghe-config-apply.sh.txt | 2 - .../allow/ghe-initial-configuration.yml.txt | 1 - .../allow/ghe-ldap-configuration.yml.txt | 2 - .github/actions/spelling/allow/gitignore.txt | 8 - .github/actions/spelling/allow/linter.sh.txt | 7 - .github/actions/spelling/allow/main.yml.txt | 8 - .../spelling/allow/settings.json.j2.txt | 4 - .github/actions/spelling/allow/words.txt | 158 ------------------ .github/actions/spelling/excludes.txt | 2 - .github/actions/spelling/expect.txt | 39 ----- .github/actions/spelling/patterns.txt | 7 - .github/workflows/check-spelling.yml | 48 ------ 17 files changed, 347 deletions(-) delete mode 100644 .github/actions/spelling/allow/Dockerfile.txt delete mode 100644 .github/actions/spelling/allow/cleanup-docker.sh.txt delete mode 100644 .github/actions/spelling/allow/disabling-linters.md.txt delete mode 100644 .github/actions/spelling/allow/emoji.txt delete mode 100644 .github/actions/spelling/allow/ghe-api-config-apply.yml.txt delete mode 100644 .github/actions/spelling/allow/ghe-config-apply.sh.txt delete mode 100644 .github/actions/spelling/allow/ghe-initial-configuration.yml.txt delete mode 100644 .github/actions/spelling/allow/ghe-ldap-configuration.yml.txt delete mode 100644 .github/actions/spelling/allow/gitignore.txt delete mode 100644 .github/actions/spelling/allow/linter.sh.txt delete mode 100644 .github/actions/spelling/allow/main.yml.txt delete mode 100644 .github/actions/spelling/allow/settings.json.j2.txt delete mode 100644 .github/actions/spelling/allow/words.txt delete mode 100644 .github/actions/spelling/excludes.txt delete mode 100644 .github/actions/spelling/expect.txt delete mode 100644 .github/actions/spelling/patterns.txt delete mode 100644 .github/workflows/check-spelling.yml diff --git a/.github/actions/spelling/allow/Dockerfile.txt b/.github/actions/spelling/allow/Dockerfile.txt deleted file mode 100644 index bb490a92..00000000 --- a/.github/actions/spelling/allow/Dockerfile.txt +++ /dev/null @@ -1,7 +0,0 @@ -musl -nvq -rdoc -setuptools -uninstall -wget -WORKDIR diff --git a/.github/actions/spelling/allow/cleanup-docker.sh.txt b/.github/actions/spelling/allow/cleanup-docker.sh.txt deleted file mode 100644 index 1efe4ad7..00000000 --- a/.github/actions/spelling/allow/cleanup-docker.sh.txt +++ /dev/null @@ -1 +0,0 @@ -alnum diff --git a/.github/actions/spelling/allow/disabling-linters.md.txt b/.github/actions/spelling/allow/disabling-linters.md.txt deleted file mode 100644 index fe1303c8..00000000 --- a/.github/actions/spelling/allow/disabling-linters.md.txt +++ /dev/null @@ -1,3 +0,0 @@ -noqa -toc -todo diff --git a/.github/actions/spelling/allow/emoji.txt b/.github/actions/spelling/allow/emoji.txt deleted file mode 100644 index 5b4b2b08..00000000 --- a/.github/actions/spelling/allow/emoji.txt +++ /dev/null @@ -1,48 +0,0 @@ -abcd -bangbang -bento -bullettrain -busstop -cn -couplekiss -dango -dvd -facepunch -feelsgood -finnadie -fuelpump -gb -goberserk -godmode -gua -hankey -heartpulse -hocho -hurtrealbad -icecream -inbox -iphone -izakaya -jp -keycap -mega -minidisc -moyai -neckbeard -octocat -oden -ramen -ru -scorpius -shipit -snowboarder -tada -tanabata -thumbsdown -thumbsup -tophat -trollface -tshirt -uk -vhs -zzz diff --git a/.github/actions/spelling/allow/ghe-api-config-apply.yml.txt b/.github/actions/spelling/allow/ghe-api-config-apply.yml.txt deleted file mode 100644 index 8d39ee0b..00000000 --- a/.github/actions/spelling/allow/ghe-api-config-apply.yml.txt +++ /dev/null @@ -1,2 +0,0 @@ -configcheck -nohup diff --git a/.github/actions/spelling/allow/ghe-config-apply.sh.txt b/.github/actions/spelling/allow/ghe-config-apply.sh.txt deleted file mode 100644 index 0570567b..00000000 --- a/.github/actions/spelling/allow/ghe-config-apply.sh.txt +++ /dev/null @@ -1,2 +0,0 @@ -args -pid diff --git a/.github/actions/spelling/allow/ghe-initial-configuration.yml.txt b/.github/actions/spelling/allow/ghe-initial-configuration.yml.txt deleted file mode 100644 index a09f0564..00000000 --- a/.github/actions/spelling/allow/ghe-initial-configuration.yml.txt +++ /dev/null @@ -1 +0,0 @@ -initialconfig diff --git a/.github/actions/spelling/allow/ghe-ldap-configuration.yml.txt b/.github/actions/spelling/allow/ghe-ldap-configuration.yml.txt deleted file mode 100644 index 04b1c12f..00000000 --- a/.github/actions/spelling/allow/ghe-ldap-configuration.yml.txt +++ /dev/null @@ -1,2 +0,0 @@ -ldapconfig -openldap diff --git a/.github/actions/spelling/allow/gitignore.txt b/.github/actions/spelling/allow/gitignore.txt deleted file mode 100644 index 6fcb9a9c..00000000 --- a/.github/actions/spelling/allow/gitignore.txt +++ /dev/null @@ -1,8 +0,0 @@ -cov -eslintcache -jscoverage -jspm -nyc -tgz -typings -wscript diff --git a/.github/actions/spelling/allow/linter.sh.txt b/.github/actions/spelling/allow/linter.sh.txt deleted file mode 100644 index 9bd25b2f..00000000 --- a/.github/actions/spelling/allow/linter.sh.txt +++ /dev/null @@ -1,7 +0,0 @@ -cw -Mstrict -printenv -rcfile -tf -tolower -whoami diff --git a/.github/actions/spelling/allow/main.yml.txt b/.github/actions/spelling/allow/main.yml.txt deleted file mode 100644 index 877e71bb..00000000 --- a/.github/actions/spelling/allow/main.yml.txt +++ /dev/null @@ -1,8 +0,0 @@ -Autobots -basemap -cas -cn -crt -rsa -tlsv -tmp diff --git a/.github/actions/spelling/allow/settings.json.j2.txt b/.github/actions/spelling/allow/settings.json.j2.txt deleted file mode 100644 index 7f01269b..00000000 --- a/.github/actions/spelling/allow/settings.json.j2.txt +++ /dev/null @@ -1,4 +0,0 @@ -dotcom -identicons -oauth -timezone diff --git a/.github/actions/spelling/allow/words.txt b/.github/actions/spelling/allow/words.txt deleted file mode 100644 index 0e91754b..00000000 --- a/.github/actions/spelling/allow/words.txt +++ /dev/null @@ -1,158 +0,0 @@ -admiralawkbar -ansible -api -apk -aws -baz -beardofedu -certs -changeset -codebase -CODEOWNERS -coffeelint -coffeescript -collectd -concat -config -configs -css -dest -devops -dirname -dockerfile -dockerfilelint -dockerfilelintrc -dotenv -elif -emails -entrypoint -Errorf -eslint -eslintrc -filetype -func -gcc -getenv -ghe -GHES -ghl -github -globals -golang -golangci -Google -gpg -gql -Grafana -graphql -grep -homepage -hookshot -hostname -hostvars -http -https -hubot -idp -ip -Jani -javascript -jq -json -jsonlint -jwiebalk -JWT -ldap -len -lfs -libxml -linted -linting -loadbalancer -localhost -loglevel -markdownlint -millis -mkdir -nodejs -NONINFRINGEMENT -noproxy -noreply -npm -ntp -opensource -opensourcefriday -perl -plugin -posix -pprint -Prego -prettyjson -Println -probot -px -py -pylint -rb -readlines -README -regex -regexp -resqued -rgba -rien -Rubo -rubocop -saml -screenshots -shellcheck -signup -smtp -snmp -socio -splunk -src -ssh -ssl -sso -stackoverflow -stacktraces -standardjs -stringify -stylelint -stylelintrc -subdomain -subfolders -sudo -sys -syslog -taz -terraform -tflint -tileserver -tls -typeof -ubuntu -udp -uid -undef -uniq -uri -url -urlencode -username -usr -utils -Vape -vnd -webhook -wiki -wildcards -workflow -xml -xmllint -yaml -yamllint -yml -yq -zkoppert diff --git a/.github/actions/spelling/excludes.txt b/.github/actions/spelling/excludes.txt deleted file mode 100644 index 549b89c5..00000000 --- a/.github/actions/spelling/excludes.txt +++ /dev/null @@ -1,2 +0,0 @@ -^\.github/linters/ -^TEMPLATES/\.\S* diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt deleted file mode 100644 index 64d9960d..00000000 --- a/.github/actions/spelling/expect.txt +++ /dev/null @@ -1,39 +0,0 @@ -cdxml -changelog -chmod -Dockerhub -EOL -GPR -IAm -icu -jre -kotlin -krb -ktlint -libgcc -libintl -libssl -libstdc -linux -lttng -microsoft -ncurses -nq -openjdk -php -powershell -println -psd -psm -psrc -pssc -psscriptanalyzer -pwsh -rcu -rhc -ry -terminfo -tzdata -userspace -xargs -zlib diff --git a/.github/actions/spelling/patterns.txt b/.github/actions/spelling/patterns.txt deleted file mode 100644 index 5c595e9b..00000000 --- a/.github/actions/spelling/patterns.txt +++ /dev/null @@ -1,7 +0,0 @@ -https?:\S* -# ignore long runs of a single character: -([A-Za-z])\1{3,} -# Any CLI args (-xzf -aef) -\ -\w+\b -# Hex colors (dummy group to not be treated as comment) -(?:#)([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}) diff --git a/.github/workflows/check-spelling.yml b/.github/workflows/check-spelling.yml deleted file mode 100644 index b99524b0..00000000 --- a/.github/workflows/check-spelling.yml +++ /dev/null @@ -1,48 +0,0 @@ ---- -#################### -## Check spelling ## -#################### - -# -# Documentation: -# https://help.github.com/en/articles/workflow-syntax-for-github-actions -# - -name: Spell checking -############################# -# Start the job on all push # -############################# -on: - push: - branches-ignore: - - 'master' - -############### -# Set the Job # -############### -jobs: - build: - # Name the Job - name: Spell checking - # Set the agent to run on - runs-on: ubuntu-latest - ################## - # Load all steps # - ################## - steps: - ########################## - # Checkout the code base # - ########################## - - name: Checkout Code - uses: actions/checkout@v2 - - ############################# - # Run check spelling action # - ############################# - - name: Check spelling - uses: check-spelling/check-spelling@0.0.16-alpha - with: - bucket: .github/actions - project: spelling - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 8fdce000bf0a0f18721d169b8dc79503c1c633bd Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Fri, 26 Jun 2020 08:44:27 -0500 Subject: [PATCH 60/67] got to catch them all --- lib/linter.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index 06bc0022..ca352e6e 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -581,7 +581,7 @@ DetectOpenAPIFile() ############################### # Check the file for keywords # ############################### - egrep '"openapi":|"swagger":|^openapi:|^swagger:' "$GITHUB_WORKSPACE/$FILE" > /dev/null + grep -E '"openapi":|"swagger":|^openapi:|^swagger:' "$GITHUB_WORKSPACE/$FILE" > /dev/null ####################### # Load the error code # @@ -2232,7 +2232,7 @@ Footer() [ "$ERRORS_FOUND_RUBY" -ne 0 ] || \ [ "$ERRORS_FOUND_CSS" -ne 0 ] || \ [ "$ERRORS_FOUND_ENV" -ne 0 ] || \ - [ "$ERRORS_FOUND_OPENAPI" -ne 0 ] \ + [ "$ERRORS_FOUND_OPENAPI" -ne 0 ] || \ [ "$ERRORS_FOUND_CLOJURE" -ne 0 ] || \ [ "$ERRORS_FOUND_KOTLIN" -ne 0 ]; then # Failed exit @@ -2660,6 +2660,7 @@ fi if [ "$VALIDATE_OPENAPI" == "true" ]; then # If we are validating all codebase we need to build file list because not every yml/json file is an OpenAPI file if [ "$VALIDATE_ALL_CODEBASE" == "true" ]; then + # shellcheck disable=SC2207 LIST_FILES=($(cd "$GITHUB_WORKSPACE" || exit; find . -type f -regex ".*\.\(yml\|yaml\|json\)\$" 2>&1)) for FILE in "${LIST_FILES[@]}" do From f087775d99b15bf6632bbde557d17e18cab00d8b Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Fri, 26 Jun 2020 09:00:28 -0500 Subject: [PATCH 61/67] typo --- lib/linter.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linter.sh b/lib/linter.sh index ca352e6e..65b973a1 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -833,7 +833,7 @@ GetValidationInfo() -n "$VALIDATE_CSS" || \ -n "$VALIDATE_ENV" || \ -n "$VALIDATE_CLOJURE" || \ - -n "$VALIDATE_OPENAPI" ]] \ + -n "$VALIDATE_OPENAPI" || \ -n "$VALIDATE_KOTLIN" ]]; then ANY_SET="true" fi From 24234cc73b0f2e4b1362d9faca72a19860ea1a90 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Fri, 26 Jun 2020 09:38:41 -0500 Subject: [PATCH 62/67] fixed the open issue --- lib/linter.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index 65b973a1..a9ebf15e 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -2289,7 +2289,7 @@ RunTestCases() TestCodebase "JAVASCRIPT_STANDARD" "standard" "standard $JAVASCRIPT_STANDARD_LINTER_RULES" ".*\.\(js\)\$" TestCodebase "TYPESCRIPT_ES" "eslint" "eslint --no-eslintrc -c $TYPESCRIPT_LINTER_RULES" ".*\.\(ts\)\$" TestCodebase "TYPESCRIPT_STANDARD" "standard" "standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin $TYPESCRIPT_STANDARD_LINTER_RULES" ".*\.\(ts\)\$" - TestCodebase "DOCKER" "/dockerfilelint/bin/dockerfilelint" "/dockerfilelint/bin/dockerfilelint" ".*\(Dockerfile\)\$" + TestCodebase "DOCKER" "/dockerfilelint/bin/dockerfilelint" "/dockerfilelint/bin/dockerfilelint -c $DOCKER_LINTER_RULES" ".*\(Dockerfile\)\$" TestCodebase "ANSIBLE" "ansible-lint" "ansible-lint -v -c $ANSIBLE_LINTER_RULES" "ansible-lint" TestCodebase "TERRAFORM" "tflint" "tflint -c $TERRAFORM_LINTER_RULES" ".*\.\(tf\)\$" TestCodebase "POWERSHELL" "pwsh" "pwsh -c Invoke-ScriptAnalyzer -EnableExit -Settings $POWERSHELL_LINTER_RULES -Path" ".*\.\(ps1\|psm1\|psd1\|ps1xml\|pssc\|psrc\|cdxml\)\$" @@ -2626,7 +2626,7 @@ if [ "$VALIDATE_DOCKER" == "true" ]; then # Lint the docker files # ######################### # LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY" - LintCodebase "DOCKER" "/dockerfilelint/bin/dockerfilelint" "/dockerfilelint/bin/dockerfilelint" ".*\(Dockerfile\)\$" "${FILE_ARRAY_DOCKER[@]}" + LintCodebase "DOCKER" "/dockerfilelint/bin/dockerfilelint" "/dockerfilelint/bin/dockerfilelint -c $DOCKER_LINTER_RULES" ".*\(Dockerfile\)\$" "${FILE_ARRAY_DOCKER[@]}" fi ################### From d5724472870a0536250f8821bf8d0c921448b9f8 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Fri, 26 Jun 2020 10:38:02 -0500 Subject: [PATCH 63/67] Adding space support --- lib/linter.sh | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index 65b973a1..df3241fa 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -132,6 +132,7 @@ 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 DEFAULT_DISABLE_ERRORS='false' # Default to enabling errors +DEFAULT_IFS="$IFS" # Get the Default IFS for updating ########################## # Array of changed files # @@ -1856,12 +1857,22 @@ LintCodebase() # We have files added to array of files to check LIST_FILES=("${FILE_ARRAY[@]}") # Copy the array into list else + ############################################################################### + # Set the file seperator to newline to allow for grabbing objects with spaces # + ############################################################################### + IFS=$'\n' + ################################# # Get list of all files to lint # ################################# # shellcheck disable=SC2207,SC2086 LIST_FILES=($(cd "$GITHUB_WORKSPACE" || exit; find . -type f -regex "$FILE_EXTENSIONS" 2>&1)) + ########################### + # Set IFS back to default # + ########################### + IFS="$DEFAULT_IFS" + ############################################################ # Set it back to empty if loaded with blanks from scanning # ############################################################ @@ -2028,11 +2039,21 @@ TestCodebase() # shellcheck disable=SC2207,SC2086,SC2010 LIST_FILES=($(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit; ls ansible/ | grep ".yml" 2>&1)) else + ############################################################################### + # Set the file seperator to newline to allow for grabbing objects with spaces # + ############################################################################### + IFS=$'\n' + ################################# # Get list of all files to lint # ################################# # shellcheck disable=SC2207,SC2086 LIST_FILES=($(cd "$GITHUB_WORKSPACE/$TEST_CASE_FOLDER" || exit; find . -type f -regex "$FILE_EXTENSIONS" ! -path "*./ansible*" 2>&1)) + + ########################### + # Set IFS back to default # + ########################### + IFS="$DEFAULT_IFS" fi ################## @@ -2289,7 +2310,7 @@ RunTestCases() TestCodebase "JAVASCRIPT_STANDARD" "standard" "standard $JAVASCRIPT_STANDARD_LINTER_RULES" ".*\.\(js\)\$" TestCodebase "TYPESCRIPT_ES" "eslint" "eslint --no-eslintrc -c $TYPESCRIPT_LINTER_RULES" ".*\.\(ts\)\$" TestCodebase "TYPESCRIPT_STANDARD" "standard" "standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin $TYPESCRIPT_STANDARD_LINTER_RULES" ".*\.\(ts\)\$" - TestCodebase "DOCKER" "/dockerfilelint/bin/dockerfilelint" "/dockerfilelint/bin/dockerfilelint" ".*\(Dockerfile\)\$" + TestCodebase "DOCKER" "/dockerfilelint/bin/dockerfilelint" "/dockerfilelint/bin/dockerfilelint -c $DOCKER_LINTER_RULES" ".*\(Dockerfile\)\$" TestCodebase "ANSIBLE" "ansible-lint" "ansible-lint -v -c $ANSIBLE_LINTER_RULES" "ansible-lint" TestCodebase "TERRAFORM" "tflint" "tflint -c $TERRAFORM_LINTER_RULES" ".*\.\(tf\)\$" TestCodebase "POWERSHELL" "pwsh" "pwsh -c Invoke-ScriptAnalyzer -EnableExit -Settings $POWERSHELL_LINTER_RULES -Path" ".*\.\(ps1\|psm1\|psd1\|ps1xml\|pssc\|psrc\|cdxml\)\$" @@ -2626,7 +2647,7 @@ if [ "$VALIDATE_DOCKER" == "true" ]; then # Lint the docker files # ######################### # LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY" - LintCodebase "DOCKER" "/dockerfilelint/bin/dockerfilelint" "/dockerfilelint/bin/dockerfilelint" ".*\(Dockerfile\)\$" "${FILE_ARRAY_DOCKER[@]}" + LintCodebase "DOCKER" "/dockerfilelint/bin/dockerfilelint" "/dockerfilelint/bin/dockerfilelint -c $DOCKER_LINTER_RULES" ".*\(Dockerfile\)\$" "${FILE_ARRAY_DOCKER[@]}" fi ################### @@ -2660,6 +2681,11 @@ fi if [ "$VALIDATE_OPENAPI" == "true" ]; then # If we are validating all codebase we need to build file list because not every yml/json file is an OpenAPI file if [ "$VALIDATE_ALL_CODEBASE" == "true" ]; then + ############################################################################### + # Set the file seperator to newline to allow for grabbing objects with spaces # + ############################################################################### + IFS=$'\n' + # shellcheck disable=SC2207 LIST_FILES=($(cd "$GITHUB_WORKSPACE" || exit; find . -type f -regex ".*\.\(yml\|yaml\|json\)\$" 2>&1)) for FILE in "${LIST_FILES[@]}" @@ -2668,6 +2694,11 @@ if [ "$VALIDATE_OPENAPI" == "true" ]; then FILE_ARRAY_OPENAPI+=("$FILE") fi done + + ########################### + # Set IFS back to default # + ########################### + IFS="$DEFAULT_IFS" fi ########################## From 1495c3b22cda396ee6e18bf34c75eb1d0c8b6e1e Mon Sep 17 00:00:00 2001 From: Thomas Hughes Date: Fri, 26 Jun 2020 10:45:43 -0500 Subject: [PATCH 64/67] Add step to ensure release is on marketplace --- .github/CONTRIBUTING.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 253b1933..86d05b97 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -33,9 +33,10 @@ Draft pull requests are also welcome to get feedback early on, or if there is so If you are the current maintainer of this action: 1. Update `README.md` and the wiki to reflect new version number in the example workflow file sections 2. Draft [Release](https://help.github.com/en/github/administering-a-repository/managing-releases-in-a-repository) with a summarized changelog -3. A GitHub Action will Publish the Docker image to GitHub Package Registry once a Release is created -4. A GitHub Action will Publish the Docker image to Docker Hub once a Release is created -5. Look for approval from [CODEOWNERS](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners) +3. Ensure you check the box for [publishing to the marketplace](https://help.github.com/en/actions/creating-actions/publishing-actions-in-github-marketplace#publishing-an-action) +4. A GitHub Action will Publish the Docker image to GitHub Package Registry once a Release is created +5. A GitHub Action will Publish the Docker image to Docker Hub once a Release is created +6. Look for approval from [CODEOWNERS](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners) ## Resources - [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/) From 10a7c9c4798321343a1f38a4617fb5f15c819f87 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Fri, 26 Jun 2020 11:49:41 -0500 Subject: [PATCH 65/67] Adding cleaner update --- README.md | 1 + lib/linter.sh | 19 ++----------------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 567bb466..42fbcbc2 100644 --- a/README.md +++ b/README.md @@ -155,6 +155,7 @@ and won't run anything unexpected. | **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`)| | **VALIDATE_JAVASCRIPT_STANDARD** | `true` | Flag to enable or disable the linting process of the language. (Utilizing: standard) | | **VALIDATE_TYPESCRIPT_ES** | `true` | Flag to enable or disable the linting process of the language. (Utilizing: eslint) | +| **TYPESCRIPT_ES_CONFIG_FILE** | `.eslintrc.yml` | Filename for [eslint configuration](https://eslint.org/docs/user-guide/configuring#configuration-file-formats) (ex: `.eslintrc.yml`, `.eslintrc.json`)| | **VALIDATE_TYPESCRIPT_STANDARD** | `true` | Flag to enable or disable the linting process of the language. (Utilizing: standard) | | **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. | diff --git a/lib/linter.sh b/lib/linter.sh index 2dd5d3cb..da97c9f2 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -29,11 +29,11 @@ RUBY_LINTER_RULES="$DEFAULT_RULES_LOCATION/$RUBY_FILE_NAME" # Path to th COFFEE_FILE_NAME='.coffee-lint.json' # Name of the file COFFEESCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$COFFEE_FILE_NAME" # Path to the coffeescript lint rules # Javascript Vars -JAVASCRIPT_FILE_NAME='.eslintrc.yml' # Name of the file +JAVASCRIPT_FILE_NAME="${JAVASCRIPT_ES_CONFIG_FILE:-.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 # Typescript Vars -TYPESCRIPT_FILE_NAME='.eslintrc.yml' # Name of the file +TYPESCRIPT_FILE_NAME="${TYPESCRIPT_ES_CONFIG_FILE:-.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 # Ansible Vars @@ -98,7 +98,6 @@ VALIDATE_RUBY="${VALIDATE_RUBY}" # Boolean to validate lang VALIDATE_COFFEE="${VALIDATE_COFFEE}" # Boolean to validate language VALIDATE_ANSIBLE="${VALIDATE_ANSIBLE}" # Boolean to validate language VALIDATE_JAVASCRIPT_ES="${VALIDATE_JAVASCRIPT_ES}" # Boolean to validate language -JAVASCRIPT_ES_CONFIG_FILE="${JAVASCRIPT_ES_CONFIG_FILE}" # Filename for eslint configuration (ex: .eslintrc.yml, .eslintrc.json) VALIDATE_JAVASCRIPT_STANDARD="${VALIDATE_JAVASCRIPT_STANDARD}" # Boolean to validate language VALIDATE_TYPESCRIPT_ES="${VALIDATE_TYPESCRIPT_ES}" # Boolean to validate language VALIDATE_TYPESCRIPT_STANDARD="${VALIDATE_TYPESCRIPT_STANDARD}" # Boolean to validate language @@ -126,7 +125,6 @@ ACTIONS_RUNNER_DEBUG="${ACTIONS_RUNNER_DEBUG}" # Boolean to see even more info DEFAULT_VALIDATE_ALL_CODEBASE='true' # Default value for validate all files DEFAULT_WORKSPACE="${DEFAULT_WORKSPACE:-/tmp/lint}" # Default workspace if running locally DEFAULT_ANSIBLE_DIRECTORY="$GITHUB_WORKSPACE/ansible" # Default Ansible Directory -DEFAULT_JAVASCRIPT_ES_CONFIG_FILE=".eslintrc.yml" # Default eslint configuration filename DEFAULT_RUN_LOCAL='false' # Default value for debugging locally DEFAULT_TEST_CASE_RUN='false' # Flag to tell code to run only test cases DEFAULT_ACTIONS_RUNNER_DEBUG='false' # Default value for debugging output @@ -1318,19 +1316,6 @@ GetValidationInfo() # Set the value ANSIBLE_DIRECTORY="$TEMP_ANSIBLE_DIRECTORY" fi - - ######################################### - # Get the eslint configuration filename # - ######################################### - if [ -z "$JAVASCRIPT_ES_CONFIG_FILE" ]; then - ###################################### - # No filename passed, set to default # - ###################################### - JAVASCRIPT_ES_CONFIG_FILE="$DEFAULT_JAVASCRIPT_ES_CONFIG_FILE" - fi - # Set Javascript Vars based on JAVASCRIPT_ES_CONFIG_FILE - JAVASCRIPT_FILE_NAME='$JAVASCRIPT_ES_CONFIG_FILE' # Name of the file - JAVASCRIPT_LINTER_RULES="$DEFAULT_RULES_LOCATION/$JAVASCRIPT_FILE_NAME" # Path to the Javascript lint rules ############################### # Get the disable errors flag # From d8608a6cf128cc6dfe3223275b98a6dc98459729 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Fri, 26 Jun 2020 14:21:37 -0500 Subject: [PATCH 66/67] solve name --- README.md | 1 + lib/linter.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 42fbcbc2..1b9b7e09 100644 --- a/README.md +++ b/README.md @@ -149,6 +149,7 @@ and won't run anything unexpected. | **VALIDATE_PHP** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_PYTHON** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_RUBY** | `true` | Flag to enable or disable the linting process of the language. | +| **RUBY_CONFIG_FILE** | `.ruby-lint.yml` | Filename for [rubocop configuration](https://docs.rubocop.org/rubocop/configuration.html) (ex: `.ruby-lint.yml`, `.rubocop.yml`)| | **VALIDATE_COFFEE** | `true` | Flag to enable or disable the linting process of the language . | | **VALIDATE_ANSIBLE** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_JAVASCRIPT_ES** | `true` | Flag to enable or disable the linting process of the language. (Utilizing: eslint) | diff --git a/lib/linter.sh b/lib/linter.sh index da97c9f2..6226455c 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -23,7 +23,7 @@ MD_LINTER_RULES="$DEFAULT_RULES_LOCATION/$MD_FILE_NAME" # Path to th PYTHON_FILE_NAME='.python-lint' # Name of the file PYTHON_LINTER_RULES="$DEFAULT_RULES_LOCATION/$PYTHON_FILE_NAME" # Path to the python lint rules # Ruby Vars -RUBY_FILE_NAME='.ruby-lint.yml' # Name of the file +RUBY_FILE_NAME="${RUBY_CONFIG_FILE:-.ruby-lint.yml}" # Name of the file RUBY_LINTER_RULES="$DEFAULT_RULES_LOCATION/$RUBY_FILE_NAME" # Path to the ruby lint rules # Coffee Vars COFFEE_FILE_NAME='.coffee-lint.json' # Name of the file From 0482ce0b8ff5e4d8d05fef4035ce8641cbf4d72d Mon Sep 17 00:00:00 2001 From: Thomas Hughes Date: Sun, 28 Jun 2020 07:39:31 -0500 Subject: [PATCH 67/67] Delete welcome_new_people.yml --- .github/workflows/welcome_new_people.yml | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 .github/workflows/welcome_new_people.yml diff --git a/.github/workflows/welcome_new_people.yml b/.github/workflows/welcome_new_people.yml deleted file mode 100644 index 985ee57e..00000000 --- a/.github/workflows/welcome_new_people.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Greetings - -on: [pull_request, issues] - -jobs: - greeting: - runs-on: ubuntu-latest - steps: - - uses: actions/first-interaction@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - issue-message: 'Thanks for opening your first issue in the **super-linter** repo! :tada:' - pr-message: 'Thanks for opening your first pr in the **super-linter** repo! :tada: This project is built on contributions just like this.'