From 574bef0b3cf0a707a4b44008242d7d939b709aad Mon Sep 17 00:00:00 2001 From: goedelsoup Date: Fri, 19 Jun 2020 14:30:28 -0400 Subject: [PATCH 01/29] 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/29] 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/29] 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 5063d7cb6c03e3aa8c7031b5b7e3bdb46e63e4f7 Mon Sep 17 00:00:00 2001 From: goedelsoup Date: Mon, 22 Jun 2020 08:39:32 -0400 Subject: [PATCH 04/29] 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 7a298710713bbbe52efc450161aa7770ccc59fb8 Mon Sep 17 00:00:00 2001 From: goedelsoup Date: Tue, 23 Jun 2020 09:43:29 -0400 Subject: [PATCH 05/29] 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 06/29] 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 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 07/29] 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 e15a4dc174afa34173cce5a355d53f5b973f2dca Mon Sep 17 00:00:00 2001 From: Gabo Date: Sun, 21 Jun 2020 18:41:24 -0500 Subject: [PATCH 08/29] 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 09/29] 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 10/29] 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 11/29] 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 12/29] 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 13/29] 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 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 14/29] 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 15/29] 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 16/29] 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 17/29] 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 18/29] 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 19/29] 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 20/29] 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 21/29] 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 22/29] 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 23/29] 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 24/29] 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 b80ea7e335ae4c3a18007c3372e6d9b91a87e09d Mon Sep 17 00:00:00 2001 From: danielcompton Date: Thu, 25 Jun 2020 20:06:44 +1200 Subject: [PATCH 25/29] 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 ce9b8526f85bd248fa4fe0167ccbdce89557f94e Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Thu, 25 Jun 2020 16:56:06 -0400 Subject: [PATCH 26/29] 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 27/29] 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 28/29] 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 29/29] 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