From 8f2c59bfe737a6339bd52d552062be308b04ed93 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Thu, 23 Apr 2020 12:07:35 -0500 Subject: [PATCH 1/4] Cleanup --- lib/linter.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index 1c8f2946..ca902386 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -221,10 +221,8 @@ GetLinterRules() ################ # print header # ################ - echo "" echo "----------------------------------------------" echo "Gathering users linter:[$FILE_NAME] rules from repository, or defaulting..." - echo "" ##################################### # Validate we have the linter rules # @@ -254,7 +252,7 @@ GetLinterRules() ######################################################## # No user default provided, using the template default # ######################################################## - echo "Codebase does NOT have file:[.github/linters/$FILE_NAME], using Default rules at:[$FILE_LOCATION]" + echo " -> Codebase does NOT have file:[.github/linters/$FILE_NAME], using Default rules at:[$FILE_LOCATION]" fi } ################################################################################ @@ -380,8 +378,11 @@ LintAnsibleFiles() exit 1 else # Success - echo "Successfully found binary in system" - echo "Location:[$VALIDATE_INSTALL_CMD]" + if [ $DEBUG -ne 0 ]; then + # Success + echo "Successfully found binary in system" + echo "Location:[$VALIDATE_INSTALL_CMD]" + fi fi ########################## @@ -1634,6 +1635,7 @@ Footer() echo "The script has completed" echo "----------------------------------------------" echo "----------------------------------------------" + echo "" echo "ERRORS FOUND in YAML:[$ERRORS_FOUND_YML]" echo "ERRORS FOUND in JSON:[$ERRORS_FOUND_JSON]" echo "ERRORS FOUND in XML:[$ERRORS_FOUND_XML]" @@ -1651,6 +1653,7 @@ Footer() echo "ERRORS FOUND in DOCKER:[$ERRORS_FOUND_DOCKER]" echo "ERRORS FOUND in GO:[$ERRORS_FOUND_GO]" echo "ERRORS FOUND in TERRAFORM:[$ERRORS_FOUND_TERRAFORM]" + echo "" echo "----------------------------------------------" echo "" From 7170fe9da59dcdef71606e6f2b74fcf534d3e837 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Thu, 23 Apr 2020 12:10:49 -0500 Subject: [PATCH 2/4] fix spacing --- lib/linter.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index ca902386..9a4973ec 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -11,6 +11,7 @@ ########### # Default Vars DEFAULT_RULES_LOCATION='/action/lib/.automation' # Default rules files location +LINTER_PATH='.github/linters' # Default linter path # YAML Vars YAML_FILE_NAME='.yaml-lint.yml' # Name of the file YAML_LINTER_RULES="$DEFAULT_RULES_LOCATION/$YAML_FILE_NAME" # Path to the yaml lint rules @@ -227,13 +228,13 @@ GetLinterRules() ##################################### # Validate we have the linter rules # ##################################### - if [ -f "$GITHUB_WORKSPACE/.github/linters/$FILE_NAME" ]; then + if [ -f "$GITHUB_WORKSPACE/$LINTER_PATH/$FILE_NAME" ]; then echo "User provided file:[$FILE_NAME], setting rules file..." #################################### # Copy users into default location # #################################### - CP_CMD=$(cp "$GITHUB_WORKSPACE/.github/linters/$FILE_NAME" "$FILE_LOCATION" 2>&1) + CP_CMD=$(cp "$GITHUB_WORKSPACE/$LINTER_PATH/$FILE_NAME" "$FILE_LOCATION" 2>&1) ################### # Load Error code # @@ -252,7 +253,7 @@ GetLinterRules() ######################################################## # No user default provided, using the template default # ######################################################## - echo " -> Codebase does NOT have file:[.github/linters/$FILE_NAME], using Default rules at:[$FILE_LOCATION]" + echo " -> Codebase does NOT have file:[$LINTER_PATH/$FILE_NAME], using Default rules at:[$FILE_LOCATION]" fi } ################################################################################ @@ -350,7 +351,6 @@ LintAnsibleFiles() echo "Linting [Ansible] files..." echo "----------------------------------------------" echo "----------------------------------------------" - echo "" ###################### # Name of the linter # @@ -378,7 +378,7 @@ LintAnsibleFiles() exit 1 else # Success - if [ $DEBUG -ne 0 ]; then + if [ "$DEBUG" -ne 0 ]; then # Success echo "Successfully found binary in system" echo "Location:[$VALIDATE_INSTALL_CMD]" From 835fc6d5f45e99a74247545fd2e84d13657140d5 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Thu, 23 Apr 2020 12:11:26 -0500 Subject: [PATCH 3/4] more space --- lib/linter.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/linter.sh b/lib/linter.sh index 9a4973ec..e197ee8c 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -1320,7 +1320,6 @@ LintCodebase() echo "Linting [$FILE_TYPE] files..." echo "----------------------------------------------" echo "----------------------------------------------" - echo "" ####################################### # Validate we have jsonlint installed # From 5bf4295d1e272b72f0b3962b45bdf103a0acb36b Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Thu, 23 Apr 2020 12:14:31 -0500 Subject: [PATCH 4/4] fix debug --- lib/linter.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linter.sh b/lib/linter.sh index e197ee8c..e044b22b 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -378,7 +378,7 @@ LintAnsibleFiles() exit 1 else # Success - if [ "$DEBUG" -ne 0 ]; then + if [[ "$VERBOSE_OUTPUT" != "false" ]]; then # Success echo "Successfully found binary in system" echo "Location:[$VALIDATE_INSTALL_CMD]"