mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-09 18:43:34 -05:00
Adding secondary name
This commit is contained in:
parent
48e854329b
commit
5b44f9d066
1 changed files with 39 additions and 4 deletions
|
@ -477,6 +477,28 @@ GetLinterRules() {
|
||||||
LANGUAGE_FILE_NAME="${LANGUAGE_NAME}_FILE_NAME"
|
LANGUAGE_FILE_NAME="${LANGUAGE_NAME}_FILE_NAME"
|
||||||
LANGUAGE_LINTER_RULES="${LANGUAGE_NAME}_LINTER_RULES"
|
LANGUAGE_LINTER_RULES="${LANGUAGE_NAME}_LINTER_RULES"
|
||||||
|
|
||||||
|
##########################
|
||||||
|
# Get the file extension #
|
||||||
|
##########################
|
||||||
|
FILE_EXTENSION=$(echo "${!LANGUAGE_FILE_NAME}" | rev | cut -d'.' -f1 | rev)
|
||||||
|
FILE_NAME=$(echo "${!LANGUAGE_FILE_NAME}" | rev | cut -d'.' -f2 | rev)
|
||||||
|
|
||||||
|
###############################
|
||||||
|
# Set the secondary file name #
|
||||||
|
###############################
|
||||||
|
SECONDARY_FILE_NAME=''
|
||||||
|
|
||||||
|
#################################
|
||||||
|
# Check for secondary file name #
|
||||||
|
#################################
|
||||||
|
if [[ $FILE_EXTENSION == 'yml' ]]; then
|
||||||
|
# Need to see if yaml also exists
|
||||||
|
SECONDARY_FILE_NAME="$FILE_NAME.yaml"
|
||||||
|
elif [[ $FILE_EXTENSION == 'yaml' ]]; then
|
||||||
|
# need to see if yml also exists
|
||||||
|
SECONDARY_FILE_NAME="$FILE_NAME.yml"
|
||||||
|
fi
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
# Validate we have the linter rules #
|
# Validate we have the linter rules #
|
||||||
#####################################
|
#####################################
|
||||||
|
@ -489,6 +511,19 @@ GetLinterRules() {
|
||||||
########################################
|
########################################
|
||||||
eval "${LANGUAGE_LINTER_RULES}=${GITHUB_WORKSPACE}/${LINTER_RULES_PATH}/${!LANGUAGE_FILE_NAME}"
|
eval "${LANGUAGE_LINTER_RULES}=${GITHUB_WORKSPACE}/${LINTER_RULES_PATH}/${!LANGUAGE_FILE_NAME}"
|
||||||
else
|
else
|
||||||
|
# Check if we have secondary name to check
|
||||||
|
if [ -n "$SECONDARY_FILE_NAME" ]; then
|
||||||
|
# We have a secondary name to validate
|
||||||
|
if [ -f "${GITHUB_WORKSPACE}/${LINTER_RULES_PATH}/${SECONDARY_FILE_NAME}" ]; then
|
||||||
|
info "----------------------------------------------"
|
||||||
|
info "User provided file:[${SECONDARY_FILE_NAME}], setting rules file..."
|
||||||
|
|
||||||
|
########################################
|
||||||
|
# Update the path to the file location #
|
||||||
|
########################################
|
||||||
|
eval "${LANGUAGE_LINTER_RULES}=${GITHUB_WORKSPACE}/${LINTER_RULES_PATH}/${SECONDARY_FILE_NAME}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
########################################################
|
########################################################
|
||||||
# No user default provided, using the template default #
|
# No user default provided, using the template default #
|
||||||
########################################################
|
########################################################
|
||||||
|
|
Loading…
Reference in a new issue