Fix getting filename for hidden files

This commit is contained in:
Marco Ferrari 2020-09-08 19:20:49 +02:00
parent 1d46677b4f
commit 83666ffaba

View file

@ -495,18 +495,21 @@ GetLinterRules() {
# Pull in vars # # Pull in vars #
################ ################
LANGUAGE_NAME="${1}" # Name of the language were looking for LANGUAGE_NAME="${1}" # Name of the language were looking for
debug "Getting linter rules for ${LANGUAGE_NAME}..."
####################################################### #######################################################
# Need to create the variables for the real variables # # Need to create the variables for the real variables #
####################################################### #######################################################
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"
debug "Variable names for language file name: ${LANGUAGE_FILE_NAME}, language linter rules: ${LANGUAGE_LINTER_RULES}"
########################## ##########################
# Get the file extension # # Get the file extension #
########################## ##########################
FILE_EXTENSION=$(echo "${!LANGUAGE_FILE_NAME}" | rev | cut -d'.' -f1 | rev) FILE_EXTENSION=$(echo "${!LANGUAGE_FILE_NAME}" | rev | cut -d'.' -f1 | rev)
FILE_NAME=$(echo "${!LANGUAGE_FILE_NAME}" | rev | cut -d'.' -f2 | rev) FILE_NAME=$(basename "${!LANGUAGE_FILE_NAME}" ".${FILE_EXTENSION}")
debug "${LANGUAGE_NAME} language rule file (${!LANGUAGE_FILE_NAME}) has ${FILE_NAME} name and ${FILE_EXTENSION} extension"
############################### ###############################
# Set the secondary file name # # Set the secondary file name #
@ -536,8 +539,10 @@ 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
debug " -> Codebase does NOT have file:[${GITHUB_WORKSPACE}/${LINTER_RULES_PATH}/${!LANGUAGE_FILE_NAME}]"
# Check if we have secondary name to check # Check if we have secondary name to check
if [ -n "$SECONDARY_FILE_NAME" ]; then if [ -n "$SECONDARY_FILE_NAME" ]; then
debug "${LANGUAGE_NAME} language rule file has a secondary rules file name to check: ${SECONDARY_FILE_NAME}"
# We have a secondary name to validate # We have a secondary name to validate
if [ -f "${GITHUB_WORKSPACE}/${LINTER_RULES_PATH}/${SECONDARY_FILE_NAME}" ]; then if [ -f "${GITHUB_WORKSPACE}/${LINTER_RULES_PATH}/${SECONDARY_FILE_NAME}" ]; then
info "----------------------------------------------" info "----------------------------------------------"
@ -549,10 +554,11 @@ GetLinterRules() {
eval "${LANGUAGE_LINTER_RULES}=${GITHUB_WORKSPACE}/${LINTER_RULES_PATH}/${SECONDARY_FILE_NAME}" eval "${LANGUAGE_LINTER_RULES}=${GITHUB_WORKSPACE}/${LINTER_RULES_PATH}/${SECONDARY_FILE_NAME}"
fi fi
fi fi
######################################################## ########################################################
# No user default provided, using the template default # # No user default provided, using the template default #
######################################################## ########################################################
debug " -> Codebase does NOT have file:[${LINTER_RULES_PATH}/${!LANGUAGE_FILE_NAME}], using Default rules at:[${!LANGUAGE_LINTER_RULES}]" debug " -> Codebase does NOT have file:[${GITHUB_WORKSPACE}/${LINTER_RULES_PATH}/${!LANGUAGE_FILE_NAME}], nor file:[${GITHUB_WORKSPACE}/${LINTER_RULES_PATH}/${SECONDARY_FILE_NAME}], using Default rules at:[${!LANGUAGE_LINTER_RULES}]"
fi fi
} }
################################################################################ ################################################################################