mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-06 17:25:55 -05:00
Merge pull request #527 from github/SupportAllYaml
Supporting yml and yaml file names
This commit is contained in:
commit
b76da563c6
5 changed files with 46 additions and 11 deletions
|
@ -243,9 +243,9 @@ a {
|
|||
|
||||
### dartanalyzer standard Config file
|
||||
|
||||
- `.github/linters/.dart-lint.yml`
|
||||
- `.github/linters/analysis_options.yml`
|
||||
- You can pass multiple rules and overwrite default rules
|
||||
- File should be located at: `.github/linters/analysis_options.yaml`
|
||||
- File should be located at: `.github/linters/analysis_options.yml`
|
||||
|
||||
### dartanalyzer disable single line
|
||||
|
||||
|
@ -263,7 +263,7 @@ int x = ''; // ignore: invalid_assignment
|
|||
|
||||
### dartanalyzer disable entire file
|
||||
|
||||
- You can disable entire files with the `analyzer.exclude` property in `analysis_options.yaml`
|
||||
- You can disable entire files with the `analyzer.exclude` property in `analysis_options.yml`
|
||||
|
||||
```dart
|
||||
analyzer:
|
||||
|
|
|
@ -43,7 +43,7 @@ COFFEESCRIPT_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${COFFEE_FILE_NAME}" # Path
|
|||
CSS_FILE_NAME='.stylelintrc.json' # Name of the file
|
||||
CSS_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${CSS_FILE_NAME}" # Path to the CSS lint rules
|
||||
# Dart Vars
|
||||
DART_FILE_NAME='analysis_options.yaml' # Name of the file
|
||||
DART_FILE_NAME='analysis_options.yml' # Name of the file
|
||||
DART_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${DART_FILE_NAME}" # Path to the DART lint rules
|
||||
# Docker Vars
|
||||
DOCKERFILE_NAME='.dockerfilelintrc' # Name of the file
|
||||
|
@ -477,6 +477,28 @@ GetLinterRules() {
|
|||
LANGUAGE_FILE_NAME="${LANGUAGE_NAME}_FILE_NAME"
|
||||
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 #
|
||||
#####################################
|
||||
|
@ -489,10 +511,23 @@ GetLinterRules() {
|
|||
########################################
|
||||
eval "${LANGUAGE_LINTER_RULES}=${GITHUB_WORKSPACE}/${LINTER_RULES_PATH}/${!LANGUAGE_FILE_NAME}"
|
||||
else
|
||||
########################################################
|
||||
# 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}]"
|
||||
# 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 #
|
||||
########################################################
|
||||
debug " -> Codebase does NOT have file:[${LINTER_RULES_PATH}/${!LANGUAGE_FILE_NAME}], using Default rules at:[${!LANGUAGE_LINTER_RULES}]"
|
||||
fi
|
||||
}
|
||||
################################################################################
|
||||
|
@ -1754,9 +1789,9 @@ if [ "${VALIDATE_XML}" == "true" ]; then
|
|||
LintCodebase "XML" "xmllint" "xmllint" ".*\.\(xml\)\$" "${FILE_ARRAY_XML[@]}"
|
||||
fi
|
||||
|
||||
###############
|
||||
################
|
||||
# YAML LINTING #
|
||||
###############
|
||||
################
|
||||
if [ "${VALIDATE_YAML}" == "true" ]; then
|
||||
######################
|
||||
# Lint the Yml Files #
|
||||
|
|
|
@ -732,7 +732,7 @@ function LintAnsibleFiles() {
|
|||
########################################
|
||||
# Make sure we dont lint certain files #
|
||||
########################################
|
||||
if [[ ${FILE} == *"vault.yml"* ]] || [[ ${FILE} == *"galaxy.yml"* ]]; then
|
||||
if [[ ${FILE} == *"vault.yml"* ]] || [[ ${FILE} == *"galaxy.yml"* ]] || [[ ${FILE} == *"vault.yaml"* ]] || [[ ${FILE} == *"galaxy.yaml"* ]]; then
|
||||
# This is a file we dont look at
|
||||
continue
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue