mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-22 14:10:56 -05:00
small clean
This commit is contained in:
parent
90abd3ee06
commit
98c2eec42a
2 changed files with 13 additions and 45 deletions
|
@ -71,7 +71,7 @@ JAVASCRIPT_STANDARD_LINTER_RULES='' # EN
|
||||||
LINTER_RULES_PATH="${LINTER_RULES_PATH:-.github/linters}" # Linter Path Directory
|
LINTER_RULES_PATH="${LINTER_RULES_PATH:-.github/linters}" # Linter Path Directory
|
||||||
# LaTeX Vars
|
# LaTeX Vars
|
||||||
LATEX_FILE_NAME='.chktexrc' # Name of the file
|
LATEX_FILE_NAME='.chktexrc' # Name of the file
|
||||||
LATEX_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${LATEX_FILE_NAME}" # Path to the Latex lint rules # env var to supress warning from chktex
|
LATEX_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${LATEX_FILE_NAME}" # Path to the Latex lint rules
|
||||||
# Lua Vars
|
# Lua Vars
|
||||||
LUA_FILE_NAME='.luacheckrc' # Name of the file
|
LUA_FILE_NAME='.luacheckrc' # Name of the file
|
||||||
LUA_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${LUA_FILE_NAME}" # Path to the Lua lint rules
|
LUA_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${LUA_FILE_NAME}" # Path to the Lua lint rules
|
||||||
|
@ -136,7 +136,7 @@ YAML_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${YAML_FILE_NAME}" # Path to the ya
|
||||||
LINTER_ARRAY=('ansible-lint' 'arm-ttk' 'asl-validator' 'bash-exec' 'black' 'cfn-lint' 'checkstyle' 'chktex' 'clj-kondo' 'coffeelint'
|
LINTER_ARRAY=('ansible-lint' 'arm-ttk' 'asl-validator' 'bash-exec' 'black' 'cfn-lint' 'checkstyle' 'chktex' 'clj-kondo' 'coffeelint'
|
||||||
'dotnet-format' 'dart' 'dockerfilelint' 'dotenv-linter' 'editorconfig-checker' 'eslint' 'flake8' 'golangci-lint'
|
'dotnet-format' 'dart' 'dockerfilelint' 'dotenv-linter' 'editorconfig-checker' 'eslint' 'flake8' 'golangci-lint'
|
||||||
'hadolint' 'htmlhint' 'jsonlint' 'ktlint' 'lintr' 'lua' 'markdownlint' 'npm-groovy-lint' 'perl' 'protolint'
|
'hadolint' 'htmlhint' 'jsonlint' 'ktlint' 'lintr' 'lua' 'markdownlint' 'npm-groovy-lint' 'perl' 'protolint'
|
||||||
'pwsh' 'pylint' 'raku' 'rubocop' 'shellcheck' 'shfmt' 'spectral' 'standard' 'stylelint' 'sql-lint'
|
'pwsh' 'pylint' 'raku' 'rubocop' 'shellcheck' 'spectral' 'standard' 'stylelint' 'sql-lint'
|
||||||
'terrascan' 'tflint' 'xmllint' 'yamllint')
|
'terrascan' 'tflint' 'xmllint' 'yamllint')
|
||||||
|
|
||||||
#############################
|
#############################
|
||||||
|
@ -146,7 +146,7 @@ LANGUAGE_ARRAY=('ANSIBLE' 'ARM' 'BASH' 'BASH_EXEC' 'CLOUDFORMATION' 'CLOJURE' 'C
|
||||||
'DART' 'DOCKERFILE' 'DOCKERFILE_HADOLINT' 'EDITORCONFIG' 'ENV' 'GO' 'GROOVY' 'HTML'
|
'DART' 'DOCKERFILE' 'DOCKERFILE_HADOLINT' 'EDITORCONFIG' 'ENV' 'GO' 'GROOVY' 'HTML'
|
||||||
'JAVA' 'JAVASCRIPT_ES' 'JAVASCRIPT_STANDARD' 'JSON' 'JSX' 'KOTLIN' 'LATEX' 'LUA' 'MARKDOWN'
|
'JAVA' 'JAVASCRIPT_ES' 'JAVASCRIPT_STANDARD' 'JSON' 'JSX' 'KOTLIN' 'LATEX' 'LUA' 'MARKDOWN'
|
||||||
'OPENAPI' 'PERL' 'PHP_BUILTIN' 'PHP_PHPCS' 'PHP_PHPSTAN' 'PHP_PSALM' 'POWERSHELL'
|
'OPENAPI' 'PERL' 'PHP_BUILTIN' 'PHP_PHPCS' 'PHP_PHPSTAN' 'PHP_PSALM' 'POWERSHELL'
|
||||||
'PROTOBUF' 'PYTHON_BLACK' 'PYTHON_PYLINT' 'PYTHON_FLAKE8' 'R' 'RAKU' 'RUBY' 'SHELL_SHFMT' 'STATES' 'SQL' 'TERRAFORM'
|
'PROTOBUF' 'PYTHON_BLACK' 'PYTHON_PYLINT' 'PYTHON_FLAKE8' 'R' 'RAKU' 'RUBY' 'STATES' 'SQL' 'TERRAFORM'
|
||||||
'TERRAFORM_TERRASCAN' 'TSX' 'TYPESCRIPT_ES' 'TYPESCRIPT_STANDARD' 'XML' 'YAML')
|
'TERRAFORM_TERRASCAN' 'TSX' 'TYPESCRIPT_ES' 'TYPESCRIPT_STANDARD' 'XML' 'YAML')
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
|
@ -211,7 +211,6 @@ VALIDATE_R="${VALIDATE_R}" # Boolean t
|
||||||
VALIDATE_RAKU="${VALIDATE_RAKU}" # Boolean to validate language
|
VALIDATE_RAKU="${VALIDATE_RAKU}" # Boolean to validate language
|
||||||
VALIDATE_RUBY="${VALIDATE_RUBY}" # Boolean to validate language
|
VALIDATE_RUBY="${VALIDATE_RUBY}" # Boolean to validate language
|
||||||
VALIDATE_STATES="${VALIDATE_STATES}" # Boolean to validate language
|
VALIDATE_STATES="${VALIDATE_STATES}" # Boolean to validate language
|
||||||
VALIDATE_SHELL_SHFMT="${VALIDATE_SHELL_SHFMT}" # Boolean to check Shell files against editorconfig
|
|
||||||
VALIDATE_SQL="${VALIDATE_SQL}" # Boolean to validate language
|
VALIDATE_SQL="${VALIDATE_SQL}" # Boolean to validate language
|
||||||
VALIDATE_TERRAFORM="${VALIDATE_TERRAFORM}" # Boolean to validate language
|
VALIDATE_TERRAFORM="${VALIDATE_TERRAFORM}" # Boolean to validate language
|
||||||
VALIDATE_TERRAFORM_TERRASCAN="${VALIDATE_TERRAFORM_TERRASCAN}" # Boolean to validate language
|
VALIDATE_TERRAFORM_TERRASCAN="${VALIDATE_TERRAFORM_TERRASCAN}" # Boolean to validate language
|
||||||
|
@ -405,8 +404,6 @@ ERRORS_FOUND_RAKU=0 # Count of errors found
|
||||||
export ERRORS_FOUND_RAKU # Workaround SC2034
|
export ERRORS_FOUND_RAKU # Workaround SC2034
|
||||||
ERRORS_FOUND_RUBY=0 # Count of errors found
|
ERRORS_FOUND_RUBY=0 # Count of errors found
|
||||||
export ERRORS_FOUND_RUBY # Workaround SC2034
|
export ERRORS_FOUND_RUBY # Workaround SC2034
|
||||||
ERRORS_FOUND_SHELL_SHFMT=0 # Count of errors found
|
|
||||||
export ERRORS_FOUND_SHELL_SHFMT
|
|
||||||
ERRORS_FOUND_STATES=0 # Count of errors found
|
ERRORS_FOUND_STATES=0 # Count of errors found
|
||||||
export ERRORS_FOUND_STATES # Workaround SC2034
|
export ERRORS_FOUND_STATES # Workaround SC2034
|
||||||
ERRORS_FOUND_SQL=0 # Count of errors found
|
ERRORS_FOUND_SQL=0 # Count of errors found
|
||||||
|
@ -467,7 +464,7 @@ GetLinterVersions() {
|
||||||
if [[ ${LINTER} == "arm-ttk" ]]; then
|
if [[ ${LINTER} == "arm-ttk" ]]; then
|
||||||
# Need specific command for ARM
|
# Need specific command for ARM
|
||||||
mapfile -t GET_VERSION_CMD < <(grep -iE 'version' "${ARM_TTK_PSD1}" | xargs 2>&1)
|
mapfile -t GET_VERSION_CMD < <(grep -iE 'version' "${ARM_TTK_PSD1}" | xargs 2>&1)
|
||||||
elif [[ ${LINTER} == "protolint" ]] || [[ ${LINTER} == "editorconfig-checker" ]] || [[ ${LINTER} == "bash-exec" ]]; then
|
elif [[ ${LINTER} == "protolint" ]] || [[ ${LINTER} == "editorconfig-checker" ]]; then
|
||||||
# Need specific command for Protolint and editorconfig-checker
|
# Need specific command for Protolint and editorconfig-checker
|
||||||
mapfile -t GET_VERSION_CMD < <(echo "--version not supported")
|
mapfile -t GET_VERSION_CMD < <(echo "--version not supported")
|
||||||
elif [[ ${LINTER} == "lintr" ]]; then
|
elif [[ ${LINTER} == "lintr" ]]; then
|
||||||
|
@ -478,8 +475,6 @@ GetLinterVersions() {
|
||||||
elif [[ ${LINTER} == "lua" ]]; then
|
elif [[ ${LINTER} == "lua" ]]; then
|
||||||
# Semi standardversion command
|
# Semi standardversion command
|
||||||
mapfile -t GET_VERSION_CMD < <("${LINTER}" -v 2>&1)
|
mapfile -t GET_VERSION_CMD < <("${LINTER}" -v 2>&1)
|
||||||
elif [[ ${LINTER} == "terrascan" ]]; then
|
|
||||||
mapfile -t GET_VERSION_CMD < <("${LINTER}" version 2>&1)
|
|
||||||
else
|
else
|
||||||
# Standard version command
|
# Standard version command
|
||||||
mapfile -t GET_VERSION_CMD < <("${LINTER}" --version 2>&1)
|
mapfile -t GET_VERSION_CMD < <("${LINTER}" --version 2>&1)
|
||||||
|
@ -1070,13 +1065,9 @@ Reports() {
|
||||||
#############################################
|
#############################################
|
||||||
# Print info on reports that were generated #
|
# Print info on reports that were generated #
|
||||||
#############################################
|
#############################################
|
||||||
if [ -d "${REPORT_OUTPUT_FOLDER}" ]; then
|
|
||||||
info "Contents of report folder:"
|
info "Contents of report folder:"
|
||||||
OUTPUT_CONTENTS_CMD=$(ls "${REPORT_OUTPUT_FOLDER}")
|
OUTPUT_CONTENTS_CMD=$(ls "${REPORT_OUTPUT_FOLDER}")
|
||||||
info "$OUTPUT_CONTENTS_CMD"
|
info "$OUTPUT_CONTENTS_CMD"
|
||||||
else
|
|
||||||
warn "Report output folder (${REPORT_OUTPUT_FOLDER}) does NOT exist."
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
################################
|
################################
|
||||||
|
@ -1845,26 +1836,6 @@ if [ "${VALIDATE_RUBY}" == "true" ]; then
|
||||||
LintCodebase "RUBY" "rubocop" "rubocop -c ${RUBY_LINTER_RULES} --force-exclusion" ".*\.\(rb\)\$" "${FILE_ARRAY_RUBY[@]}"
|
LintCodebase "RUBY" "rubocop" "rubocop -c ${RUBY_LINTER_RULES} --force-exclusion" ".*\.\(rb\)\$" "${FILE_ARRAY_RUBY[@]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#################
|
|
||||||
# SHFMT LINTING #
|
|
||||||
#################
|
|
||||||
if [ "${VALIDATE_SHELL_SHFMT}" == "true" ]; then
|
|
||||||
####################################
|
|
||||||
# Lint the files with shfmt #
|
|
||||||
####################################
|
|
||||||
EDITORCONFIG_FILE_PATH="${GITHUB_WORKSPACE}"/.editorconfig
|
|
||||||
if [ -e "$EDITORCONFIG_FILE_PATH" ]; then
|
|
||||||
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY"
|
|
||||||
LintCodebase "SHELL_SHFMT" "shfmt" "shfmt -d" ".*\.\(sh\|bash\|dash\|ksh\)\$" "${FILE_ARRAY_BASH[@]}"
|
|
||||||
else
|
|
||||||
###############################
|
|
||||||
# No .editorconfig file found #
|
|
||||||
###############################
|
|
||||||
warn "No .editorconfig found at:[$EDITORCONFIG_FILE_PATH]"
|
|
||||||
debug "skipping shfmt"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
######################
|
######################
|
||||||
# AWS STATES LINTING #
|
# AWS STATES LINTING #
|
||||||
######################
|
######################
|
||||||
|
|
|
@ -163,11 +163,8 @@ function LintCodebase() {
|
||||||
elif [[ ${FILE} == *".rbenv"* ]]; then
|
elif [[ ${FILE} == *".rbenv"* ]]; then
|
||||||
# This is likely the ruby environment folder and shouldn't be parsed
|
# This is likely the ruby environment folder and shouldn't be parsed
|
||||||
continue
|
continue
|
||||||
elif [[ ${FILE_TYPE} == "BASH" ]] && CheckZsh "${FILE}"; then
|
elif [[ ${FILE_TYPE} == "BASH" ]] || [[ ${FILE_TYPE} == "SHELL_SHFMT" ]]; then
|
||||||
# ZSH file and we need to skip
|
if CheckZsh "${FILE}"; then
|
||||||
warn "$LINTER_NAME does NOT currently support zsh, skipping file"
|
|
||||||
continue
|
|
||||||
elif [[ ${FILE_TYPE} == "SHELL_SHFMT" ]] && CheckZsh "${FILE}"; then
|
|
||||||
# ZSH file and we need to skip
|
# ZSH file and we need to skip
|
||||||
warn "$LINTER_NAME does NOT currently support zsh, skipping file"
|
warn "$LINTER_NAME does NOT currently support zsh, skipping file"
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in a new issue