mirror of
https://github.com/super-linter/super-linter.git
synced 2024-12-22 20:52:12 -05:00
Added case for special types like open api
This commit is contained in:
parent
ca69d68311
commit
b15fa8c738
1 changed files with 63 additions and 3 deletions
|
@ -1188,11 +1188,31 @@ fi
|
||||||
# CFN LINTING #
|
# CFN LINTING #
|
||||||
###############
|
###############
|
||||||
if [ "${VALIDATE_CFN}" == "true" ]; then
|
if [ "${VALIDATE_CFN}" == "true" ]; then
|
||||||
|
# If we are validating all codebase we need to build file list because not every yml/json file is an CFN file
|
||||||
|
if [ "${VALIDATE_ALL_CODEBASE}" == "true" ]; then
|
||||||
|
###############################################################################
|
||||||
|
# Set the file seperator to newline to allow for grabbing objects with spaces #
|
||||||
|
###############################################################################
|
||||||
|
IFS=$'\n'
|
||||||
|
|
||||||
|
mapfile -t LIST_FILES < <(find "${GITHUB_WORKSPACE}" -type f -regex ".*\.\(yml\|yaml\|json\)\$" 2>&1)
|
||||||
|
for FILE in "${LIST_FILES[@]}"; do
|
||||||
|
if DetectCloudFormationFile "${FILE}"; then
|
||||||
|
FILE_ARRAY_CFN+=("${FILE}")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
###########################
|
||||||
|
# Set IFS back to default #
|
||||||
|
###########################
|
||||||
|
IFS="${DEFAULT_IFS}"
|
||||||
|
fi
|
||||||
|
|
||||||
#################################
|
#################################
|
||||||
# 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 "CFN" "cfn-lint" "cfn-lint --config-file ${CFN_LINTER_RULES}" "disabledfileext" "${FILE_ARRAY_CFN[@]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
################
|
################
|
||||||
|
@ -1475,11 +1495,31 @@ fi
|
||||||
# ARM Template LINTING #
|
# ARM Template LINTING #
|
||||||
########################
|
########################
|
||||||
if [ "${VALIDATE_ARM}" == "true" ]; then
|
if [ "${VALIDATE_ARM}" == "true" ]; then
|
||||||
|
# If we are validating all codebase we need to build file list because not every json file is an ARM file
|
||||||
|
if [ "${VALIDATE_ALL_CODEBASE}" == "true" ]; then
|
||||||
|
###############################################################################
|
||||||
|
# Set the file seperator to newline to allow for grabbing objects with spaces #
|
||||||
|
###############################################################################
|
||||||
|
IFS=$'\n'
|
||||||
|
|
||||||
|
mapfile -t LIST_FILES < <(find "${GITHUB_WORKSPACE}" -type f -regex ".*\.\(json\)\$" 2>&1)
|
||||||
|
for FILE in "${LIST_FILES[@]}"; do
|
||||||
|
if DetectARMFile "${FILE}"; then
|
||||||
|
FILE_ARRAY_ARM+=("${FILE}")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
###########################
|
||||||
|
# Set IFS back to default #
|
||||||
|
###########################
|
||||||
|
IFS="${DEFAULT_IFS}"
|
||||||
|
fi
|
||||||
|
|
||||||
###############################
|
###############################
|
||||||
# Lint the ARM Template files #
|
# Lint the ARM Template 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 "ARM" "arm-ttk" "Import-Module ${ARM_TTK_PSD1} ; \${config} = \$(Import-PowerShellDataFile -Path ${ARM_LINTER_RULES}) ; Test-AzTemplate @config -TemplatePath" ".*\.\(json\)\$" "${FILE_ARRAY_ARM[@]}"
|
LintCodebase "ARM" "arm-ttk" "Import-Module ${ARM_TTK_PSD1} ; \${config} = \$(Import-PowerShellDataFile -Path ${ARM_LINTER_RULES}) ; Test-AzTemplate @config -TemplatePath" "disabledfileext" "${FILE_ARRAY_ARM[@]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###################
|
###################
|
||||||
|
@ -1531,10 +1571,30 @@ fi
|
||||||
# AWS STATES LINTING #
|
# AWS STATES LINTING #
|
||||||
######################
|
######################
|
||||||
if [ "${VALIDATE_STATES}" == "true" ]; then
|
if [ "${VALIDATE_STATES}" == "true" ]; then
|
||||||
|
# If we are validating all codebase we need to build file list because not every json file is an aws states file
|
||||||
|
if [ "${VALIDATE_ALL_CODEBASE}" == "true" ]; then
|
||||||
|
###############################################################################
|
||||||
|
# Set the file seperator to newline to allow for grabbing objects with spaces #
|
||||||
|
###############################################################################
|
||||||
|
IFS=$'\n'
|
||||||
|
|
||||||
|
mapfile -t LIST_FILES < <(find "${GITHUB_WORKSPACE}" -type f -regex ".*\.\(json\)\$" 2>&1)
|
||||||
|
for FILE in "${LIST_FILES[@]}"; do
|
||||||
|
if DetectAWSStatesFIle "${FILE}"; then
|
||||||
|
FILE_ARRAY_STATES+=("${FILE}")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
###########################
|
||||||
|
# Set IFS back to default #
|
||||||
|
###########################
|
||||||
|
IFS="${DEFAULT_IFS}"
|
||||||
|
fi
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
# Lint the STATES files #
|
# Lint the STATES files #
|
||||||
#########################
|
#########################
|
||||||
LintCodebase "STATES" "asl-validator" "asl-validator --json-path" ".*\.\(json\)\$" "${FILE_ARRAY_STATES[@]}"
|
LintCodebase "STATES" "asl-validator" "asl-validator --json-path" "disabledfileext" "${FILE_ARRAY_STATES[@]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##########
|
##########
|
||||||
|
|
Loading…
Reference in a new issue