diff --git a/.github/linters/analysis_options.yaml b/.github/linters/analysis_options.yml similarity index 100% rename from .github/linters/analysis_options.yaml rename to .github/linters/analysis_options.yml diff --git a/TEMPLATES/analysis_options.yaml b/TEMPLATES/analysis_options.yml similarity index 100% rename from TEMPLATES/analysis_options.yaml rename to TEMPLATES/analysis_options.yml diff --git a/docs/disabling-linters.md b/docs/disabling-linters.md index 455f37f2..7a3c9b33 100644 --- a/docs/disabling-linters.md +++ b/docs/disabling-linters.md @@ -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: diff --git a/lib/linter.sh b/lib/linter.sh index e8526a64..5beac264 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -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 # diff --git a/lib/worker.sh b/lib/worker.sh index b5bf969e..300355c9 100755 --- a/lib/worker.sh +++ b/lib/worker.sh @@ -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