mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-22 00:31:07 -05:00
found the missing link
This commit is contained in:
parent
ca69d68311
commit
9cb4c33715
17 changed files with 110 additions and 88 deletions
|
@ -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
|
|
@ -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
|
|
@ -209,6 +209,7 @@ ENV ACTIONS_RUNNER_DEBUG=${ACTIONS_RUNNER_DEBUG} \
|
|||
VALIDATE_ARM=${VALIDATE_ARM} \
|
||||
VALIDATE_BASH=${VALIDATE_BASH} \
|
||||
VALIDATE_CLOJURE=${VALIDATE_CLOJURE} \
|
||||
VALIDATE_CLOUDFORMATION=${VALIDATE_CLOUDFORMATION} \
|
||||
VALIDATE_COFFEE=${VALIDATE_COFFEE} \
|
||||
VALIDATE_CSS=${VALIDATE_CSS} \
|
||||
VALIDATE_DART=${VALIDATE_DART} \
|
||||
|
|
|
@ -18,7 +18,7 @@ For some linters it is also possible to override rules on a case by case level w
|
|||
- [Shell](#shell)
|
||||
- [Ansible](#ansible)
|
||||
- [YAML](#yaml)
|
||||
- [AWS CloudFormation templates](#cfn)
|
||||
- [AWS CloudFormation templates](#aws-cloud-formation)
|
||||
- [Python](#python3)
|
||||
- [JSON](#json)
|
||||
- [Markdown](#markdown)
|
||||
|
|
|
@ -99,9 +99,9 @@ function BuildFileList() {
|
|||
#########
|
||||
#echo "FILE_TYPE:[${FILE_TYPE}]"
|
||||
|
||||
#####################
|
||||
# Get the CFN files #
|
||||
#####################
|
||||
################################
|
||||
# Get the CLOUDFORMATION files #
|
||||
################################
|
||||
if [ "${FILE_TYPE}" == "yml" ] || [ "${FILE_TYPE}" == "yaml" ]; then
|
||||
################################
|
||||
# Append the file to the array #
|
||||
|
@ -119,7 +119,7 @@ function BuildFileList() {
|
|||
################################
|
||||
# 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 #
|
||||
|
@ -159,7 +159,7 @@ function BuildFileList() {
|
|||
################################
|
||||
# Append the file to the array #
|
||||
################################
|
||||
FILE_ARRAY_CFN+=("${FILE}")
|
||||
FILE_ARRAY_CLOUDFORMATION+=("${FILE}")
|
||||
fi
|
||||
############################################
|
||||
# Check if the file is AWS States Language #
|
||||
|
|
|
@ -30,8 +30,8 @@ ANSIBLE_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${ANSIBLE_FILE_NAME}" # Pa
|
|||
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
|
||||
# Cloudformation Vars
|
||||
CFN_FILE_NAME='.cfnlintrc.yml' # Name of the file
|
||||
CFN_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${CFN_FILE_NAME}" # Path to the cloudformation lint rules
|
||||
CLOUDFORMATION_FILE_NAME='.cfnlintrc.yml' # Name of the file
|
||||
CLOUDFORMATION_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${CLOUDFORMATION_FILE_NAME}" # Path to the cloudformation lint rules
|
||||
# Clojure Vars
|
||||
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
|
||||
|
@ -100,7 +100,7 @@ LINTER_ARRAY=('ansible-lint' 'arm-ttk' 'asl-validator' 'cfn-lint' 'clj-kondo'
|
|||
#############################
|
||||
# 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'
|
||||
'JAVASCRIPT_STANDARD' 'JSON' 'JSX' 'KOTLIN' 'MARKDOWN' 'OPENAPI'
|
||||
'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_ARM="${VALIDATE_ARM}" # 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_COFFEE="${VALIDATE_COFFEE}" # 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_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_COFFEESCRIPT=() # 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_ARM=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_CSS=0 # Count of errors found
|
||||
ERRORS_FOUND_COFFEESCRIPT=0 # Count of errors found
|
||||
|
@ -574,9 +574,9 @@ DetectCloudFormationFile() {
|
|||
return 0
|
||||
fi
|
||||
|
||||
##########################################
|
||||
# No identifiers of a CFN template found #
|
||||
##########################################
|
||||
#####################################################
|
||||
# No identifiers of a CLOUDFORMATION template found #
|
||||
#####################################################
|
||||
return 1
|
||||
}
|
||||
################################################################################
|
||||
|
@ -965,7 +965,7 @@ Footer() {
|
|||
elif [ "${ERRORS_FOUND_ANSIBLE}" -ne 0 ] ||
|
||||
[ "${ERRORS_FOUND_ARM}" -ne 0 ] ||
|
||||
[ "${ERRORS_FOUND_BASH}" -ne 0 ] ||
|
||||
[ "${ERRORS_FOUND_CFN}" -ne 0 ] ||
|
||||
[ "${ERRORS_FOUND_CLOUDFORMATION}" -ne 0 ] ||
|
||||
[ "${ERRORS_FOUND_CLOJURE}" -ne 0 ] ||
|
||||
[ "${ERRORS_FOUND_COFFEESCRIPT}" -ne 0 ] ||
|
||||
[ "${ERRORS_FOUND_CSS}" -ne 0 ] ||
|
||||
|
@ -1074,8 +1074,8 @@ GetLinterRules "POWERSHELL"
|
|||
GetLinterRules "ARM"
|
||||
# Get CSS rules
|
||||
GetLinterRules "CSS"
|
||||
# Get CFN rules
|
||||
GetLinterRules "CFN"
|
||||
# Get CLOUDFORMATION rules
|
||||
GetLinterRules "CLOUDFORMATION"
|
||||
# Get DART rules
|
||||
GetLinterRules "DART"
|
||||
# Get HTML rules
|
||||
|
@ -1184,15 +1184,15 @@ if [ "${VALIDATE_PYTHON}" == "true" ]; then
|
|||
LintCodebase "PYTHON" "pylint" "pylint --rcfile ${PYTHON_LINTER_RULES}" ".*\.\(py\)\$" "${FILE_ARRAY_PYTHON[@]}"
|
||||
fi
|
||||
|
||||
###############
|
||||
# CFN LINTING #
|
||||
###############
|
||||
if [ "${VALIDATE_CFN}" == "true" ]; then
|
||||
##########################
|
||||
# CLOUDFORMATION LINTING #
|
||||
##########################
|
||||
if [ "${VALIDATE_CLOUDFORMATION}" == "true" ]; then
|
||||
#################################
|
||||
# Lint the CloudFormation files #
|
||||
#################################
|
||||
# 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
|
||||
|
||||
################
|
||||
|
|
|
@ -50,6 +50,7 @@ function GetValidationInfo() {
|
|||
VALIDATE_ARM="${VALIDATE_ARM,,}"
|
||||
VALIDATE_BASH="${VALIDATE_BASH,,}"
|
||||
VALIDATE_CLOJURE="${VALIDATE_CLOJURE,,}"
|
||||
VALIDATE_CLOUDFORMATION="${VALIDATE_CLOUDFORMATION,,}"
|
||||
VALIDATE_COFFEE="${VALIDATE_COFFEE,,}"
|
||||
VALIDATE_CSS="${VALIDATE_CSS,,}"
|
||||
VALIDATE_DART="${VALIDATE_DART,,}"
|
||||
|
@ -88,6 +89,7 @@ function GetValidationInfo() {
|
|||
${VALIDATE_ARM} || -n \
|
||||
${VALIDATE_BASH} || -n \
|
||||
${VALIDATE_CLOJURE} || -n \
|
||||
${VALIDATE_CLOUDFORMATION} || -n \
|
||||
${VALIDATE_COFFEE} || -n \
|
||||
${VALIDATE_CSS} || -n \
|
||||
${VALIDATE_DART} || -n \
|
||||
|
@ -551,6 +553,20 @@ function GetValidationInfo() {
|
|||
VALIDATE_CLOJURE="true"
|
||||
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 #
|
||||
############################################
|
||||
|
@ -700,6 +716,11 @@ function GetValidationInfo() {
|
|||
else
|
||||
PRINT_ARRAY+=("- Excluding [CLOJURE] files in code base...")
|
||||
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
|
||||
PRINT_ARRAY+=("- Validating [ENV] files in code base...")
|
||||
else
|
||||
|
|
|
@ -557,7 +557,7 @@ function RunTestCases() {
|
|||
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 "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 "COFFEESCRIPT" "coffeelint" "coffeelint -f ${COFFEESCRIPT_LINTER_RULES}" ".*\.\(coffee\)\$" "coffeescript"
|
||||
TestCodebase "CSS" "stylelint" "stylelint --config ${CSS_LINTER_RULES}" ".*\.\(css\)\$" "css"
|
||||
|
|
Loading…
Reference in a new issue