From 574bef0b3cf0a707a4b44008242d7d939b709aad Mon Sep 17 00:00:00 2001 From: goedelsoup Date: Fri, 19 Jun 2020 14:30:28 -0400 Subject: [PATCH 01/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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/41] 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 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 14/41] 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 15/41] 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 16/41] 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 17/41] 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 4b0c348514aea83003d2076882d9cfbc10bfc200 Mon Sep 17 00:00:00 2001 From: Zack Koppert Date: Wed, 24 Jun 2020 15:54:36 -0700 Subject: [PATCH 18/41] 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 19/41] 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 20/41] 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 21/41] 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 22/41] 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 23/41] 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 24/41] 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 25/41] 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 26/41] 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 27/41] 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 28/41] 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 29/41] 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 30/41] 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 31/41] 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 32/41] 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 33/41] 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 34/41] 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 35/41] 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 36/41] 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 37/41] 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 38/41] 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 d155ff2a3c4d2034e77ad66aa9bec5ab590d26ab Mon Sep 17 00:00:00 2001 From: Drew Ayling Date: Fri, 26 Jun 2020 16:16:22 -0600 Subject: [PATCH 39/41] Fix honoring pylint config file The pylint config file is correctly being applied to the pylint command, however, the `-E` flag is actually not honoring any of the disabled messages in the `.python-lint` file. By making this change to the default lint file only the errors are output as expected but honoring the disabled messages. Also, disable the score as the -E flag also does. --- .github/linters/.python-lint | 3 ++- TEMPLATES/.python-lint | 3 ++- lib/linter.sh | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/linters/.python-lint b/.github/linters/.python-lint index 8e9cc00e..e3d9f5b5 100644 --- a/.github/linters/.python-lint +++ b/.github/linters/.python-lint @@ -1,4 +1,5 @@ [MASTER] +errors-only= # A comma-separated list of package or module names from where C extensions may # be loaded. Extensions are loading into the active Python interpreter and may @@ -157,7 +158,7 @@ output-format=text reports=no # Activate the evaluation score. -score=yes +score=no [REFACTORING] diff --git a/TEMPLATES/.python-lint b/TEMPLATES/.python-lint index 8e9cc00e..e3d9f5b5 100644 --- a/TEMPLATES/.python-lint +++ b/TEMPLATES/.python-lint @@ -1,4 +1,5 @@ [MASTER] +errors-only= # A comma-separated list of package or module names from where C extensions may # be loaded. Extensions are loading into the active Python interpreter and may @@ -157,7 +158,7 @@ output-format=text reports=no # Activate the evaluation score. -score=yes +score=no [REFACTORING] diff --git a/lib/linter.sh b/lib/linter.sh index 6226455c..6cf8d46d 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -2300,7 +2300,7 @@ RunTestCases() TestCodebase "XML" "xmllint" "xmllint" ".*\.\(xml\)\$" TestCodebase "MARKDOWN" "markdownlint" "markdownlint -c $MD_LINTER_RULES" ".*\.\(md\)\$" TestCodebase "BASH" "shellcheck" "shellcheck" ".*\.\(sh\)\$" - TestCodebase "PYTHON" "pylint" "pylint --rcfile $PYTHON_LINTER_RULES -E" ".*\.\(py\)\$" + TestCodebase "PYTHON" "pylint" "pylint --rcfile $PYTHON_LINTER_RULES" ".*\.\(py\)\$" TestCodebase "PERL" "perl" "perl -Mstrict -cw" ".*\.\(pl\)\$" TestCodebase "PHP" "php" "php -l" ".*\.\(php\)\$" TestCodebase "RUBY" "rubocop" "rubocop -c $RUBY_LINTER_RULES" ".*\.\(rb\)\$" @@ -2472,7 +2472,7 @@ if [ "$VALIDATE_PYTHON" == "true" ]; then # Lint the python files # ######################### # LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY" - LintCodebase "PYTHON" "pylint" "pylint --rcfile $PYTHON_LINTER_RULES -E" ".*\.\(py\)\$" "${FILE_ARRAY_PYTHON[@]}" + LintCodebase "PYTHON" "pylint" "pylint --rcfile $PYTHON_LINTER_RULES" ".*\.\(py\)\$" "${FILE_ARRAY_PYTHON[@]}" fi ################ From 0482ce0b8ff5e4d8d05fef4035ce8641cbf4d72d Mon Sep 17 00:00:00 2001 From: Thomas Hughes Date: Sun, 28 Jun 2020 07:39:31 -0500 Subject: [PATCH 40/41] 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.' From a4fa97234ad9dfa3a749d7bdddd329ed17d458a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Knudsen?= Date: Mon, 29 Jun 2020 09:07:40 +0200 Subject: [PATCH 41/41] Read Clojure filetypes from $FILE_TYPE, not $FILE --- lib/linter.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linter.sh b/lib/linter.sh index 6226455c..d7e025a9 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -1695,7 +1695,7 @@ 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 + elif [ "$FILE_TYPE" == "clj" ] || [ "$FILE_TYPE" == "cljs" ] || [ "$FILE_TYPE" == "cljc" ] || [ "$FILE_TYPE" == "edn" ]; then ################################ # Append the file to the array # ################################