From f2045eb49664d5801e2357f01a84bb2e7ff5d6ae Mon Sep 17 00:00:00 2001 From: Gabo Date: Fri, 24 Jul 2020 11:20:22 -0500 Subject: [PATCH 1/3] Fix YAML --- lib/buildFileList.sh | 2 +- lib/linter.sh | 14 +++++++------- lib/worker.sh | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/buildFileList.sh b/lib/buildFileList.sh index 00aebf1f..2efc0fb3 100755 --- a/lib/buildFileList.sh +++ b/lib/buildFileList.sh @@ -106,7 +106,7 @@ function BuildFileList() { ################################ # Append the file to the array # ################################ - FILE_ARRAY_YML+=("${FILE}") + FILE_ARRAY_YAML+=("${FILE}") ########################################################## # Set the READ_ONLY_CHANGE_FLAG since this could be exec # ########################################################## diff --git a/lib/linter.sh b/lib/linter.sh index d712ab4b..6b2c8028 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -109,7 +109,7 @@ LANGUAGE_ARRAY=('ANSIBLE' 'ARM' 'BASH' 'CLOUDFORMATION' 'CLOJURE' 'COFFEESCRIPT' 'JAVASCRIPT_STANDARD' 'JSON' 'JSX' 'KOTLIN' 'MARKDOWN' 'OPENAPI' 'PERL' 'PHP' 'POWERSHELL' 'PROTOBUF' 'PYTHON' 'RAKU' 'RUBY' 'STATES' 'TERRAFORM' 'TERRAFORM_TERRASCAN' 'TSX' 'TYPESCRIPT_ES' - 'TYPESCRIPT_STANDARD' 'XML' 'YML') + 'TYPESCRIPT_STANDARD' 'XML' 'YAML') ############################################ # Array for all languages that were linted # @@ -242,7 +242,7 @@ 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_XML=() # Array of files to check -FILE_ARRAY_YML=() # Array of files to check +FILE_ARRAY_YAML=() # Array of files to check ############ # Counters # @@ -315,8 +315,8 @@ ERRORS_FOUND_TYPESCRIPT_ES=0 # Count of errors found export ERRORS_FOUND_TYPESCRIPT_ES # Workaround SC2034 ERRORS_FOUND_XML=0 # Count of errors found export ERRORS_FOUND_XML # Workaround SC2034 -ERRORS_FOUND_YML=0 # Count of errors found -export ERRORS_FOUND_YML # Workaround SC2034 +ERRORS_FOUND_YAML=0 # Count of errors found +export ERRORS_FOUND_YAML # Workaround SC2034 ################################################################################ ########################## FUNCTIONS BELOW ##################################### @@ -1092,7 +1092,7 @@ GetLinterRules "RUBY" GetLinterRules "TERRAFORM" # Get TypeScript rules GetLinterRules "TYPESCRIPT" -# Get YML rules +# Get YAML rules GetLinterRules "YAML" ################################# @@ -1623,14 +1623,14 @@ if [ "${VALIDATE_XML}" == "true" ]; then fi ############### -# YML LINTING # +# YAML LINTING # ############### if [ "${VALIDATE_YAML}" == "true" ]; then ###################### # Lint the Yml Files # ###################### # LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY" - LintCodebase "YML" "yamllint" "yamllint -c ${YAML_LINTER_RULES}" ".*\.\(yml\|yaml\)\$" "${FILE_ARRAY_YML[@]}" + LintCodebase "YAML" "yamllint" "yamllint -c ${YAML_LINTER_RULES}" ".*\.\(yml\|yaml\)\$" "${FILE_ARRAY_YAML[@]}" fi ########### diff --git a/lib/worker.sh b/lib/worker.sh index a7da7f04..70141d10 100755 --- a/lib/worker.sh +++ b/lib/worker.sh @@ -610,7 +610,7 @@ function RunTestCases() { TestCodebase "TYPESCRIPT_ES" "eslint" "eslint --no-eslintrc -c ${TYPESCRIPT_LINTER_RULES}" ".*\.\(ts\)\$" "typescript" TestCodebase "TYPESCRIPT_STANDARD" "standard" "standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin ${TYPESCRIPT_STANDARD_LINTER_RULES}" ".*\.\(ts\)\$" "typescript" TestCodebase "XML" "xmllint" "xmllint" ".*\.\(xml\)\$" "xml" - TestCodebase "YML" "yamllint" "yamllint -c ${YAML_LINTER_RULES}" ".*\.\(yml\|yaml\)\$" "yml" + TestCodebase "YAML" "yamllint" "yamllint -c ${YAML_LINTER_RULES}" ".*\.\(yml\|yaml\)\$" "yml" ################# # Footer prints # From 1c11a23fd36b632c9a82ce0a089e947661961ca3 Mon Sep 17 00:00:00 2001 From: Gabo Date: Fri, 24 Jul 2020 14:03:26 -0500 Subject: [PATCH 2/3] Allo to pass yamllint config file --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e9dd76be..f9c77028 100644 --- a/README.md +++ b/README.md @@ -218,6 +218,8 @@ and won't run anything unexpected. | **VALIDATE_TYPESCRIPT_STANDARD** | `true` | Flag to enable or disable the linting process of the Typescript language. (Utilizing: standard) | | **VALIDATE_XML** | `true` | Flag to enable or disable the linting process of the XML language. | | **VALIDATE_YAML** | `true` | Flag to enable or disable the linting process of the YAML language. | +| **YAML_CONFIG_FILE** | `.yaml-lint.yml` | Filename for [Yamllint configuration](https://yamllint.readthedocs.io/en/stable/configuration.html) (ex: `.yaml-lint.yml`, `.yamllint.yml`) | + ### Template rules files From eafc73332b71f997f8d0569cdb56022f300835c4 Mon Sep 17 00:00:00 2001 From: Gabo Date: Fri, 24 Jul 2020 14:05:03 -0500 Subject: [PATCH 3/3] Allow to pass yamllint config file --- lib/linter.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linter.sh b/lib/linter.sh index 6b2c8028..9e51f010 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -88,7 +88,7 @@ TYPESCRIPT_FILE_NAME="${TYPESCRIPT_ES_CONFIG_FILE:-.eslintrc.yml}" 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 # YAML Vars -YAML_FILE_NAME='.yaml-lint.yml' # Name of the file +YAML_FILE_NAME="${YAML_CONFIG_FILE:-.yaml-lint.yml}" # Name of the file YAML_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${YAML_FILE_NAME}" # Path to the yaml lint rules #######################################