found the missing link

This commit is contained in:
Lucas Gravley 2020-07-22 14:07:08 -05:00
parent ca69d68311
commit 9cb4c33715
17 changed files with 110 additions and 88 deletions

View file

@ -1,22 +0,0 @@
TAP version 13
1..8
not ok 1 - cfn_bad_1.json
---
message: E3001 Invalid or unsupported Type AWS Route53 HostedZonee for resource DNS in us-east-1\n/tmp/lint/.automation/test/cfn/cfn_bad_1.json 6 10\n
...
not ok 2 - cfn_bad_2.yaml
---
message: E3001 Invalid or unsupported Type AWS Route53 HostedZonee for resource DNS in us-east-1\n/tmp/lint/.automation/test/cfn/cfn_bad_2.yaml 5 5\n
...
not ok 3 - cfn_bad_3.json
---
message: E3002 Invalid Property Resources/myDNSRecord/Properties/Ttl\n/tmp/lint/.automation/test/cfn/cfn_bad_3.json 11 13\n
...
not ok 4 - cfn_bad_4.yaml
---
message: E3002 Invalid Property Resources/myDNSRecord/Properties/Ttl\n/tmp/lint/.automation/test/cfn/cfn_bad_4.yaml 9 7\n
...
ok 5 - cfn_good_1.json
ok 6 - cfn_good_2.yaml
ok 7 - cfn_good_3.json
ok 8 - cfn_good_4.yaml

View file

@ -0,0 +1,22 @@
TAP version 13
1..8
not ok 1 - cloudformation_bad_1.json
---
message: E3001 Invalid or unsupported Type AWS Route53 HostedZonee for resource DNS in us-east-1\n/tmp/lint/.automation/test/cloudformation/cloudformation_bad_1.json 6 10\n
...
not ok 2 - cloudformation_bad_2.yaml
---
message: E3001 Invalid or unsupported Type AWS Route53 HostedZonee for resource DNS in us-east-1\n/tmp/lint/.automation/test/cloudformation/cloudformation_bad_2.yaml 5 5\n
...
not ok 3 - cloudformation_bad_3.json
---
message: E3002 Invalid Property Resources/myDNSRecord/Properties/Ttl\n/tmp/lint/.automation/test/cloudformation/cloudformation_bad_3.json 11 13\n
...
not ok 4 - cloudformation_bad_4.yaml
---
message: E3002 Invalid Property Resources/myDNSRecord/Properties/Ttl\n/tmp/lint/.automation/test/cloudformation/cloudformation_bad_4.yaml 9 7\n
...
ok 5 - cloudformation_good_1.json
ok 6 - cloudformation_good_2.yaml
ok 7 - cloudformation_good_3.json
ok 8 - cloudformation_good_4.yaml

View file

@ -209,6 +209,7 @@ ENV ACTIONS_RUNNER_DEBUG=${ACTIONS_RUNNER_DEBUG} \
VALIDATE_ARM=${VALIDATE_ARM} \ VALIDATE_ARM=${VALIDATE_ARM} \
VALIDATE_BASH=${VALIDATE_BASH} \ VALIDATE_BASH=${VALIDATE_BASH} \
VALIDATE_CLOJURE=${VALIDATE_CLOJURE} \ VALIDATE_CLOJURE=${VALIDATE_CLOJURE} \
VALIDATE_CLOUDFORMATION=${VALIDATE_CLOUDFORMATION} \
VALIDATE_COFFEE=${VALIDATE_COFFEE} \ VALIDATE_COFFEE=${VALIDATE_COFFEE} \
VALIDATE_CSS=${VALIDATE_CSS} \ VALIDATE_CSS=${VALIDATE_CSS} \
VALIDATE_DART=${VALIDATE_DART} \ VALIDATE_DART=${VALIDATE_DART} \

View file

@ -18,7 +18,7 @@ For some linters it is also possible to override rules on a case by case level w
- [Shell](#shell) - [Shell](#shell)
- [Ansible](#ansible) - [Ansible](#ansible)
- [YAML](#yaml) - [YAML](#yaml)
- [AWS CloudFormation templates](#cfn) - [AWS CloudFormation templates](#aws-cloud-formation)
- [Python](#python3) - [Python](#python3)
- [JSON](#json) - [JSON](#json)
- [Markdown](#markdown) - [Markdown](#markdown)

View file

@ -99,9 +99,9 @@ function BuildFileList() {
######### #########
#echo "FILE_TYPE:[${FILE_TYPE}]" #echo "FILE_TYPE:[${FILE_TYPE}]"
##################### ################################
# Get the CFN files # # Get the CLOUDFORMATION files #
##################### ################################
if [ "${FILE_TYPE}" == "yml" ] || [ "${FILE_TYPE}" == "yaml" ]; then if [ "${FILE_TYPE}" == "yml" ] || [ "${FILE_TYPE}" == "yaml" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
@ -119,7 +119,7 @@ function BuildFileList() {
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_CFN+=("${FILE}") FILE_ARRAY_CLOUDFORMATION+=("${FILE}")
########################################################## ##########################################################
# Set the READ_ONLY_CHANGE_FLAG since this could be exec # # Set the READ_ONLY_CHANGE_FLAG since this could be exec #
@ -159,7 +159,7 @@ function BuildFileList() {
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_CFN+=("${FILE}") FILE_ARRAY_CLOUDFORMATION+=("${FILE}")
fi fi
############################################ ############################################
# Check if the file is AWS States Language # # Check if the file is AWS States Language #

View file

@ -22,71 +22,71 @@ source /action/lib/worker.sh # Source the function script(s)
# GLOBALS # # GLOBALS #
########### ###########
# Default Vars # Default Vars
DEFAULT_RULES_LOCATION='/action/lib/.automation' # Default rules files location DEFAULT_RULES_LOCATION='/action/lib/.automation' # Default rules files location
# Ansible Vars # Ansible Vars
ANSIBLE_FILE_NAME='.ansible-lint.yml' # Name of the file ANSIBLE_FILE_NAME='.ansible-lint.yml' # Name of the file
ANSIBLE_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${ANSIBLE_FILE_NAME}" # Path to the Ansible lint rules ANSIBLE_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${ANSIBLE_FILE_NAME}" # Path to the Ansible lint rules
# Azure Resource Manager Vars # Azure Resource Manager Vars
ARM_FILE_NAME='.arm-ttk.psd1' # Name of the file ARM_FILE_NAME='.arm-ttk.psd1' # Name of the file
ARM_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${ARM_FILE_NAME}" # Path to the ARM lint rules ARM_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${ARM_FILE_NAME}" # Path to the ARM lint rules
# Cloudformation Vars # Cloudformation Vars
CFN_FILE_NAME='.cfnlintrc.yml' # Name of the file CLOUDFORMATION_FILE_NAME='.cfnlintrc.yml' # Name of the file
CFN_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${CFN_FILE_NAME}" # Path to the cloudformation lint rules CLOUDFORMATION_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${CLOUDFORMATION_FILE_NAME}" # Path to the cloudformation lint rules
# Clojure Vars # Clojure Vars
CLOJURE_FILE_NAME='.clj-kondo/config.edn' # Name of the file CLOJURE_FILE_NAME='.clj-kondo/config.edn' # Name of the file
CLOJURE_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${CLOJURE_FILE_NAME}" # Path to the Clojure lint rules CLOJURE_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${CLOJURE_FILE_NAME}" # Path to the Clojure lint rules
# Coffee Vars # Coffee Vars
COFFEE_FILE_NAME='.coffee-lint.json' # Name of the file 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 COFFEESCRIPT_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${COFFEE_FILE_NAME}" # Path to the coffeescript lint rules
# CSS Vars # CSS Vars
CSS_FILE_NAME='.stylelintrc.json' # Name of the file CSS_FILE_NAME='.stylelintrc.json' # Name of the file
CSS_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${CSS_FILE_NAME}" # Path to the CSS lint rules CSS_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${CSS_FILE_NAME}" # Path to the CSS lint rules
# Dart Vars # Dart Vars
DART_FILE_NAME='analysis_options.yaml' # Name of the file DART_FILE_NAME='analysis_options.yaml' # Name of the file
DART_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${DART_FILE_NAME}" # Path to the DART lint rules DART_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${DART_FILE_NAME}" # Path to the DART lint rules
# Docker Vars # Docker Vars
DOCKER_FILE_NAME='.dockerfilelintrc' # Name of the file DOCKER_FILE_NAME='.dockerfilelintrc' # Name of the file
DOCKER_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${DOCKER_FILE_NAME}" # Path to the Docker lint rules DOCKER_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${DOCKER_FILE_NAME}" # Path to the Docker lint rules
# Golang Vars # Golang Vars
GO_FILE_NAME='.golangci.yml' # Name of the file GO_FILE_NAME='.golangci.yml' # Name of the file
GO_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${GO_FILE_NAME}" # Path to the Go lint rules GO_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${GO_FILE_NAME}" # Path to the Go lint rules
# HTML Vars # HTML Vars
HTML_FILE_NAME='.htmlhintrc' # Name of the file HTML_FILE_NAME='.htmlhintrc' # Name of the file
HTML_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${HTML_FILE_NAME}" # Path to the CSS lint rules HTML_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${HTML_FILE_NAME}" # Path to the CSS lint rules
# Javascript Vars # Javascript Vars
JAVASCRIPT_FILE_NAME="${JAVASCRIPT_ES_CONFIG_FILE:-.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_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 JAVASCRIPT_STANDARD_LINTER_RULES='' # ENV string to pass when running js standard
# Default linter path # Default linter path
LINTER_RULES_PATH="${LINTER_RULES_PATH:-.github/linters}" # Linter Path Directory LINTER_RULES_PATH="${LINTER_RULES_PATH:-.github/linters}" # Linter Path Directory
# MD Vars # MD Vars
MARKDOWN_FILE_NAME='.markdown-lint.yml' # Name of the file 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 MARKDOWN_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${MARKDOWN_FILE_NAME}" # Path to the markdown lint rules
# OpenAPI Vars # OpenAPI Vars
OPENAPI_FILE_NAME='.openapirc.yml' # Name of the file OPENAPI_FILE_NAME='.openapirc.yml' # Name of the file
OPENAPI_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${OPENAPI_FILE_NAME}" # Path to the OpenAPI lint rules OPENAPI_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${OPENAPI_FILE_NAME}" # Path to the OpenAPI lint rules
# Powershell Vars # Powershell Vars
POWERSHELL_FILE_NAME='.powershell-psscriptanalyzer.psd1' # Name of the file POWERSHELL_FILE_NAME='.powershell-psscriptanalyzer.psd1' # Name of the file
POWERSHELL_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${POWERSHELL_FILE_NAME}" # Path to the Powershell lint rules POWERSHELL_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${POWERSHELL_FILE_NAME}" # Path to the Powershell lint rules
# Protocol Buffers Vars # Protocol Buffers Vars
PROTOBUF_FILE_NAME='.protolintrc.yml' # Name of the file PROTOBUF_FILE_NAME='.protolintrc.yml' # Name of the file
PROTOBUF_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${PROTOBUF_FILE_NAME}" # Path to the Protocol Buffers lint rules PROTOBUF_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${PROTOBUF_FILE_NAME}" # Path to the Protocol Buffers lint rules
# Python Vars # Python Vars
PYTHON_FILE_NAME='.python-lint' # Name of the file PYTHON_FILE_NAME='.python-lint' # Name of the file
PYTHON_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${PYTHON_FILE_NAME}" # Path to the python lint rules PYTHON_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${PYTHON_FILE_NAME}" # Path to the python lint rules
# Ruby Vars # Ruby Vars
RUBY_FILE_NAME="${RUBY_CONFIG_FILE:-.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 RUBY_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${RUBY_FILE_NAME}" # Path to the ruby lint rules
# Terraform Vars # Terraform Vars
TERRAFORM_FILE_NAME='.tflint.hcl' # Name of the file TERRAFORM_FILE_NAME='.tflint.hcl' # Name of the file
TERRAFORM_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${TERRAFORM_FILE_NAME}" # Path to the Terraform lint rules TERRAFORM_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${TERRAFORM_FILE_NAME}" # Path to the Terraform lint rules
# Typescript Vars # Typescript Vars
TYPESCRIPT_FILE_NAME="${TYPESCRIPT_ES_CONFIG_FILE:-.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_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 TYPESCRIPT_STANDARD_LINTER_RULES='' # ENV string to pass when running js standard
# YAML Vars # YAML Vars
YAML_FILE_NAME='.yaml-lint.yml' # Name of the file 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 YAML_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${YAML_FILE_NAME}" # Path to the yaml lint rules
####################################### #######################################
# Linter array for information prints # # Linter array for information prints #
@ -100,7 +100,7 @@ LINTER_ARRAY=('ansible-lint' 'arm-ttk' 'asl-validator' 'cfn-lint' 'clj-kondo'
############################# #############################
# Language array for prints # # Language array for prints #
############################# #############################
LANGUAGE_ARRAY=('ANSIBLE' 'ARM' 'BASH' 'CFN' 'CLOJURE' 'COFFEESCRIPT' LANGUAGE_ARRAY=('ANSIBLE' 'ARM' 'BASH' 'CLOUDFORMATION' 'CLOJURE' 'COFFEESCRIPT'
'CSS' 'DART' 'DOCKER' 'ENV' 'GO' 'HTML' 'JAVASCRIPT_ES' 'CSS' 'DART' 'DOCKER' 'ENV' 'GO' 'HTML' 'JAVASCRIPT_ES'
'JAVASCRIPT_STANDARD' 'JSON' 'JSX' 'KOTLIN' 'MARKDOWN' 'OPENAPI' 'JAVASCRIPT_STANDARD' 'JSON' 'JSX' 'KOTLIN' 'MARKDOWN' 'OPENAPI'
'PERL' 'PHP' 'POWERSHELL' 'PROTOBUF' 'PYTHON' 'PERL' 'PHP' 'POWERSHELL' 'PROTOBUF' 'PYTHON'
@ -130,7 +130,7 @@ VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE}" # Boolean to vali
VALIDATE_ANSIBLE="${VALIDATE_ANSIBLE}" # Boolean to validate language VALIDATE_ANSIBLE="${VALIDATE_ANSIBLE}" # Boolean to validate language
VALIDATE_ARM="${VALIDATE_ARM}" # Boolean to validate language VALIDATE_ARM="${VALIDATE_ARM}" # Boolean to validate language
VALIDATE_BASH="${VALIDATE_BASH}" # Boolean to validate language VALIDATE_BASH="${VALIDATE_BASH}" # Boolean to validate language
VALIDATE_CFN="${VALIDATE_CLOUDFORMATION}" # Boolean to validate language VALIDATE_CLOUDFORMATION="${VALIDATE_CLOUDFORMATION}" # Boolean to validate language
VALIDATE_CLOJURE="${VALIDATE_CLOJURE}" # Boolean to validate language VALIDATE_CLOJURE="${VALIDATE_CLOJURE}" # Boolean to validate language
VALIDATE_COFFEE="${VALIDATE_COFFEE}" # Boolean to validate language VALIDATE_COFFEE="${VALIDATE_COFFEE}" # Boolean to validate language
VALIDATE_CSS="${VALIDATE_CSS}" # Boolean to validate language VALIDATE_CSS="${VALIDATE_CSS}" # Boolean to validate language
@ -205,7 +205,7 @@ REPORT_OUTPUT_FOLDER="${DEFAULT_WORKSPACE}/${OUTPUT_FOLDER}" # Location for the
########################## ##########################
FILE_ARRAY_ARM=() # Array of files to check FILE_ARRAY_ARM=() # Array of files to check
FILE_ARRAY_BASH=() # Array of files to check FILE_ARRAY_BASH=() # Array of files to check
FILE_ARRAY_CFN=() # Array of files to check FILE_ARRAY_CLOUDFORMATION=() # Array of files to check
FILE_ARRAY_CLOJURE=() # Array of files to check FILE_ARRAY_CLOJURE=() # Array of files to check
FILE_ARRAY_COFFEESCRIPT=() # Array of files to check FILE_ARRAY_COFFEESCRIPT=() # Array of files to check
FILE_ARRAY_CSS=() # Array of files to check FILE_ARRAY_CSS=() # Array of files to check
@ -242,7 +242,7 @@ FILE_ARRAY_YML=() # Array of files to check
ERRORS_FOUND_ANSIBLE=0 # Count of errors found ERRORS_FOUND_ANSIBLE=0 # Count of errors found
ERRORS_FOUND_ARM=0 # Count of errors found ERRORS_FOUND_ARM=0 # Count of errors found
ERRORS_FOUND_BASH=0 # Count of errors found ERRORS_FOUND_BASH=0 # Count of errors found
ERRORS_FOUND_CFN=0 # Count of errors found ERRORS_FOUND_CLOUDFORMATION=0 # Count of errors found
ERRORS_FOUND_CLOJURE=0 # Count of errors found ERRORS_FOUND_CLOJURE=0 # Count of errors found
ERRORS_FOUND_CSS=0 # Count of errors found ERRORS_FOUND_CSS=0 # Count of errors found
ERRORS_FOUND_COFFEESCRIPT=0 # Count of errors found ERRORS_FOUND_COFFEESCRIPT=0 # Count of errors found
@ -574,9 +574,9 @@ DetectCloudFormationFile() {
return 0 return 0
fi fi
########################################## #####################################################
# No identifiers of a CFN template found # # No identifiers of a CLOUDFORMATION template found #
########################################## #####################################################
return 1 return 1
} }
################################################################################ ################################################################################
@ -965,7 +965,7 @@ Footer() {
elif [ "${ERRORS_FOUND_ANSIBLE}" -ne 0 ] || elif [ "${ERRORS_FOUND_ANSIBLE}" -ne 0 ] ||
[ "${ERRORS_FOUND_ARM}" -ne 0 ] || [ "${ERRORS_FOUND_ARM}" -ne 0 ] ||
[ "${ERRORS_FOUND_BASH}" -ne 0 ] || [ "${ERRORS_FOUND_BASH}" -ne 0 ] ||
[ "${ERRORS_FOUND_CFN}" -ne 0 ] || [ "${ERRORS_FOUND_CLOUDFORMATION}" -ne 0 ] ||
[ "${ERRORS_FOUND_CLOJURE}" -ne 0 ] || [ "${ERRORS_FOUND_CLOJURE}" -ne 0 ] ||
[ "${ERRORS_FOUND_COFFEESCRIPT}" -ne 0 ] || [ "${ERRORS_FOUND_COFFEESCRIPT}" -ne 0 ] ||
[ "${ERRORS_FOUND_CSS}" -ne 0 ] || [ "${ERRORS_FOUND_CSS}" -ne 0 ] ||
@ -1074,8 +1074,8 @@ GetLinterRules "POWERSHELL"
GetLinterRules "ARM" GetLinterRules "ARM"
# Get CSS rules # Get CSS rules
GetLinterRules "CSS" GetLinterRules "CSS"
# Get CFN rules # Get CLOUDFORMATION rules
GetLinterRules "CFN" GetLinterRules "CLOUDFORMATION"
# Get DART rules # Get DART rules
GetLinterRules "DART" GetLinterRules "DART"
# Get HTML rules # Get HTML rules
@ -1184,15 +1184,15 @@ if [ "${VALIDATE_PYTHON}" == "true" ]; then
LintCodebase "PYTHON" "pylint" "pylint --rcfile ${PYTHON_LINTER_RULES}" ".*\.\(py\)\$" "${FILE_ARRAY_PYTHON[@]}" LintCodebase "PYTHON" "pylint" "pylint --rcfile ${PYTHON_LINTER_RULES}" ".*\.\(py\)\$" "${FILE_ARRAY_PYTHON[@]}"
fi fi
############### ##########################
# CFN LINTING # # CLOUDFORMATION LINTING #
############### ##########################
if [ "${VALIDATE_CFN}" == "true" ]; then if [ "${VALIDATE_CLOUDFORMATION}" == "true" ]; then
################################# #################################
# Lint the CloudFormation files # # Lint the CloudFormation files #
################################# #################################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY" # LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY"
LintCodebase "CFN" "cfn-lint" "cfn-lint --config-file ${CFN_LINTER_RULES}" ".*\.\(json\|yml\|yaml\)\$" "${FILE_ARRAY_CFN[@]}" LintCodebase "CLOUDFORMATION" "cfn-lint" "cfn-lint --config-file ${CLOUDFORMATION_LINTER_RULES}" ".*\.\(json\|yml\|yaml\)\$" "${FILE_ARRAY_CLOUDFORMATION[@]}"
fi fi
################ ################

View file

@ -50,6 +50,7 @@ function GetValidationInfo() {
VALIDATE_ARM="${VALIDATE_ARM,,}" VALIDATE_ARM="${VALIDATE_ARM,,}"
VALIDATE_BASH="${VALIDATE_BASH,,}" VALIDATE_BASH="${VALIDATE_BASH,,}"
VALIDATE_CLOJURE="${VALIDATE_CLOJURE,,}" VALIDATE_CLOJURE="${VALIDATE_CLOJURE,,}"
VALIDATE_CLOUDFORMATION="${VALIDATE_CLOUDFORMATION,,}"
VALIDATE_COFFEE="${VALIDATE_COFFEE,,}" VALIDATE_COFFEE="${VALIDATE_COFFEE,,}"
VALIDATE_CSS="${VALIDATE_CSS,,}" VALIDATE_CSS="${VALIDATE_CSS,,}"
VALIDATE_DART="${VALIDATE_DART,,}" VALIDATE_DART="${VALIDATE_DART,,}"
@ -88,6 +89,7 @@ function GetValidationInfo() {
${VALIDATE_ARM} || -n \ ${VALIDATE_ARM} || -n \
${VALIDATE_BASH} || -n \ ${VALIDATE_BASH} || -n \
${VALIDATE_CLOJURE} || -n \ ${VALIDATE_CLOJURE} || -n \
${VALIDATE_CLOUDFORMATION} || -n \
${VALIDATE_COFFEE} || -n \ ${VALIDATE_COFFEE} || -n \
${VALIDATE_CSS} || -n \ ${VALIDATE_CSS} || -n \
${VALIDATE_DART} || -n \ ${VALIDATE_DART} || -n \
@ -551,6 +553,20 @@ function GetValidationInfo() {
VALIDATE_CLOJURE="true" VALIDATE_CLOJURE="true"
fi fi
##############################################
# Validate if we should check CloudFormation #
##############################################
if [[ ${ANY_SET} == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z ${VALIDATE_CLOUDFORMATION} ]]; then
# Cloud Formation flag was not set - default to false
VALIDATE_CLOUDFORMATION="false"
fi
else
# No linter flags were set - default all to true
VALIDATE_CLOUDFORMATION="true"
fi
############################################ ############################################
# Validate if we should check editorconfig # # Validate if we should check editorconfig #
############################################ ############################################
@ -700,6 +716,11 @@ function GetValidationInfo() {
else else
PRINT_ARRAY+=("- Excluding [CLOJURE] files in code base...") PRINT_ARRAY+=("- Excluding [CLOJURE] files in code base...")
fi fi
if [[ ${VALIDATE_CLOUDFORMATION} == "true" ]]; then
PRINT_ARRAY+=("- Validating [CLOUDFORMATION] files in code base...")
else
PRINT_ARRAY+=("- Excluding [CLOUDFORMATION] files in code base...")
fi
if [[ ${VALIDATE_ENV} == "true" ]]; then if [[ ${VALIDATE_ENV} == "true" ]]; then
PRINT_ARRAY+=("- Validating [ENV] files in code base...") PRINT_ARRAY+=("- Validating [ENV] files in code base...")
else else

View file

@ -557,7 +557,7 @@ function RunTestCases() {
TestCodebase "ANSIBLE" "ansible-lint" "ansible-lint -v -c ${ANSIBLE_LINTER_RULES}" ".*\.\(yml\|yaml\)\$" "ansible" TestCodebase "ANSIBLE" "ansible-lint" "ansible-lint -v -c ${ANSIBLE_LINTER_RULES}" ".*\.\(yml\|yaml\)\$" "ansible"
TestCodebase "ARM" "arm-ttk" "Import-Module ${ARM_TTK_PSD1} ; \${config} = \$(Import-PowerShellDataFile -Path ${ARM_LINTER_RULES}) ; Test-AzTemplate @config -TemplatePath" ".*\.\(json\)\$" "arm" TestCodebase "ARM" "arm-ttk" "Import-Module ${ARM_TTK_PSD1} ; \${config} = \$(Import-PowerShellDataFile -Path ${ARM_LINTER_RULES}) ; Test-AzTemplate @config -TemplatePath" ".*\.\(json\)\$" "arm"
TestCodebase "BASH" "shellcheck" "shellcheck --color" ".*\.\(sh\|bash\|dash\|ksh\)\$" "shell" TestCodebase "BASH" "shellcheck" "shellcheck --color" ".*\.\(sh\|bash\|dash\|ksh\)\$" "shell"
TestCodebase "CFN" "cfn-lint" "cfn-lint --config-file ${CFN_LINTER_RULES}" ".*\.\(json\|yml\|yaml\)\$" "cfn" TestCodebase "CLOUDFORMATION" "cfn-lint" "cfn-lint --config-file ${CLOUDFORMATION_LINTER_RULES}" ".*\.\(json\|yml\|yaml\)\$" "cloudformation"
TestCodebase "CLOJURE" "clj-kondo" "clj-kondo --config ${CLOJURE_LINTER_RULES} --lint" ".*\.\(clj\|cljs\|cljc\|edn\)\$" "clojure" TestCodebase "CLOJURE" "clj-kondo" "clj-kondo --config ${CLOJURE_LINTER_RULES} --lint" ".*\.\(clj\|cljs\|cljc\|edn\)\$" "clojure"
TestCodebase "COFFEESCRIPT" "coffeelint" "coffeelint -f ${COFFEESCRIPT_LINTER_RULES}" ".*\.\(coffee\)\$" "coffeescript" TestCodebase "COFFEESCRIPT" "coffeelint" "coffeelint -f ${COFFEESCRIPT_LINTER_RULES}" ".*\.\(coffee\)\$" "coffeescript"
TestCodebase "CSS" "stylelint" "stylelint --config ${CSS_LINTER_RULES}" ".*\.\(css\)\$" "css" TestCodebase "CSS" "stylelint" "stylelint --config ${CSS_LINTER_RULES}" ".*\.\(css\)\$" "css"