From 3d8c51f768f412592f37c74dcecbf3b2f15e0713 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Mon, 20 Jul 2020 14:07:56 -0500 Subject: [PATCH 01/19] adding the code --- README.md | 5 +- lib/linter.sh | 270 ++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 198 insertions(+), 77 deletions(-) diff --git a/README.md b/README.md index 14396934..9ad35000 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,8 @@ To use this **GitHub** Action you will need to complete the following: 5. Enjoy your more *stable*, and *cleaner* code base 6. Check out the [Wiki](https://github.com/github/super-linter/wiki) for customization options +**NOTE:** You will need the *Environment* variable `GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}` set in your workflow file to be able to use the multiple status API returns. There is no need to set the **GitHub** Secret, it only needs to be passed. + ### Example connecting GitHub Action Workflow In your repository you should have a `.github/workflows` folder with **GitHub** Action similar to below: @@ -132,6 +134,7 @@ jobs: env: VALIDATE_ALL_CODEBASE: false DEFAULT_BRANCH: master + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ... ``` @@ -197,7 +200,7 @@ and won't run anything unexpected. | **OUTPUT_FORMAT** | `none` | The report format to be generated, besides the stdout one. Output format of tap is currently using v13 of the specification. Supported formats: tap | | **OUTPUT_FOLDER** | `super-linter.report` | The location where the output reporting will be generated to. Output folder must not previously exist. | | **OUTPUT_DETAILS** | `simpler` | What level of details to be reported. Supported formats: simpler or detailed. | - +| **MULTI_STATUS** | `true` | A status API is made for each language that is linted to make visual parsing easier. | ### Template rules files You can use the **GitHub** **Super-Linter** *with* or *without* your own personal rules sets. This allows for greater flexibility for each individual code base. The Template rules all try to follow the standards we believe should be enabled at the basic level. diff --git a/lib/linter.sh b/lib/linter.sh index b57fc05f..77a996f1 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -111,43 +111,47 @@ LANGUAGE_ARRAY=('YML' 'JSON' 'XML' 'MARKDOWN' 'BASH' 'PERL' 'RAKU' 'PHP' 'RUBY' GITHUB_SHA="${GITHUB_SHA}" # GitHub sha from the commit GITHUB_EVENT_PATH="${GITHUB_EVENT_PATH}" # Github Event Path GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # Github Workspace +GITHUB_TOKEN="${GITHUB_TOKEN}" # GitHub Token passed from environment +GITHUB_REPOSITORY="${GITHUB_REPOSITORY}" # GitHub Org/Repo passed from system +GITHUB_RUN_ID="${GITHUB_RUN_ID}" # GitHub RUn ID to point to logs DEFAULT_BRANCH="${DEFAULT_BRANCH:-master}" # Default Git Branch to use (master by default) +MULTI_STATUS="${MULTI_STATUS:-true}" # Multiple status are created for each check ran ANSIBLE_DIRECTORY="${ANSIBLE_DIRECTORY}" # Ansible Directory VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE}" # Boolean to validate all files -VALIDATE_YAML="${VALIDATE_YAML}" # Boolean to validate language -VALIDATE_JSON="${VALIDATE_JSON}" # Boolean to validate language -VALIDATE_XML="${VALIDATE_XML}" # Boolean to validate language -VALIDATE_MD="${VALIDATE_MD}" # Boolean to validate language -VALIDATE_BASH="${VALIDATE_BASH}" # Boolean to validate language -VALIDATE_PERL="${VALIDATE_PERL}" # Boolean to validate language -VALIDATE_RAKU="${VALIDATE_RAKU}" # Boolean to validate language -VALIDATE_PHP="${VALIDATE_PHP}" # Boolean to validate language -VALIDATE_PYTHON="${VALIDATE_PYTHON}" # Boolean to validate language -VALIDATE_CLOUDFORMATION="${VALIDATE_CLOUDFORMATION}" # Boolean to validate language -VALIDATE_RUBY="${VALIDATE_RUBY}" # Boolean to validate language -VALIDATE_COFFEE="${VALIDATE_COFFEE}" # Boolean to validate language VALIDATE_ANSIBLE="${VALIDATE_ANSIBLE}" # Boolean to validate language +VALIDATE_ARM="${VALIDATE_ARM}" # Boolean to validate language +VALIDATE_BASH="${VALIDATE_BASH}" # Boolean to validate language +VALIDATE_CLOUDFORMATION="${VALIDATE_CLOUDFORMATION}" # Boolean to validate language +VALIDATE_CLOJURE="${VALIDATE_CLOJURE}" # Boolean to validate language +VALIDATE_COFFEE="${VALIDATE_COFFEE}" # Boolean to validate language +VALIDATE_CSS="${VALIDATE_CSS}" # Boolean to validate language +VALIDATE_DART="${VALIDATE_DART}" # Boolean to validate language +VALIDATE_DOCKER="${VALIDATE_DOCKER}" # Boolean to validate language +VALIDATE_EDITORCONFIG="${VALIDATE_EDITORCONFIG}" # Boolean to validate files with editorconfig +VALIDATE_ENV="${VALIDATE_ENV}" # Boolean to validate language +VALIDATE_GO="${VALIDATE_GO}" # Boolean to validate language +VALIDATE_HTML="${VALIDATE_HTML}" # Boolean to validate language VALIDATE_JAVASCRIPT_ES="${VALIDATE_JAVASCRIPT_ES}" # Boolean to validate language VALIDATE_JAVASCRIPT_STANDARD="${VALIDATE_JAVASCRIPT_STANDARD}" # Boolean to validate language -VALIDATE_JSX="${VALIDATE_JSX}" # Boolean to validate jsx files -VALIDATE_TSX="${VALIDATE_TSX}" # Boolean to validate tsx files +VALIDATE_JSON="${VALIDATE_JSON}" # Boolean to validate language +VALIDATE_JSX="${VALIDATE_JSX}" # Boolean to validate language +VALIDATE_KOTLIN="${VALIDATE_KOTLIN}" # Boolean to validate language +VALIDATE_MD="${VALIDATE_MD}" # Boolean to validate language +VALIDATE_OPENAPI="${VALIDATE_OPENAPI}" # Boolean to validate language +VALIDATE_PERL="${VALIDATE_PERL}" # Boolean to validate language +VALIDATE_PHP="${VALIDATE_PHP}" # Boolean to validate language +VALIDATE_POWERSHELL="${VALIDATE_POWERSHELL}" # Boolean to validate language +VALIDATE_PYTHON="${VALIDATE_PYTHON}" # Boolean to validate language +VALIDATE_RAKU="${VALIDATE_RAKU}" # Boolean to validate language +VALIDATE_RUBY="${VALIDATE_RUBY}" # Boolean to validate language +VALIDATE_TERRAFORM="${VALIDATE_TERRAFORM}" # Boolean to validate language +VALIDATE_TSX="${VALIDATE_TSX}" # Boolean to validate language VALIDATE_TYPESCRIPT_ES="${VALIDATE_TYPESCRIPT_ES}" # Boolean to validate language VALIDATE_TYPESCRIPT_STANDARD="${VALIDATE_TYPESCRIPT_STANDARD}" # Boolean to validate language -VALIDATE_DOCKER="${VALIDATE_DOCKER}" # Boolean to validate language -VALIDATE_GO="${VALIDATE_GO}" # Boolean to validate language -VALIDATE_CSS="${VALIDATE_CSS}" # Boolean to validate language -VALIDATE_ENV="${VALIDATE_ENV}" # Boolean to validate language -VALIDATE_CLOJURE="${VALIDATE_CLOJURE}" # Boolean to validate language -VALIDATE_TERRAFORM="${VALIDATE_TERRAFORM}" # Boolean to validate language -VALIDATE_POWERSHELL="${VALIDATE_POWERSHELL}" # Boolean to validate language -VALIDATE_ARM="${VALIDATE_ARM}" # Boolean to validate language -VALIDATE_KOTLIN="${VALIDATE_KOTLIN}" # Boolean to validate language -VALIDATE_OPENAPI="${VALIDATE_OPENAPI}" # Boolean to validate language -VALIDATE_DART="${VALIDATE_DART}" # Boolean to validate language -VALIDATE_EDITORCONFIG="${VALIDATE_EDITORCONFIG}" # Boolean to validate files with editorconfig +VALIDATE_XML="${VALIDATE_XML}" # Boolean to validate language +VALIDATE_YAML="${VALIDATE_YAML}" # 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 -VALIDATE_HTML="${VALIDATE_HTML}" # Boolean to validate language ############## # Debug Vars # @@ -191,73 +195,73 @@ REPORT_OUTPUT_FOLDER="${DEFAULT_WORKSPACE}/${OUTPUT_FOLDER}" ########################## # Array of changed files # ########################## -FILE_ARRAY_YML=() # Array of files to check -FILE_ARRAY_JSON=() # Array of files to check -FILE_ARRAY_XML=() # Array of files to check -FILE_ARRAY_MD=() # Array of files to check +FILE_ARRAY_ARM=() # Array of files to check FILE_ARRAY_BASH=() # Array of files to check -FILE_ARRAY_PERL=() # Array of files to check -FILE_ARRAY_RAKU=() # Array of files to check -FILE_ARRAY_PHP=() # Array of files to check -FILE_ARRAY_RUBY=() # Array of files to check -FILE_ARRAY_PYTHON=() # Array of files to check FILE_ARRAY_CFN=() # Array of files to check +FILE_ARRAY_CLOJURE=() # Array of files to check FILE_ARRAY_COFFEESCRIPT=() # Array of files to check +FILE_ARRAY_CSS=() # Array of files to check +FILE_ARRAY_DART=() # Array of files to check +FILE_ARRAY_DOCKER=() # Array of files to check +FILE_ARRAY_ENV=() # Array of files to check +FILE_ARRAY_GO=() # Array of files to check +FILE_ARRAY_HTML=() # Array of files to check FILE_ARRAY_JAVASCRIPT_ES=() # Array of files to check FILE_ARRAY_JAVASCRIPT_STANDARD=() # Array of files to check +FILE_ARRAY_JSON=() # Array of files to check FILE_ARRAY_JSX=() # Array of files to check +FILE_ARRAY_KOTLIN=() # Array of files to check +FILE_ARRAY_MD=() # Array of files to check +FILE_ARRAY_OPENAPI=() # Array of files to check +FILE_ARRAY_PERL=() # Array of files to check +FILE_ARRAY_PHP=() # Array of files to check +FILE_ARRAY_POWERSHELL=() # Array of files to check +FILE_ARRAY_PROTOBUF=() # Array of files to check +FILE_ARRAY_PYTHON=() # Array of files to check +FILE_ARRAY_RAKU=() # Array of files to check +FILE_ARRAY_RUBY=() # Array of files to check +FILE_ARRAY_TERRAFORM=() # Array of files to check FILE_ARRAY_TSX=() # Array of files to check FILE_ARRAY_TYPESCRIPT_ES=() # Array of files to check 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_ARM=() # 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 -FILE_ARRAY_KOTLIN=() # Array of files to check -FILE_ARRAY_PROTOBUF=() # Array of files to check -FILE_ARRAY_OPENAPI=() # Array of files to check -FILE_ARRAY_DART=() # Array of files to check -FILE_ARRAY_HTML=() # Array of files to check +FILE_ARRAY_XML=() # Array of files to check +FILE_ARRAY_YML=() # Array of files to check ############ # Counters # ############ -ERRORS_FOUND_YML=0 # Count of errors found -ERRORS_FOUND_JSON=0 # Count of errors found -ERRORS_FOUND_XML=0 # Count of errors found -ERRORS_FOUND_MARKDOWN=0 # Count of errors found -ERRORS_FOUND_BASH=0 # Count of errors found -ERRORS_FOUND_PERL=0 # Count of errors found -ERRORS_FOUND_RAKU=0 # Count of errors found -ERRORS_FOUND_PHP=0 # Count of errors found -ERRORS_FOUND_RUBY=0 # Count of errors found -ERRORS_FOUND_PYTHON=0 # Count of errors found -ERRORS_FOUND_CFN=0 # Count of errors found -ERRORS_FOUND_COFFEESCRIPT=0 # Count of errors found ERRORS_FOUND_ANSIBLE=0 # Count of errors found +ERRORS_FOUND_ARM=0 # Count of errors found +ERRORS_FOUND_BASH=0 # Count of errors found +ERRORS_FOUND_CFN=0 # Count of errors found +ERRORS_FOUND_CLOJURE=0 # Count of errors found +ERRORS_FOUND_CSS=0 # Count of errors found +ERRORS_FOUND_COFFEESCRIPT=0 # Count of errors found +ERRORS_FOUND_DART=0 # Count of errors found +ERRORS_FOUND_DOCKER=0 # Count of errors found +ERRORS_FOUND_ENV=0 # Count of errors found +ERRORS_FOUND_GO=0 # Count of errors found +ERRORS_FOUND_HTML=0 # Count of errors found ERRORS_FOUND_JAVASCRIPT_STANDARD=0 # Count of errors found ERRORS_FOUND_JAVASCRIPT_ES=0 # Count of errors found +ERRORS_FOUND_JSON=0 # Count of errors found ERRORS_FOUND_JSX=0 # Count of errors found +ERRORS_FOUND_KOTLIN=0 # Count of errors found +ERRORS_FOUND_MARKDOWN=0 # Count of errors found +ERRORS_FOUND_OPENAPI=0 # Count of errors found +ERRORS_FOUND_PERL=0 # Count of errors found +ERRORS_FOUND_PHP=0 # Count of errors found +ERRORS_FOUND_POWERSHELL=0 # Count of errors found +ERRORS_FOUND_PROTOBUF=0 # Count of errors found +ERRORS_FOUND_PYTHON=0 # Count of errors found +ERRORS_FOUND_RAKU=0 # Count of errors found +ERRORS_FOUND_RUBY=0 # Count of errors found +ERRORS_FOUND_TERRAFORM=0 # Count of errors found ERRORS_FOUND_TSX=0 # Count of errors found ERRORS_FOUND_TYPESCRIPT_STANDARD=0 # Count of errors found ERRORS_FOUND_TYPESCRIPT_ES=0 # Count of errors found -ERRORS_FOUND_DOCKER=0 # Count of errors found -ERRORS_FOUND_GO=0 # Count of errors found -ERRORS_FOUND_TERRAFORM=0 # Count of errors found -ERRORS_FOUND_POWERSHELL=0 # Count of errors found -ERRORS_FOUND_ARM=0 # Count of errors found -ERRORS_FOUND_CSS=0 # Count of errors found -ERRORS_FOUND_ENV=0 # Count of errors found -ERRORS_FOUND_CLOJURE=0 # Count of errors found -ERRORS_FOUND_KOTLIN=0 # Count of errors found -ERRORS_FOUND_PROTOBUF=0 # Count of errors found -ERRORS_FOUND_OPENAPI=0 # Count of errors found -ERRORS_FOUND_DART=0 # Count of errors found -ERRORS_FOUND_HTML=0 # Count of errors found +ERRORS_FOUND_XML=0 # Count of errors found +ERRORS_FOUND_YML=0 # Count of errors found ################################################################################ ########################## FUNCTIONS BELOW ##################################### @@ -708,6 +712,49 @@ GetGitHubVars() { echo -e "${NC}${F[B]}Successfully found:${F[W]}[GITHUB_REPO]${F[B]}, value:${F[W]}[$GITHUB_REPO]${NC}" fi fi + + ############################ + # Validate we have a value # + ############################ + if [ -z "$GITHUB_TOKEN" ]; then + echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GITHUB_TOKEN]!${NC}" + echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_TOKEN]${NC}" + echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Please set a [GITHUB_TOKEN] from the main workflow environment to take advantage of multiple status reports!${NC}" + else + echo -e "${NC}${F[B]}Successfully found:${F[W]}[GITHUB_TOKEN]${NC}" + fi + + ############################### + # Convert string to lowercase # + ############################### + MULTI_STATUS=$(echo "$MULTI_STATUS" | awk '{print tolower($0)}') + + ####################################################################### + # Check to see if the multi status is set, and we have a token to use # + ####################################################################### + if [ "$MULTI_STATUS" == "true" ] && [ -n "$GITHUB_TOKEN" ]; then + ############################ + # Validate we have a value # + ############################ + if [ -z "$GITHUB_REPOSITORY" ]; then + echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GITHUB_REPOSITORY]!${NC}" + echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_REPOSITORY]${NC}" + exit 1 + else + echo -e "${NC}${F[B]}Successfully found:${F[W]}[GITHUB_REPOSITORY]${F[B]}, value:${F[W]}[$GITHUB_REPOSITORY]${NC}" + fi + + ############################ + # Validate we have a value # + ############################ + if [ -z "$GITHUB_RUN_ID" ]; then + echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GITHUB_RUN_ID]!${NC}" + echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_RUN_ID]${NC}" + exit 1 + else + echo -e "${NC}${F[B]}Successfully found:${F[W]}[GITHUB_RUN_ID]${F[B]}, value:${F[W]}[$GITHUB_RUN_ID]${NC}" + fi + fi } ################################################################################ #### Function ValidatePowershellModules ######################################## @@ -751,6 +798,57 @@ function ValidatePowershellModules() { fi } ################################################################################ +#### Function CallStatusAPI #################################################### +CallStatusAPI() { + #################### + # Pull in the vars # + #################### + LANGUAGE="$1" # langauge that was validated + STATUS="$2" # success | error + SUCCESS_MSG='No errors were found in the linting process' + FAIL_MSG='Errors were detected, please view logs' + MESSAGE='' # Message to send to status API + + ###################################### + # Check the status to create message # + ###################################### + if [ "$STATUS" == "success" ]; then + # Success + MESSAGE="$SUCCESS_MSG" + else + # Failure + MESSAGE="$FAIL_MSG" + fi + + ############################################## + # Call the status API to create status check # + ############################################## + SEND_STATUS_CMD=$(curl -X -s -f POST \ + --url "https://api.github.com/repos/$GITHUB_REPOSITORY/statuses/$GITHUB_SHA" \ + -H 'accept: application/vnd.github.v3+json' \ + -H "authorization: Bearer $GITHUB_TOKEN" \ + -H 'content-type: application/json' \ + -d "{ \"state\": \"$STATUS\", + \"target_url\": \"https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\", + \"description\": \"$MESSAGE\", \"context\": \" --> Lint-Language/$LANGUAGE\" + }" 2>&1) + + ####################### + # Load the error code # + ####################### + ERROR_CODE=$? + + ############################## + # Check the shell for errors # + ############################## + if [ "$ERROR_CODE" -ne 0 ]; then + # ERROR + echo "ERROR! Failed to call GitHub Status API!" + echo "ERROR:[$SEND_STATUS_CMD]" + # Not going to fail the script on this yet... + fi +} +################################################################################ #### Function Footer ########################################################### Footer() { echo "" @@ -781,9 +879,23 @@ Footer() { # Print if not 0 # ################## if [ "${!ERROR_COUNTER}" -ne 0 ]; then - # Print the goods + # We found errors + + ################### + # Print the goods # + ################### echo -e "${NC}${B[R]}${F[W]}ERRORS FOUND${NC} in $LANGUAGE:[${!ERROR_COUNTER}]${NC}" - fi + + ######################################### + # Create status API for Failed language # + ######################################### + CallStatusAPI "$LANGUAGE" "error" + else + # No errors found + ######################################### + # Create status API for Failed language # + ######################################### + CallStatusAPI "$LANGUAGE" "success" done ################################ @@ -934,6 +1046,12 @@ fi # Check to see if this is a test case run # ########################################### if [[ $TEST_CASE_RUN != "false" ]]; then + + ############################################# + # Set the multi status to off for test runs # + ############################################# + MULTI_STATUS='false' + ########################### # Run only the test cases # ########################### From 2b478cc1cd214158f8eea303e4ef7b1f7e381c8d Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Mon, 20 Jul 2020 14:13:26 -0500 Subject: [PATCH 02/19] close the loop --- lib/linter.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/linter.sh b/lib/linter.sh index 77a996f1..e6a180e4 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -896,6 +896,7 @@ Footer() { # Create status API for Failed language # ######################################### CallStatusAPI "$LANGUAGE" "success" + fi done ################################ From 4b6d5433f199d0d645b295852b700697b812be22 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Mon, 20 Jul 2020 14:29:03 -0500 Subject: [PATCH 03/19] more clean --- lib/linter.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index e6a180e4..a4371723 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -823,8 +823,8 @@ CallStatusAPI() { ############################################## # Call the status API to create status check # ############################################## - SEND_STATUS_CMD=$(curl -X -s -f POST \ - --url "https://api.github.com/repos/$GITHUB_REPOSITORY/statuses/$GITHUB_SHA" \ + SEND_STATUS_CMD=$(curl -f -s -X POST \ + --url "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/statuses/$GITHUB_SHA" \ -H 'accept: application/vnd.github.v3+json' \ -H "authorization: Bearer $GITHUB_TOKEN" \ -H 'content-type: application/json' \ From 7e89fa681c9acdb5aee99f460d5033b696c5d01a Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Mon, 20 Jul 2020 14:52:56 -0500 Subject: [PATCH 04/19] fixed langauge logic --- lib/linter.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index a4371723..41abb56f 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -830,7 +830,7 @@ CallStatusAPI() { -H 'content-type: application/json' \ -d "{ \"state\": \"$STATUS\", \"target_url\": \"https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\", - \"description\": \"$MESSAGE\", \"context\": \" --> Lint-Language/$LANGUAGE\" + \"description\": \"$MESSAGE\", \"context\": \"--> Linted: $LANGUAGE\" }" 2>&1) ####################### @@ -892,10 +892,18 @@ Footer() { CallStatusAPI "$LANGUAGE" "error" else # No errors found - ######################################### - # Create status API for Failed language # - ######################################### - CallStatusAPI "$LANGUAGE" "success" + + ############################################### + # Create Validate language var from Var input # + ############################################### + VALIDATE_LANGUAGE="VALIDATE_${LANGUAGE}" + + ###################################### + # Check if we validated the langauge # + ###################################### + if [ "${!VALIDATE_LANGUAGE}" == "true" ]; then + CallStatusAPI "$LANGUAGE" "success" + fi fi done From e2ed325d4eb2c32a66c69b7989ce287771f77960 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Mon, 20 Jul 2020 15:09:34 -0500 Subject: [PATCH 05/19] found a bug --- lib/linter.sh | 4 ++-- lib/validation.sh | 50 +++++++++++++++++++++++------------------------ 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index 41abb56f..eb0587da 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -896,12 +896,12 @@ Footer() { ############################################### # Create Validate language var from Var input # ############################################### - VALIDATE_LANGUAGE="VALIDATE_${LANGUAGE}" + VALIDATE_LANGUAGE_ARRAY="FILE_ARRAY_${LANGUAGE}" ###################################### # Check if we validated the langauge # ###################################### - if [ "${!VALIDATE_LANGUAGE}" == "true" ]; then + if [ "${!VALIDATE_LANGUAGE_ARRAY}" -gt 0 ]; then CallStatusAPI "$LANGUAGE" "success" fi fi diff --git a/lib/validation.sh b/lib/validation.sh index cc25f430..3750d28f 100755 --- a/lib/validation.sh +++ b/lib/validation.sh @@ -46,38 +46,38 @@ function GetValidationInfo() { ################################ # Convert strings to lowercase # ################################ - VALIDATE_YAML=$(echo "$VALIDATE_YAML" | awk '{print tolower($0)}') - VALIDATE_JSON=$(echo "$VALIDATE_JSON" | awk '{print tolower($0)}') - VALIDATE_XML=$(echo "$VALIDATE_XML" | awk '{print tolower($0)}') - VALIDATE_MD=$(echo "$VALIDATE_MD" | awk '{print tolower($0)}') - VALIDATE_BASH=$(echo "$VALIDATE_BASH" | awk '{print tolower($0)}') - VALIDATE_PERL=$(echo "$VALIDATE_PERL" | awk '{print tolower($0)}') - VALIDATE_RAKU=$(echo "$VALIDATE_RAKU" | awk '{print tolower($0)}') - VALIDATE_PHP=$(echo "$VALIDATE_PHP" | awk '{print tolower($0)}') - VALIDATE_PYTHON=$(echo "$VALIDATE_PYTHON" | awk '{print tolower($0)}') - VALIDATE_RUBY=$(echo "$VALIDATE_RUBY" | awk '{print tolower($0)}') - VALIDATE_COFFEE=$(echo "$VALIDATE_COFFEE" | awk '{print tolower($0)}') VALIDATE_ANSIBLE=$(echo "$VALIDATE_ANSIBLE" | awk '{print tolower($0)}') + VALIDATE_ARM=$(echo "$VALIDATE_ARM" | awk '{print tolower($0)}') + VALIDATE_BASH=$(echo "$VALIDATE_BASH" | awk '{print tolower($0)}') + VALIDATE_CLOJURE=$(echo "$VALIDATE_CLOJURE" | awk '{print tolower($0)}') + VALIDATE_COFFEE=$(echo "$VALIDATE_COFFEE" | awk '{print tolower($0)}') + VALIDATE_CSS=$(echo "$VALIDATE_CSS" | awk '{print tolower($0)}') + VALIDATE_DART=$(echo "$VALIDATE_DART" | awk '{print tolower($0)}') + VALIDATE_DOCKER=$(echo "$VALIDATE_DOCKER" | awk '{print tolower($0)}') + VALIDATE_EDITORCONFIG=$(echo "$VALIDATE_EDITORCONFIG" | awk '{print tolower($0)}') + VALIDATE_ENV=$(echo "$VALIDATE_ENV" | awk '{print tolower($0)}') + VALIDATE_GO=$(echo "$VALIDATE_GO" | awk '{print tolower($0)}') + VALIDATE_HTML=$(echo "$VALIDATE_HTML" | awk '{print tolower($0)}') VALIDATE_JAVASCRIPT_ES=$(echo "$VALIDATE_JAVASCRIPT_ES" | awk '{print tolower($0)}') VALIDATE_JAVASCRIPT_STANDARD=$(echo "$VALIDATE_JAVASCRIPT_STANDARD" | awk '{print tolower($0)}') + VALIDATE_JSON=$(echo "$VALIDATE_JSON" | awk '{print tolower($0)}') VALIDATE_JSX=$(echo "$VALIDATE_JSX" | awk '{print tolower($0)}') + VALIDATE_KOTLIN=$(echo "$VALIDATE_KOTLIN" | awk '{print tolower($0)}') + VALIDATE_MD=$(echo "$VALIDATE_MD" | awk '{print tolower($0)}') + VALIDATE_OPENAPI=$(echo "$VALIDATE_OPENAPI" | awk '{print tolower($0)}') + VALIDATE_PERL=$(echo "$VALIDATE_PERL" | awk '{print tolower($0)}') + VALIDATE_PHP=$(echo "$VALIDATE_PHP" | awk '{print tolower($0)}') + VALIDATE_POWERSHELL=$(echo "$VALIDATE_POWERSHELL" | awk '{print tolower($0)}') + VALIDATE_PROTOBUF=$(echo "$VALIDATE_PROTOBUF" | awk '{print tolower($0)}') + VALIDATE_PYTHON=$(echo "$VALIDATE_PYTHON" | awk '{print tolower($0)}') + VALIDATE_RAKU=$(echo "$VALIDATE_RAKU" | awk '{print tolower($0)}') + VALIDATE_RUBY=$(echo "$VALIDATE_RUBY" | awk '{print tolower($0)}') + VALIDATE_TERRAFORM=$(echo "$VALIDATE_TERRAFORM" | awk '{print tolower($0)}') VALIDATE_TSX=$(echo "$VALIDATE_TSX" | awk '{print tolower($0)}') VALIDATE_TYPESCRIPT_ES=$(echo "$VALIDATE_TYPESCRIPT_ES" | awk '{print tolower($0)}') VALIDATE_TYPESCRIPT_STANDARD=$(echo "$VALIDATE_TYPESCRIPT_STANDARD" | awk '{print tolower($0)}') - VALIDATE_DOCKER=$(echo "$VALIDATE_DOCKER" | awk '{print tolower($0)}') - VALIDATE_GO=$(echo "$VALIDATE_GO" | awk '{print tolower($0)}') - VALIDATE_TERRAFORM=$(echo "$VALIDATE_TERRAFORM" | awk '{print tolower($0)}') - VALIDATE_POWERSHELL=$(echo "$VALIDATE_POWERSHELL" | awk '{print tolower($0)}') - VALIDATE_ARM=$(echo "$VALIDATE_ARM" | awk '{print tolower($0)}') - VALIDATE_CSS=$(echo "$VALIDATE_CSS" | awk '{print tolower($0)}') - VALIDATE_ENV=$(echo "$VALIDATE_ENV" | awk '{print tolower($0)}') - VALIDATE_CLOJURE=$(echo "$VALIDATE_CLOJURE" | awk '{print tolower($0)}') - VALIDATE_KOTLIN=$(echo "$VALIDATE_KOTLIN" | awk '{print tolower($0)}') - VALIDATE_PROTOBUF=$(echo "$VALIDATE_PROTOBUF" | awk '{print tolower($0)}') - VALIDATE_OPENAPI=$(echo "$VALIDATE_OPENAPI" | awk '{print tolower($0)}') - VALIDATE_EDITORCONFIG=$(echo "$VALIDATE_EDITORCONFIG" | awk '{print tolower($0)}') - VALIDATE_DART=$(echo "$VALIDATE_DART" | awk '{print tolower($0)}') - VALIDATE_HTML=$(echo "$VALIDATE_HTML" | awk '{print tolower($0)}') + VALIDATE_YAML=$(echo "$VALIDATE_YAML" | awk '{print tolower($0)}') + VALIDATE_XML=$(echo "$VALIDATE_XML" | awk '{print tolower($0)}') ################################################ # Determine if any linters were explicitly set # From 195f67e1657b94465302ddbf6bbf26f14e994d19 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Mon, 20 Jul 2020 15:15:10 -0500 Subject: [PATCH 06/19] can i do this --- lib/linter.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linter.sh b/lib/linter.sh index eb0587da..e8b041e8 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -901,7 +901,7 @@ Footer() { ###################################### # Check if we validated the langauge # ###################################### - if [ "${!VALIDATE_LANGUAGE_ARRAY}" -gt 0 ]; then + if [ "${#!VALIDATE_LANGUAGE_ARRAY[@]}" -gt 0 ]; then CallStatusAPI "$LANGUAGE" "success" fi fi From f6c1de220cf3ef543ebbba94cd1cbc32b17e5e7e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Jul 2020 06:04:24 +0000 Subject: [PATCH 07/19] Bump @typescript-eslint/eslint-plugin in /dependencies Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 3.6.1 to 3.7.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v3.7.0/packages/eslint-plugin) Signed-off-by: dependabot[bot] --- dependencies/package-lock.json | 90 +++++++++++++++++----------------- dependencies/package.json | 2 +- 2 files changed, 45 insertions(+), 47 deletions(-) diff --git a/dependencies/package-lock.json b/dependencies/package-lock.json index 74f6fe6a..22066e50 100644 --- a/dependencies/package-lock.json +++ b/dependencies/package-lock.json @@ -475,58 +475,28 @@ "integrity": "sha512-/tiJyrc0GPcsReHzgC0SXwOmoPjLqYe01W7dLYB0yasQXMbcRee+ZIk+g8MIQhoBS8fPoBQO3Y93+aeBrI93Ug==" }, "@typescript-eslint/eslint-plugin": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.6.1.tgz", - "integrity": "sha512-06lfjo76naNeOMDl+mWG9Fh/a0UHKLGhin+mGaIw72FUMbMGBkdi/FEJmgEDzh4eE73KIYzHWvOCYJ0ak7nrJQ==", + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.7.0.tgz", + "integrity": "sha512-4OEcPON3QIx0ntsuiuFP/TkldmBGXf0uKxPQlGtS/W2F3ndYm8Vgdpj/woPJkzUc65gd3iR+qi3K8SDQP/obFg==", "requires": { - "@typescript-eslint/experimental-utils": "3.6.1", + "@typescript-eslint/experimental-utils": "3.7.0", "debug": "^4.1.1", "functional-red-black-tree": "^1.0.1", "regexpp": "^3.0.0", "semver": "^7.3.2", "tsutils": "^3.17.1" - }, - "dependencies": { - "@typescript-eslint/experimental-utils": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.6.1.tgz", - "integrity": "sha512-oS+hihzQE5M84ewXrTlVx7eTgc52eu+sVmG7ayLfOhyZmJ8Unvf3osyFQNADHP26yoThFfbxcibbO0d2FjnYhg==", - "requires": { - "@types/json-schema": "^7.0.3", - "@typescript-eslint/types": "3.6.1", - "@typescript-eslint/typescript-estree": "3.6.1", - "eslint-scope": "^5.0.0", - "eslint-utils": "^2.0.0" - } - }, - "@typescript-eslint/types": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-3.6.1.tgz", - "integrity": "sha512-NPxd5yXG63gx57WDTW1rp0cF3XlNuuFFB5G+Kc48zZ+51ZnQn9yjDEsjTPQ+aWM+V+Z0I4kuTFKjKvgcT1F7xQ==" - }, - "@typescript-eslint/typescript-estree": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.6.1.tgz", - "integrity": "sha512-G4XRe/ZbCZkL1fy09DPN3U0mR6SayIv1zSeBNquRFRk7CnVLgkC2ZPj8llEMJg5Y8dJ3T76SvTGtceytniaztQ==", - "requires": { - "@typescript-eslint/types": "3.6.1", - "@typescript-eslint/visitor-keys": "3.6.1", - "debug": "^4.1.1", - "glob": "^7.1.6", - "is-glob": "^4.0.1", - "lodash": "^4.17.15", - "semver": "^7.3.2", - "tsutils": "^3.17.1" - } - }, - "@typescript-eslint/visitor-keys": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.6.1.tgz", - "integrity": "sha512-qC8Olwz5ZyMTZrh4Wl3K4U6tfms0R/mzU4/5W3XeUZptVraGVmbptJbn6h2Ey6Rb3hOs3zWoAUebZk8t47KGiQ==", - "requires": { - "eslint-visitor-keys": "^1.1.0" - } - } + } + }, + "@typescript-eslint/experimental-utils": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.7.0.tgz", + "integrity": "sha512-xpfXXAfZqhhqs5RPQBfAFrWDHoNxD5+sVB5A46TF58Bq1hRfVROrWHcQHHUM9aCBdy9+cwATcvCbRg8aIRbaHQ==", + "requires": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/types": "3.7.0", + "@typescript-eslint/typescript-estree": "3.7.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^2.0.0" } }, "@typescript-eslint/parser": { @@ -583,6 +553,34 @@ } } }, + "@typescript-eslint/types": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-3.7.0.tgz", + "integrity": "sha512-reCaK+hyKkKF+itoylAnLzFeNYAEktB0XVfSQvf0gcVgpz1l49Lt6Vo9x4MVCCxiDydA0iLAjTF/ODH0pbfnpg==" + }, + "@typescript-eslint/typescript-estree": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.7.0.tgz", + "integrity": "sha512-xr5oobkYRebejlACGr1TJ0Z/r0a2/HUf0SXqPvlgUMwiMqOCu/J+/Dr9U3T0IxpE5oLFSkqMx1FE/dKaZ8KsOQ==", + "requires": { + "@typescript-eslint/types": "3.7.0", + "@typescript-eslint/visitor-keys": "3.7.0", + "debug": "^4.1.1", + "glob": "^7.1.6", + "is-glob": "^4.0.1", + "lodash": "^4.17.15", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.7.0.tgz", + "integrity": "sha512-k5PiZdB4vklUpUX4NBncn5RBKty8G3ihTY+hqJsCdMuD0v4jofI5xuqwnVcWxfv6iTm2P/dfEa2wMUnsUY8ODw==", + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, "JSV": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/JSV/-/JSV-4.0.2.tgz", diff --git a/dependencies/package.json b/dependencies/package.json index eff0a75c..02a3b7dc 100644 --- a/dependencies/package.json +++ b/dependencies/package.json @@ -3,7 +3,7 @@ "dependencies": { "@coffeelint/cli": "^3.2.10", "@stoplight/spectral": "^5.4.0", - "@typescript-eslint/eslint-plugin": "^3.6.1", + "@typescript-eslint/eslint-plugin": "^3.7.0", "@typescript-eslint/parser": "^3.6.1", "babel-eslint": "^10.1.0", "dockerfilelint": "^1.5.0", From 1fe8fb5431d2b50eb5456b1b2677d33b5f434b73 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 21 Jul 2020 08:12:28 -0500 Subject: [PATCH 08/19] maybe this does it --- lib/linter.sh | 28 +++++++++++++--------------- lib/worker.sh | 5 +++++ 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index e8b041e8..095fbaeb 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -99,11 +99,16 @@ LINTER_ARRAY=("jsonlint" "yamllint" "xmllint" "markdownlint" "shellcheck" ############################# # Language array for prints # ############################# -LANGUAGE_ARRAY=('YML' 'JSON' 'XML' 'MARKDOWN' 'BASH' 'PERL' 'RAKU' 'PHP' 'RUBY' 'PYTHON' - 'COFFEESCRIPT' 'ANSIBLE' 'JAVASCRIPT_STANDARD' 'JAVASCRIPT_ES' 'JSX' 'TSX' - 'TYPESCRIPT_STANDARD' 'TYPESCRIPT_ES' 'DOCKER' 'GO' 'TERRAFORM' - 'CSS' 'ENV' 'POWERSHELL' 'ARM' 'KOTLIN' 'PROTOBUF' 'CLOJURE' 'OPENAPI' - 'CFN' 'DART' 'HTML') +LANGUAGE_ARRAY=('ANSIBLE' 'ARM' 'BASH' 'CFN' 'CLOJURE' 'COFFEESCRIPT' + 'CSS' 'DART' 'DOCKER' 'ENV' 'GO' 'HTML' + 'JAVASCRIPT_ES' 'JAVASCRIPT_STANDARD' 'JSON' 'JSX' 'KOTLIN' 'OPENAPI' + 'MARKDOWN' 'PERL' 'PHP' 'POWERSHELL' 'PROTOBUF' 'PYTHON' 'RAKU' 'RUBY' + 'TERRAFORM' 'TSX' 'TYPESCRIPT_ES' 'TYPESCRIPT_STANDARD' 'XML' 'YML' ) + +############################################ +# Array for all languages that were linted # +############################################ +LINTED_LANGUAGES_ARRAY=() # Will be filled at run time with all languages that were linted ################### # GitHub ENV Vars # @@ -879,8 +884,7 @@ Footer() { # Print if not 0 # ################## if [ "${!ERROR_COUNTER}" -ne 0 ]; then - # We found errors - + # We found errors in the language ################### # Print the goods # ################### @@ -891,17 +895,11 @@ Footer() { ######################################### CallStatusAPI "$LANGUAGE" "error" else - # No errors found - - ############################################### - # Create Validate language var from Var input # - ############################################### - VALIDATE_LANGUAGE_ARRAY="FILE_ARRAY_${LANGUAGE}" - + # No errors found when linting the language ###################################### # Check if we validated the langauge # ###################################### - if [ "${#!VALIDATE_LANGUAGE_ARRAY[@]}" -gt 0 ]; then + if [[ "${LINTED_LANGUAGES_ARRAY[@]}" =~ "${LANGUAGE}" ]]; then CallStatusAPI "$LANGUAGE" "success" fi fi diff --git a/lib/worker.sh b/lib/worker.sh index c75dc65a..b602ec09 100755 --- a/lib/worker.sh +++ b/lib/worker.sh @@ -34,6 +34,11 @@ function LintCodebase() { PRINT_ARRAY+=("----------------------------------------------") PRINT_ARRAY+=("----------------------------------------------") + ################################# + # Add the language to the array # + ################################# + LINTED_LANGUAGES_ARRAY+=("$FILE_TYPE") + ##################################### # Validate we have linter installed # ##################################### From dabf5e25c08e4ea0d7534a63c8e5871d7a4c8e79 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 21 Jul 2020 08:23:32 -0500 Subject: [PATCH 09/19] this shoudl be better --- lib/linter.sh | 7 ++++++- lib/worker.sh | 10 +++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index 095fbaeb..4ea4892c 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -871,6 +871,11 @@ Footer() { echo "Reports generated in folder ${REPORT_OUTPUT_FOLDER}" fi + #################################################### + # Need to clean up the lanuage array of duplicates # + #################################################### + UNIQUE_LINTED_ARRAY=($(echo "${LINTED_LANGUAGES_ARRAY[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')) + ############################## # Prints for errors if found # ############################## @@ -899,7 +904,7 @@ Footer() { ###################################### # Check if we validated the langauge # ###################################### - if [[ "${LINTED_LANGUAGES_ARRAY[@]}" =~ "${LANGUAGE}" ]]; then + if [[ "${UNIQUE_LINTED_ARRAY[@]}" =~ "${LANGUAGE}" ]]; then CallStatusAPI "$LANGUAGE" "success" fi fi diff --git a/lib/worker.sh b/lib/worker.sh index b602ec09..41a18054 100755 --- a/lib/worker.sh +++ b/lib/worker.sh @@ -34,11 +34,6 @@ function LintCodebase() { PRINT_ARRAY+=("----------------------------------------------") PRINT_ARRAY+=("----------------------------------------------") - ################################# - # Add the language to the array # - ################################# - LINTED_LANGUAGES_ARRAY+=("$FILE_TYPE") - ##################################### # Validate we have linter installed # ##################################### @@ -173,6 +168,11 @@ function LintCodebase() { echo "---------------------------" echo "File:[$FILE]" + ################################# + # Add the language to the array # + ################################# + LINTED_LANGUAGES_ARRAY+=("$FILE_TYPE") + #################### # Set the base Var # #################### From 535d2aea7d12a88220bb94fd0179abcbf2f98921 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 21 Jul 2020 08:52:30 -0500 Subject: [PATCH 10/19] fixing internal names --- lib/buildFileList.sh | 2 +- lib/linter.sh | 20 ++++++++++---------- lib/validation.sh | 12 ++++++------ lib/worker.sh | 4 ++-- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/buildFileList.sh b/lib/buildFileList.sh index ea152a4b..7e105d32 100755 --- a/lib/buildFileList.sh +++ b/lib/buildFileList.sh @@ -183,7 +183,7 @@ function BuildFileList() { ################################ # Append the file to the array # ################################ - FILE_ARRAY_MD+=("$FILE") + FILE_ARRAY_MARKDOWN+=("$FILE") ###################### # Get the BASH files # ###################### diff --git a/lib/linter.sh b/lib/linter.sh index 4ea4892c..6e57750b 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -28,8 +28,8 @@ LINTER_RULES_PATH="${LINTER_RULES_PATH:-.github/linters}" # Linter YAML_FILE_NAME='.yaml-lint.yml' # Name of the file YAML_LINTER_RULES="$DEFAULT_RULES_LOCATION/$YAML_FILE_NAME" # Path to the yaml lint rules # MD Vars -MD_FILE_NAME='.markdown-lint.yml' # Name of the file -MD_LINTER_RULES="$DEFAULT_RULES_LOCATION/$MD_FILE_NAME" # Path to the markdown lint rules +MARKDOWN_FILE_NAME='.markdown-lint.yml' # Name of the file +MARKDOWN_LINTER_RULES="$DEFAULT_RULES_LOCATION/$MARKDOWN_FILE_NAME" # Path to the markdown lint rules # Python Vars PYTHON_FILE_NAME='.python-lint' # Name of the file PYTHON_LINTER_RULES="$DEFAULT_RULES_LOCATION/$PYTHON_FILE_NAME" # Path to the python lint rules @@ -102,7 +102,7 @@ LINTER_ARRAY=("jsonlint" "yamllint" "xmllint" "markdownlint" "shellcheck" LANGUAGE_ARRAY=('ANSIBLE' 'ARM' 'BASH' 'CFN' 'CLOJURE' 'COFFEESCRIPT' 'CSS' 'DART' 'DOCKER' 'ENV' 'GO' 'HTML' 'JAVASCRIPT_ES' 'JAVASCRIPT_STANDARD' 'JSON' 'JSX' 'KOTLIN' 'OPENAPI' - 'MARKDOWN' 'PERL' 'PHP' 'POWERSHELL' 'PROTOBUF' 'PYTHON' 'RAKU' 'RUBY' + 'MARKDOWN' 'PERL' 'PHP' 'POWERSHELL' 'PROTOBUF' 'PYTHON' 'RAKU' 'RUBY' 'TERRAFORM' 'TSX' 'TYPESCRIPT_ES' 'TYPESCRIPT_STANDARD' 'XML' 'YML' ) ############################################ @@ -126,7 +126,7 @@ VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE}" # Boolean to vali VALIDATE_ANSIBLE="${VALIDATE_ANSIBLE}" # Boolean to validate language VALIDATE_ARM="${VALIDATE_ARM}" # Boolean to validate language VALIDATE_BASH="${VALIDATE_BASH}" # Boolean to validate language -VALIDATE_CLOUDFORMATION="${VALIDATE_CLOUDFORMATION}" # Boolean to validate language +VALIDATE_CFN="${VALIDATE_CLOUDFORMATION}" # Boolean to validate language VALIDATE_CLOJURE="${VALIDATE_CLOJURE}" # Boolean to validate language VALIDATE_COFFEE="${VALIDATE_COFFEE}" # Boolean to validate language VALIDATE_CSS="${VALIDATE_CSS}" # Boolean to validate language @@ -141,7 +141,7 @@ VALIDATE_JAVASCRIPT_STANDARD="${VALIDATE_JAVASCRIPT_STANDARD}" # Boolean to vali VALIDATE_JSON="${VALIDATE_JSON}" # Boolean to validate language VALIDATE_JSX="${VALIDATE_JSX}" # Boolean to validate language VALIDATE_KOTLIN="${VALIDATE_KOTLIN}" # Boolean to validate language -VALIDATE_MD="${VALIDATE_MD}" # Boolean to validate language +VALIDATE_MARKDOWN="${VALIDATE_MD}" # Boolean to validate language VALIDATE_OPENAPI="${VALIDATE_OPENAPI}" # Boolean to validate language VALIDATE_PERL="${VALIDATE_PERL}" # Boolean to validate language VALIDATE_PHP="${VALIDATE_PHP}" # Boolean to validate language @@ -216,7 +216,7 @@ FILE_ARRAY_JAVASCRIPT_STANDARD=() # Array of files to check FILE_ARRAY_JSON=() # Array of files to check FILE_ARRAY_JSX=() # Array of files to check FILE_ARRAY_KOTLIN=() # Array of files to check -FILE_ARRAY_MD=() # Array of files to check +FILE_ARRAY_MARKDOWN=() # Array of files to check FILE_ARRAY_OPENAPI=() # Array of files to check FILE_ARRAY_PERL=() # Array of files to check FILE_ARRAY_PHP=() # Array of files to check @@ -1012,7 +1012,7 @@ GetValidationInfo # Get YML rules GetLinterRules "YAML" # Get Markdown rules -GetLinterRules "MD" +GetLinterRules "MARKDOWN" # Get Python rules GetLinterRules "PYTHON" # Get Ruby rules @@ -1117,12 +1117,12 @@ fi #################### # MARKDOWN LINTING # #################### -if [ "$VALIDATE_MD" == "true" ]; then +if [ "$VALIDATE_MARKDOWN" == "true" ]; then ########################### # Lint the Markdown Files # ########################### # LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY" - LintCodebase "MARKDOWN" "markdownlint" "markdownlint -c $MD_LINTER_RULES" ".*\.\(md\)\$" "${FILE_ARRAY_MD[@]}" + LintCodebase "MARKDOWN" "markdownlint" "markdownlint -c $MARKDOWN_LINTER_RULES" ".*\.\(md\)\$" "${FILE_ARRAY_MARKDOWN[@]}" fi ################ @@ -1150,7 +1150,7 @@ fi ############### # CFN LINTING # ############### -if [ "$VALIDATE_CLOUDFORMATION" == "true" ]; then +if [ "$VALIDATE_CFN" == "true" ]; then ################################# # Lint the CloudFormation files # ################################# diff --git a/lib/validation.sh b/lib/validation.sh index 3750d28f..526a6e2c 100755 --- a/lib/validation.sh +++ b/lib/validation.sh @@ -63,7 +63,7 @@ function GetValidationInfo() { VALIDATE_JSON=$(echo "$VALIDATE_JSON" | awk '{print tolower($0)}') VALIDATE_JSX=$(echo "$VALIDATE_JSX" | awk '{print tolower($0)}') VALIDATE_KOTLIN=$(echo "$VALIDATE_KOTLIN" | awk '{print tolower($0)}') - VALIDATE_MD=$(echo "$VALIDATE_MD" | awk '{print tolower($0)}') + VALIDATE_MARKDOWN=$(echo "$VALIDATE_MARKDOWN" | awk '{print tolower($0)}') VALIDATE_OPENAPI=$(echo "$VALIDATE_OPENAPI" | awk '{print tolower($0)}') VALIDATE_PERL=$(echo "$VALIDATE_PERL" | awk '{print tolower($0)}') VALIDATE_PHP=$(echo "$VALIDATE_PHP" | awk '{print tolower($0)}') @@ -86,7 +86,7 @@ function GetValidationInfo() { if [[ -n $VALIDATE_YAML || -n \ $VALIDATE_JSON || -n \ $VALIDATE_XML || -n \ - $VALIDATE_MD || -n \ + $VALIDATE_MARKDOWN || -n \ $VALIDATE_BASH || -n \ $VALIDATE_PERL || -n \ $VALIDATE_RAKU || -n \ @@ -163,13 +163,13 @@ function GetValidationInfo() { ######################################## if [[ $ANY_SET == "true" ]]; then # Some linter flags were set - only run those set to true - if [[ -z $VALIDATE_MD ]]; then + if [[ -z $VALIDATE_MARKDOWN ]]; then # MD flag was not set - default to false - VALIDATE_MD="false" + VALIDATE_MARKDOWN="false" fi else # No linter flags were set - default all to true - VALIDATE_MD="true" + VALIDATE_MARKDOWN="true" fi #################################### @@ -585,7 +585,7 @@ function GetValidationInfo() { else PRINT_ARRAY+=("- Excluding [XML] files in code base...") fi - if [[ $VALIDATE_MD == "true" ]]; then + if [[ $VALIDATE_MARKDOWN == "true" ]]; then PRINT_ARRAY+=("- Validating [MARKDOWN] files in code base...") else PRINT_ARRAY+=("- Excluding [MARKDOWN] files in code base...") diff --git a/lib/worker.sh b/lib/worker.sh index 41a18054..3a8e37c1 100755 --- a/lib/worker.sh +++ b/lib/worker.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +MARKDOWN_#!/usr/bin/env bash ################################################################################ ################################################################################ @@ -569,7 +569,7 @@ function RunTestCases() { TestCodebase "JAVASCRIPT_STANDARD" "standard" "standard $JAVASCRIPT_STANDARD_LINTER_RULES" ".*\.\(js\)\$" "javascript" TestCodebase "JSON" "jsonlint" "jsonlint" ".*\.\(json\)\$" "json" TestCodebase "KOTLIN" "ktlint" "ktlint" ".*\.\(kt\|kts\)\$" "kotlin" - TestCodebase "MARKDOWN" "markdownlint" "markdownlint -c $MD_LINTER_RULES" ".*\.\(md\)\$" "markdown" + TestCodebase "MARKDOWN" "markdownlint" "markdownlint -c $MARKDOWN_LINTER_RULES" ".*\.\(md\)\$" "markdown" TestCodebase "PERL" "perl" "perl -Mstrict -cw" ".*\.\(pl\)\$" "perl" TestCodebase "PHP" "php" "php -l" ".*\.\(php\)\$" "php" TestCodebase "OPENAPI" "spectral" "spectral lint -r $OPENAPI_LINTER_RULES" ".*\.\(ymlopenapi\|jsonopenapi\)\$" "openapi" From 4f1493c9dd78020503d4fd7013b9dd5607e1ac4b Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 21 Jul 2020 09:10:20 -0500 Subject: [PATCH 11/19] fixing errors --- lib/linter.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index 6e57750b..f5e1be81 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -141,7 +141,7 @@ VALIDATE_JAVASCRIPT_STANDARD="${VALIDATE_JAVASCRIPT_STANDARD}" # Boolean to vali VALIDATE_JSON="${VALIDATE_JSON}" # Boolean to validate language VALIDATE_JSX="${VALIDATE_JSX}" # Boolean to validate language VALIDATE_KOTLIN="${VALIDATE_KOTLIN}" # Boolean to validate language -VALIDATE_MARKDOWN="${VALIDATE_MD}" # Boolean to validate language +VALIDATE_MARKDOWN="${VALIDATE_MD}" # shellcheck disable=SC2153 VALIDATE_OPENAPI="${VALIDATE_OPENAPI}" # Boolean to validate language VALIDATE_PERL="${VALIDATE_PERL}" # Boolean to validate language VALIDATE_PHP="${VALIDATE_PHP}" # Boolean to validate language @@ -874,7 +874,8 @@ Footer() { #################################################### # Need to clean up the lanuage array of duplicates # #################################################### - UNIQUE_LINTED_ARRAY=($(echo "${LINTED_LANGUAGES_ARRAY[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')) + mapfile -t UNIQUE_LINTED_ARRAY < <(echo "${LINTED_LANGUAGES_ARRAY[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ') + # UNIQUE_LINTED_ARRAY=($(echo "${LINTED_LANGUAGES_ARRAY[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')) ############################## # Prints for errors if found # @@ -904,7 +905,7 @@ Footer() { ###################################### # Check if we validated the langauge # ###################################### - if [[ "${UNIQUE_LINTED_ARRAY[@]}" =~ "${LANGUAGE}" ]]; then + if [[ "${UNIQUE_LINTED_ARRAY[*]}" =~ ${LANGUAGE} ]]; then CallStatusAPI "$LANGUAGE" "success" fi fi From eaad677b542552e47ff3b5f318cd784035391813 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 21 Jul 2020 09:14:23 -0500 Subject: [PATCH 12/19] more bugs --- lib/linter.sh | 3 ++- lib/worker.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index f5e1be81..c242aad8 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -141,7 +141,8 @@ VALIDATE_JAVASCRIPT_STANDARD="${VALIDATE_JAVASCRIPT_STANDARD}" # Boolean to vali VALIDATE_JSON="${VALIDATE_JSON}" # Boolean to validate language VALIDATE_JSX="${VALIDATE_JSX}" # Boolean to validate language VALIDATE_KOTLIN="${VALIDATE_KOTLIN}" # Boolean to validate language -VALIDATE_MARKDOWN="${VALIDATE_MD}" # shellcheck disable=SC2153 +# shellcheck disable=SC2153 +VALIDATE_MARKDOWN="${VALIDATE_MD}" # Boolean to validate language VALIDATE_OPENAPI="${VALIDATE_OPENAPI}" # Boolean to validate language VALIDATE_PERL="${VALIDATE_PERL}" # Boolean to validate language VALIDATE_PHP="${VALIDATE_PHP}" # Boolean to validate language diff --git a/lib/worker.sh b/lib/worker.sh index 3a8e37c1..17db091c 100755 --- a/lib/worker.sh +++ b/lib/worker.sh @@ -1,4 +1,4 @@ -MARKDOWN_#!/usr/bin/env bash +#!/usr/bin/env bash ################################################################################ ################################################################################ From 4d079ba298749a893f838c5ebfe5bacb1d9fc4a6 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 21 Jul 2020 09:22:42 -0500 Subject: [PATCH 13/19] remove comment --- lib/linter.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/linter.sh b/lib/linter.sh index c242aad8..287ad6db 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -876,7 +876,6 @@ Footer() { # Need to clean up the lanuage array of duplicates # #################################################### mapfile -t UNIQUE_LINTED_ARRAY < <(echo "${LINTED_LANGUAGES_ARRAY[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ') - # UNIQUE_LINTED_ARRAY=($(echo "${LINTED_LANGUAGES_ARRAY[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')) ############################## # Prints for errors if found # From 7fd749237c37e84aabb12eb79880e39192207171 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 21 Jul 2020 09:53:31 -0500 Subject: [PATCH 14/19] adding it --- .github/workflows/automerge-dependabot.yml | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/automerge-dependabot.yml diff --git a/.github/workflows/automerge-dependabot.yml b/.github/workflows/automerge-dependabot.yml new file mode 100644 index 00000000..1e212ebf --- /dev/null +++ b/.github/workflows/automerge-dependabot.yml @@ -0,0 +1,47 @@ +--- +####################################### +####################################### +## Dependabot automerge dependencies ## +####################################### +####################################### + +# +# Documentation: +# https://medium.com/@toufik.airane/automerge-github-dependabot-alerts-with-github-actions-7cd6f5763750 +# + +###################### +# name of the action # +###################### +name: automerge on pull request + +############### +# When to run # +############### +on: [pull_request] + +################# +# Start the job # +################# +jobs: + automerge: + name: automerge dependabot + runs-on: ubuntu-latest + if: github.actor == 'dependabot[bot]' + steps: + - name: merge + uses: actions/github-script@0.2.0 + with: + script: | + github.pullRequests.createReview({ + owner: context.payload.repository.owner.login, + repo: context.payload.repository.name, + pull_number: context.payload.pull_request.number, + event: 'APPROVE' + }) + github.pullRequests.merge({ + owner: context.payload.repository.owner.login, + repo: context.payload.repository.name, + pull_number: context.payload.pull_request.number + }) + github-token: ${{github.token}} From 7cb1ab7b8e364b5f1de6c1ba48bd8d211c60fb9c Mon Sep 17 00:00:00 2001 From: Gabo Date: Tue, 21 Jul 2020 10:01:16 -0500 Subject: [PATCH 15/19] Fix wrong config --- .github/dependabot.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 60bbe20b..05015ebd 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -21,8 +21,7 @@ updates: directory: "/dependencies" schedule: interval: "daily" - labels: - - "Type: Maintenance" + open-pull-requests-limit: 10 # Maintain dependencies for docker - package-ecosystem: "docker" @@ -37,3 +36,4 @@ updates: schedule: interval: "daily" open-pull-requests-limit: 10 + From 6022bd2ee65953a6512136f08b20b94d12d107bb Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 21 Jul 2020 10:13:15 -0500 Subject: [PATCH 16/19] Adding logic to skip status without proper data --- lib/linter.sh | 53 ++++++++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index 287ad6db..e2ec4321 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -826,32 +826,37 @@ CallStatusAPI() { MESSAGE="$FAIL_MSG" fi - ############################################## - # Call the status API to create status check # - ############################################## - SEND_STATUS_CMD=$(curl -f -s -X POST \ - --url "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/statuses/$GITHUB_SHA" \ - -H 'accept: application/vnd.github.v3+json' \ - -H "authorization: Bearer $GITHUB_TOKEN" \ - -H 'content-type: application/json' \ - -d "{ \"state\": \"$STATUS\", - \"target_url\": \"https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\", - \"description\": \"$MESSAGE\", \"context\": \"--> Linted: $LANGUAGE\" - }" 2>&1) + ########################################################## + # Check to see if were enabled for multi Status mesaages # + ########################################################## + if [ $MULTI_STATUS == "true" ]; then + ############################################## + # Call the status API to create status check # + ############################################## + SEND_STATUS_CMD=$(curl -f -s -X POST \ + --url "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/statuses/$GITHUB_SHA" \ + -H 'accept: application/vnd.github.v3+json' \ + -H "authorization: Bearer $GITHUB_TOKEN" \ + -H 'content-type: application/json' \ + -d "{ \"state\": \"$STATUS\", + \"target_url\": \"https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\", + \"description\": \"$MESSAGE\", \"context\": \"--> Linted: $LANGUAGE\" + }" 2>&1) - ####################### - # Load the error code # - ####################### - ERROR_CODE=$? + ####################### + # Load the error code # + ####################### + ERROR_CODE=$? - ############################## - # Check the shell for errors # - ############################## - if [ "$ERROR_CODE" -ne 0 ]; then - # ERROR - echo "ERROR! Failed to call GitHub Status API!" - echo "ERROR:[$SEND_STATUS_CMD]" - # Not going to fail the script on this yet... + ############################## + # Check the shell for errors # + ############################## + if [ "$ERROR_CODE" -ne 0 ]; then + # ERROR + echo "ERROR! Failed to call GitHub Status API!" + echo "ERROR:[$SEND_STATUS_CMD]" + # Not going to fail the script on this yet... + fi fi } ################################################################################ From 8510e56817c31d8223d0f3038c3099346aa94226 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 21 Jul 2020 10:21:08 -0500 Subject: [PATCH 17/19] fixed it --- lib/linter.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/linter.sh b/lib/linter.sh index e2ec4321..e76e5943 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -726,6 +726,11 @@ GetGitHubVars() { echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Failed to get [GITHUB_TOKEN]!${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR:${NC}[$GITHUB_TOKEN]${NC}" echo -e "${NC}${B[R]}${F[W]}ERROR!${NC} Please set a [GITHUB_TOKEN] from the main workflow environment to take advantage of multiple status reports!${NC}" + + ################################################################################ + # Need to set MULTI_STATUS to false as we cant hit API endpoints without token # + ################################################################################ + MULTI_STATUS='false' else echo -e "${NC}${F[B]}Successfully found:${F[W]}[GITHUB_TOKEN]${NC}" fi From d7c8d9be359e3c17621e53492f047230af22214f Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 21 Jul 2020 10:24:16 -0500 Subject: [PATCH 18/19] quotes --- lib/linter.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linter.sh b/lib/linter.sh index e76e5943..b9764a5f 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -834,7 +834,7 @@ CallStatusAPI() { ########################################################## # Check to see if were enabled for multi Status mesaages # ########################################################## - if [ $MULTI_STATUS == "true" ]; then + if [ "$MULTI_STATUS" == "true" ]; then ############################################## # Call the status API to create status check # ############################################## From 3a35e86775e7572696e3c84668366041cf4fa9a6 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Tue, 21 Jul 2020 11:09:05 -0500 Subject: [PATCH 19/19] super clean --- lib/linter.sh | 9 +++--- lib/validation.sh | 70 +++++++++++++++++++++++------------------------ 2 files changed, 39 insertions(+), 40 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index b9764a5f..030bb170 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -141,8 +141,7 @@ VALIDATE_JAVASCRIPT_STANDARD="${VALIDATE_JAVASCRIPT_STANDARD}" # Boolean to vali VALIDATE_JSON="${VALIDATE_JSON}" # Boolean to validate language VALIDATE_JSX="${VALIDATE_JSX}" # Boolean to validate language VALIDATE_KOTLIN="${VALIDATE_KOTLIN}" # Boolean to validate language -# shellcheck disable=SC2153 -VALIDATE_MARKDOWN="${VALIDATE_MD}" # Boolean to validate language +VALIDATE_MARKDOWN="${VALIDATE_MD:-}" # Boolean to validate language VALIDATE_OPENAPI="${VALIDATE_OPENAPI}" # Boolean to validate language VALIDATE_PERL="${VALIDATE_PERL}" # Boolean to validate language VALIDATE_PHP="${VALIDATE_PHP}" # Boolean to validate language @@ -598,7 +597,7 @@ GetGitHubVars() { ############################### # Convert string to lowercase # ############################### - TEST_CASE_RUN=$(echo "$TEST_CASE_RUN" | awk '{print tolower($0)}') + TEST_CASE_RUN="${TEST_CASE_RUN,,}" ########################## # Get the run local flag # @@ -613,7 +612,7 @@ GetGitHubVars() { ############################### # Convert string to lowercase # ############################### - RUN_LOCAL=$(echo "$RUN_LOCAL" | awk '{print tolower($0)}') + RUN_LOCAL="${RUN_LOCAL,,}" ################################# # Check if were running locally # @@ -738,7 +737,7 @@ GetGitHubVars() { ############################### # Convert string to lowercase # ############################### - MULTI_STATUS=$(echo "$MULTI_STATUS" | awk '{print tolower($0)}') + MULTI_STATUS="${MULTI_STATUS,,}" ####################################################################### # Check to see if the multi status is set, and we have a token to use # diff --git a/lib/validation.sh b/lib/validation.sh index 526a6e2c..9be40a60 100755 --- a/lib/validation.sh +++ b/lib/validation.sh @@ -24,7 +24,7 @@ function GetValidationInfo() { ############################### # Convert string to lowercase # ############################### - VALIDATE_ALL_CODEBASE=$(echo "$VALIDATE_ALL_CODEBASE" | awk '{print tolower($0)}') + VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE,,}" ###################################### # Validate we should check all files # ###################################### @@ -46,38 +46,38 @@ function GetValidationInfo() { ################################ # Convert strings to lowercase # ################################ - VALIDATE_ANSIBLE=$(echo "$VALIDATE_ANSIBLE" | awk '{print tolower($0)}') - VALIDATE_ARM=$(echo "$VALIDATE_ARM" | awk '{print tolower($0)}') - VALIDATE_BASH=$(echo "$VALIDATE_BASH" | awk '{print tolower($0)}') - VALIDATE_CLOJURE=$(echo "$VALIDATE_CLOJURE" | awk '{print tolower($0)}') - VALIDATE_COFFEE=$(echo "$VALIDATE_COFFEE" | awk '{print tolower($0)}') - VALIDATE_CSS=$(echo "$VALIDATE_CSS" | awk '{print tolower($0)}') - VALIDATE_DART=$(echo "$VALIDATE_DART" | awk '{print tolower($0)}') - VALIDATE_DOCKER=$(echo "$VALIDATE_DOCKER" | awk '{print tolower($0)}') - VALIDATE_EDITORCONFIG=$(echo "$VALIDATE_EDITORCONFIG" | awk '{print tolower($0)}') - VALIDATE_ENV=$(echo "$VALIDATE_ENV" | awk '{print tolower($0)}') - VALIDATE_GO=$(echo "$VALIDATE_GO" | awk '{print tolower($0)}') - VALIDATE_HTML=$(echo "$VALIDATE_HTML" | awk '{print tolower($0)}') - VALIDATE_JAVASCRIPT_ES=$(echo "$VALIDATE_JAVASCRIPT_ES" | awk '{print tolower($0)}') - VALIDATE_JAVASCRIPT_STANDARD=$(echo "$VALIDATE_JAVASCRIPT_STANDARD" | awk '{print tolower($0)}') - VALIDATE_JSON=$(echo "$VALIDATE_JSON" | awk '{print tolower($0)}') - VALIDATE_JSX=$(echo "$VALIDATE_JSX" | awk '{print tolower($0)}') - VALIDATE_KOTLIN=$(echo "$VALIDATE_KOTLIN" | awk '{print tolower($0)}') - VALIDATE_MARKDOWN=$(echo "$VALIDATE_MARKDOWN" | awk '{print tolower($0)}') - VALIDATE_OPENAPI=$(echo "$VALIDATE_OPENAPI" | awk '{print tolower($0)}') - VALIDATE_PERL=$(echo "$VALIDATE_PERL" | awk '{print tolower($0)}') - VALIDATE_PHP=$(echo "$VALIDATE_PHP" | awk '{print tolower($0)}') - VALIDATE_POWERSHELL=$(echo "$VALIDATE_POWERSHELL" | awk '{print tolower($0)}') - VALIDATE_PROTOBUF=$(echo "$VALIDATE_PROTOBUF" | awk '{print tolower($0)}') - VALIDATE_PYTHON=$(echo "$VALIDATE_PYTHON" | awk '{print tolower($0)}') - VALIDATE_RAKU=$(echo "$VALIDATE_RAKU" | awk '{print tolower($0)}') - VALIDATE_RUBY=$(echo "$VALIDATE_RUBY" | awk '{print tolower($0)}') - VALIDATE_TERRAFORM=$(echo "$VALIDATE_TERRAFORM" | awk '{print tolower($0)}') - VALIDATE_TSX=$(echo "$VALIDATE_TSX" | awk '{print tolower($0)}') - VALIDATE_TYPESCRIPT_ES=$(echo "$VALIDATE_TYPESCRIPT_ES" | awk '{print tolower($0)}') - VALIDATE_TYPESCRIPT_STANDARD=$(echo "$VALIDATE_TYPESCRIPT_STANDARD" | awk '{print tolower($0)}') - VALIDATE_YAML=$(echo "$VALIDATE_YAML" | awk '{print tolower($0)}') - VALIDATE_XML=$(echo "$VALIDATE_XML" | awk '{print tolower($0)}') + VALIDATE_ANSIBLE="${VALIDATE_ANSIBLE,,}" + VALIDATE_ARM="${VALIDATE_ARM,,}" + VALIDATE_BASH="${VALIDATE_BASH,,}" + VALIDATE_CLOJURE="${VALIDATE_CLOJURE,,}" + VALIDATE_COFFEE="${VALIDATE_COFFEE,,}" + VALIDATE_CSS="${VALIDATE_CSS,,}" + VALIDATE_DART="${VALIDATE_DART,,}" + VALIDATE_DOCKER="${VALIDATE_DOCKER,,}" + VALIDATE_EDITORCONFIG="${VALIDATE_EDITORCONFIG,,}" + VALIDATE_ENV="${VALIDATE_ENV,,}" + VALIDATE_GO="${VALIDATE_GO,,}" + VALIDATE_HTML="${VALIDATE_HTML,,}" + VALIDATE_JAVASCRIPT_ES="${VALIDATE_JAVASCRIPT_ES,,}" + VALIDATE_JAVASCRIPT_STANDARD="${VALIDATE_JAVASCRIPT_STANDARD,,}" + VALIDATE_JSON="${VALIDATE_JSON,,}" + VALIDATE_JSX="${VALIDATE_JSX,,}" + VALIDATE_KOTLIN="${VALIDATE_KOTLIN,,}" + VALIDATE_MARKDOWN="${VALIDATE_MARKDOWN,,}" + VALIDATE_OPENAPI="${VALIDATE_OPENAPI,,}" + VALIDATE_PERL="${VALIDATE_PERL,,}" + VALIDATE_PHP="${VALIDATE_PHP,,}" + VALIDATE_POWERSHELL="${VALIDATE_POWERSHELL,,}" + VALIDATE_PROTOBUF="${VALIDATE_PROTOBUF,,}" + VALIDATE_PYTHON="${VALIDATE_PYTHON,,}" + VALIDATE_RAKU="${VALIDATE_RAKU,,}" + VALIDATE_RUBY="${VALIDATE_RUBY,,}" + VALIDATE_TERRAFORM="${VALIDATE_TERRAFORM,,}" + VALIDATE_TSX="${VALIDATE_TSX,,}" + VALIDATE_TYPESCRIPT_ES="${VALIDATE_TYPESCRIPT_ES,,}" + VALIDATE_TYPESCRIPT_STANDARD="${VALIDATE_TYPESCRIPT_STANDARD,,}" + VALIDATE_YAML="${VALIDATE_YAML,,}" + VALIDATE_XML="${VALIDATE_XML,,}" ################################################ # Determine if any linters were explicitly set # @@ -752,7 +752,7 @@ function GetValidationInfo() { ############################### # Convert string to lowercase # ############################### - DISABLE_ERRORS=$(echo "$DISABLE_ERRORS" | awk '{print tolower($0)}') + DISABLE_ERRORS="${DISABLE_ERRORS,,}" ############################ # Set to false if not true # @@ -774,7 +774,7 @@ function GetValidationInfo() { ############################### # Convert string to lowercase # ############################### - ACTIONS_RUNNER_DEBUG=$(echo "$ACTIONS_RUNNER_DEBUG" | awk '{print tolower($0)}') + ACTIONS_RUNNER_DEBUG="${ACTIONS_RUNNER_DEBUG,,}" ############################ # Set to true if not false #