mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-22 16:51:05 -05:00
Add logic to include/exclude linters
This commit is contained in:
parent
cb2cf0eb49
commit
d05f179506
1 changed files with 18 additions and 5 deletions
|
@ -57,6 +57,8 @@ function GetValidationInfo() {
|
||||||
# Determine if any linters were explicitly set #
|
# Determine if any linters were explicitly set #
|
||||||
################################################
|
################################################
|
||||||
ANY_SET="false"
|
ANY_SET="false"
|
||||||
|
ANY_TRUE="false"
|
||||||
|
ANY_FALSE="false"
|
||||||
# Loop through all languages
|
# Loop through all languages
|
||||||
for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
|
for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
|
||||||
# build the variable
|
# build the variable
|
||||||
|
@ -65,12 +67,21 @@ function GetValidationInfo() {
|
||||||
if [ -n "${!VALIDATE_LANGUAGE}" ]; then
|
if [ -n "${!VALIDATE_LANGUAGE}" ]; then
|
||||||
# It was set, need to set flag
|
# It was set, need to set flag
|
||||||
ANY_SET="true"
|
ANY_SET="true"
|
||||||
|
if [ "${!VALIDATE_LANGUAGE}" == "true" ]; then
|
||||||
|
ANY_TRUE="true"
|
||||||
|
elif [ "${!VALIDATE_LANGUAGE}" == "false" ]; then
|
||||||
|
ANY_FALSE="true"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
###################################################
|
if [ $ANY_TRUE == "true" ] && [ $ANY_FALSE == "true" ]; then
|
||||||
# Validate if we should check individual lanuages #
|
fatal "Behavior not supported, please either only include (VALIDATE=true) or exclude (VALIDATE=false) linters, but not both"
|
||||||
###################################################
|
fi
|
||||||
|
|
||||||
|
#########################################################
|
||||||
|
# Validate if we should check/omit individual languages #
|
||||||
|
#########################################################
|
||||||
# Loop through all languages
|
# Loop through all languages
|
||||||
for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
|
for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
|
||||||
# build the variable
|
# build the variable
|
||||||
|
@ -79,8 +90,10 @@ function GetValidationInfo() {
|
||||||
if [[ ${ANY_SET} == "true" ]]; then
|
if [[ ${ANY_SET} == "true" ]]; then
|
||||||
# Check to see if the variable was set
|
# Check to see if the variable was set
|
||||||
if [ -z "${!VALIDATE_LANGUAGE}" ]; then
|
if [ -z "${!VALIDATE_LANGUAGE}" ]; then
|
||||||
# Flag was not set, default to false
|
# Flag was not set, default to:
|
||||||
eval "${VALIDATE_LANGUAGE}='false'"
|
# if ANY_TRUE then set to false
|
||||||
|
# if ANY_FALSE then set to true
|
||||||
|
eval "${VALIDATE_LANGUAGE}='$ANY_FALSE'"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# No linter flags were set - default all to true
|
# No linter flags were set - default all to true
|
||||||
|
|
Loading…
Reference in a new issue