mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-13 20:39:33 -05:00
Implement restructured flag parsing
We implement the new method of determining if the YAML linter should be enabled, which takes into account if any linters have been explicitly enabled. Currently we only implement this for YAML as a testbed.
This commit is contained in:
parent
d439f6aea7
commit
dbfdea2ff3
1 changed files with 32 additions and 12 deletions
|
@ -706,20 +706,40 @@ GetValidationInfo()
|
||||||
######################
|
######################
|
||||||
PRINT_ARRAY=()
|
PRINT_ARRAY=()
|
||||||
|
|
||||||
###############################
|
################################
|
||||||
# Convert string to lowercase #
|
# Convert strings to lowercase #
|
||||||
###############################
|
################################
|
||||||
VALIDATE_YAML=$(echo "$VALIDATE_YAML" | awk '{print tolower($0)}')
|
VALIDATE_YAML=$(echo "$VALIDATE_YAML" | awk '{print tolower($0)}')
|
||||||
######################################
|
|
||||||
# Validate we should check all files #
|
################################################
|
||||||
######################################
|
# Determine if any linters were explicitly set #
|
||||||
if [[ "$VALIDATE_YAML" != "false" ]]; then
|
################################################
|
||||||
# Set to true
|
ANY_SET="false"
|
||||||
VALIDATE_YAML="$DEFAULT_VALIDATE_LANGUAGE"
|
if [[ -n "$VALIDATE_YAML" ]]; then
|
||||||
PRINT_ARRAY+=("- Validating [YML] files in code base...")
|
ANY_SET="true"
|
||||||
|
fi
|
||||||
|
|
||||||
|
####################################
|
||||||
|
# Validate if we should check YAML #
|
||||||
|
####################################
|
||||||
|
if [[ "$ANY_SET" == "true" ]]; then
|
||||||
|
# Some linter flags were set - only run those set to true
|
||||||
|
if [[ -z "$VALIDATE_YAML" ]]; then
|
||||||
|
# YAML flag was not set - default to false
|
||||||
|
VALIDATE_YAML="false"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
# Its false
|
# No linter flags were set - default all to true
|
||||||
PRINT_ARRAY+=("- Excluding [YML] files in code base...")
|
VALIDATE_YAML="true"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# Print which linters we are enabling #
|
||||||
|
#######################################
|
||||||
|
if [[ "$VALIDATE_YAML" == "true" ]]; then
|
||||||
|
PRINT_ARRAY+=("- Validating [YAML] files in code base...")
|
||||||
|
else
|
||||||
|
PRINT_ARRAY+=("- Excluding [YAML] files in code base...")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###############################
|
###############################
|
||||||
|
|
Loading…
Reference in a new issue