mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-26 08:01:03 -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
|
### dartanalyzer standard Config file
|
||||||
|
|
||||||
- `.github/linters/.dart-lint.yml`
|
- `.github/linters/analysis_options.yml`
|
||||||
- You can pass multiple rules and overwrite default rules
|
- 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
|
### dartanalyzer disable single line
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ int x = ''; // ignore: invalid_assignment
|
||||||
|
|
||||||
### dartanalyzer disable entire file
|
### 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
|
```dart
|
||||||
analyzer:
|
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_FILE_NAME='.stylelintrc.json' # Name of the file
|
||||||
CSS_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${CSS_FILE_NAME}" # Path to the CSS lint rules
|
CSS_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${CSS_FILE_NAME}" # Path to the CSS lint rules
|
||||||
# Dart Vars
|
# 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
|
DART_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${DART_FILE_NAME}" # Path to the DART lint rules
|
||||||
# Docker Vars
|
# Docker Vars
|
||||||
DOCKERFILE_NAME='.dockerfilelintrc' # Name of the file
|
DOCKERFILE_NAME='.dockerfilelintrc' # Name of the file
|
||||||
|
@ -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 #
|
||||||
########################################################
|
########################################################
|
||||||
|
@ -1754,9 +1789,9 @@ if [ "${VALIDATE_XML}" == "true" ]; then
|
||||||
LintCodebase "XML" "xmllint" "xmllint" ".*\.\(xml\)\$" "${FILE_ARRAY_XML[@]}"
|
LintCodebase "XML" "xmllint" "xmllint" ".*\.\(xml\)\$" "${FILE_ARRAY_XML[@]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###############
|
################
|
||||||
# YAML LINTING #
|
# YAML LINTING #
|
||||||
###############
|
################
|
||||||
if [ "${VALIDATE_YAML}" == "true" ]; then
|
if [ "${VALIDATE_YAML}" == "true" ]; then
|
||||||
######################
|
######################
|
||||||
# Lint the Yml Files #
|
# Lint the Yml Files #
|
||||||
|
|
|
@ -732,7 +732,7 @@ function LintAnsibleFiles() {
|
||||||
########################################
|
########################################
|
||||||
# Make sure we dont lint certain files #
|
# 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
|
# This is a file we dont look at
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue