mirror of
https://github.com/super-linter/super-linter.git
synced 2024-12-22 04:32:16 -05:00
Merge branch 'master' into master
This commit is contained in:
commit
eb36fb7d7c
5 changed files with 171 additions and 77 deletions
6
.github/workflows/deploy-RELEASE.yml
vendored
6
.github/workflows/deploy-RELEASE.yml
vendored
|
@ -54,9 +54,9 @@ jobs:
|
|||
shell: bash
|
||||
run: .automation/upload-docker.sh
|
||||
|
||||
#############################
|
||||
# Run Deploy script for GPR #
|
||||
#############################
|
||||
###################################################
|
||||
# Run Deploy script for GitHub Container Registry #
|
||||
###################################################
|
||||
- name: Deploy Release image to GitHub Container Registry
|
||||
env:
|
||||
# Set the Env Vars
|
||||
|
|
12
Dockerfile
12
Dockerfile
|
@ -122,7 +122,7 @@ ENV PATH="/node_modules/.bin:${PATH}"
|
|||
RUN bundle install
|
||||
|
||||
###################################
|
||||
# Install DotNet and Dependancies #
|
||||
# Install DotNet and Dependencies #
|
||||
###################################
|
||||
RUN wget --tries=5 -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \
|
||||
&& chmod +x dotnet-install.sh \
|
||||
|
@ -306,11 +306,6 @@ ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin
|
|||
RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
|
||||
RUN go get mvdan.cc/sh/v3/cmd/shfmt
|
||||
|
||||
#############################
|
||||
# Bootstrap npm-groovy-lint #
|
||||
#############################
|
||||
RUN npm-groovy-lint --version
|
||||
|
||||
###########################################
|
||||
# Load GitHub Env Vars for GitHub Actions #
|
||||
###########################################
|
||||
|
@ -395,6 +390,11 @@ COPY lib /action/lib
|
|||
##################################
|
||||
COPY TEMPLATES /action/lib/.automation
|
||||
|
||||
###################################
|
||||
# Run to build file with versions #
|
||||
###################################
|
||||
RUN /action/lib/linterVersions.sh
|
||||
|
||||
######################
|
||||
# Set the entrypoint #
|
||||
######################
|
||||
|
|
26
dependencies/Pipfile.lock
generated
vendored
26
dependencies/Pipfile.lock
generated
vendored
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "1f13d59524584eca4db2ae57cf6d3acd02250a28bce7bee9414f21c45cae09af"
|
||||
"sha256": "1f2a4e188bcf058f78905dbe7c959b9a801148e39a69e86d6a795b45a65b7af9"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
|
@ -62,25 +62,25 @@
|
|||
},
|
||||
"boto3": {
|
||||
"hashes": [
|
||||
"sha256:8a7aa1da29b7c8039f81798bd27465f29494629c40280a70c2ef0daed5bb7682",
|
||||
"sha256:a2bf58d375ad1b918e6007a46e415721b51dd7bb23703332cc64afa1470b056d"
|
||||
"sha256:4196b418598851ffd10cf9d1606694673cbfeca4ddf8b25d4e50addbd2fc60bf",
|
||||
"sha256:69ad8f2184979e223e12ee3071674fdf910983cf9f4d6f34f7ec407b089064b5"
|
||||
],
|
||||
"version": "==1.14.49"
|
||||
"version": "==1.14.54"
|
||||
},
|
||||
"botocore": {
|
||||
"hashes": [
|
||||
"sha256:4433510d12dc783dd068f39ada942008f5792eea0c569f6b357bb751640c6ab4",
|
||||
"sha256:87326c2d3b68c49a56f2d9237aa47a0476bb9ec6c6bc50d04df8bba66991930c"
|
||||
"sha256:6fe05837646447d61acdaf1e3401b92cd9309f00b19c577a50d0ade7735a3403",
|
||||
"sha256:9e493a21e6a8d45c631eb2952ae8e1d0a31b9984546d4268ea10c0c33e2435ce"
|
||||
],
|
||||
"version": "==1.17.49"
|
||||
"version": "==1.17.54"
|
||||
},
|
||||
"cfn-lint": {
|
||||
"hashes": [
|
||||
"sha256:42023d89520e3a29891ec2eb4c326eef9d1f7516fe9abee8b6c97ce064187b45",
|
||||
"sha256:8439925531fdd4c94e5b50974d067857b3af50b04b61254d3eae9b1e0ce20007"
|
||||
"sha256:98c7e2c2846df779f1a878e76f3eb7a3f40dd7b7dd316e5673c4923cf2ed121e",
|
||||
"sha256:cbf0ef2946c544db347874e36cf4c1a099c432280d62da9b9c739914668aec80"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==0.35.0"
|
||||
"version": "==0.35.1"
|
||||
},
|
||||
"click": {
|
||||
"hashes": [
|
||||
|
@ -223,12 +223,6 @@
|
|||
],
|
||||
"version": "==2.2.0"
|
||||
},
|
||||
"pyhcl": {
|
||||
"hashes": [
|
||||
"sha256:2d9b9dcdf1023d812bfed561ba72c99104c5b3f52e558d595130a44ce081b003"
|
||||
],
|
||||
"version": "==0.4.4"
|
||||
},
|
||||
"pylint": {
|
||||
"hashes": [
|
||||
"sha256:bb4a908c9dadbc3aac18860550e870f58e1a02c9f2c204fdf5693d73be061210",
|
||||
|
|
|
@ -128,19 +128,12 @@ TERRAFORM_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${TERRAFORM_FILE_NAME}" # Path
|
|||
TYPESCRIPT_FILE_NAME="${TYPESCRIPT_ES_CONFIG_FILE:-.eslintrc.yml}" # Name of the file
|
||||
TYPESCRIPT_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${TYPESCRIPT_FILE_NAME}" # Path to the Typescript lint rules
|
||||
TYPESCRIPT_STANDARD_LINTER_RULES='' # ENV string to pass when running js standard
|
||||
# Version File info
|
||||
VERSION_FILE='/action/lib/linter-versions.txt' # File to store linter versions
|
||||
# YAML Vars
|
||||
YAML_FILE_NAME="${YAML_CONFIG_FILE:-.yaml-lint.yml}" # Name of the file
|
||||
YAML_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${YAML_FILE_NAME}" # Path to the yaml lint rules
|
||||
|
||||
#######################################
|
||||
# Linter array for information prints #
|
||||
#######################################
|
||||
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'
|
||||
'hadolint' 'htmlhint' 'jsonlint' 'ktlint' 'lintr' 'lua' 'markdownlint' 'npm-groovy-lint' 'perl' 'protolint'
|
||||
'pwsh' 'pylint' 'raku' 'rubocop' 'shellcheck' 'shfmt' 'spectral' 'standard' 'stylelint' 'sql-lint'
|
||||
'terrascan' 'tflint' 'xmllint' 'yamllint')
|
||||
|
||||
#############################
|
||||
# Language array for prints #
|
||||
#############################
|
||||
|
@ -459,51 +452,26 @@ GetLinterVersions() {
|
|||
debug "---------------------------------------------"
|
||||
debug "Linter Version Info:"
|
||||
|
||||
##########################################################
|
||||
# Go through the array of linters and print version info #
|
||||
##########################################################
|
||||
for LINTER in "${LINTER_ARRAY[@]}"; do
|
||||
####################
|
||||
# Get the versions #
|
||||
####################
|
||||
if [[ ${LINTER} == "arm-ttk" ]]; then
|
||||
# Need specific command for ARM
|
||||
mapfile -t GET_VERSION_CMD < <(grep -iE 'version' "${ARM_TTK_PSD1}" | xargs 2>&1)
|
||||
elif [[ ${LINTER} == "protolint" ]] || [[ ${LINTER} == "editorconfig-checker" ]] || [[ ${LINTER} == "bash-exec" ]]; then
|
||||
# Need specific command for Protolint and editorconfig-checker
|
||||
mapfile -t GET_VERSION_CMD < <(echo "--version not supported")
|
||||
elif [[ ${LINTER} == "lintr" ]]; then
|
||||
# Need specific command for lintr (--slave is deprecated in R 4.0 and replaced by --no-echo)
|
||||
mapfile -t GET_VERSION_CMD < <(R --slave -e "r_ver <- R.Version()\$version.string; \
|
||||
lintr_ver <- packageVersion('lintr'); \
|
||||
glue::glue('lintr { lintr_ver } on { r_ver }')")
|
||||
elif [[ ${LINTER} == "lua" ]]; then
|
||||
# Semi standardversion command
|
||||
mapfile -t GET_VERSION_CMD < <("${LINTER}" -v 2>&1)
|
||||
elif [[ ${LINTER} == "terrascan" ]]; then
|
||||
mapfile -t GET_VERSION_CMD < <("${LINTER}" version 2>&1)
|
||||
else
|
||||
# Standard version command
|
||||
mapfile -t GET_VERSION_CMD < <("${LINTER}" --version 2>&1)
|
||||
fi
|
||||
################################
|
||||
# Cat the linter versions file #
|
||||
################################
|
||||
CAT_CMD=$(cat "${VERSION_FILE}" 2>&1)
|
||||
|
||||
#######################
|
||||
# Load the error code #
|
||||
#######################
|
||||
ERROR_CODE=$?
|
||||
#######################
|
||||
# Load the error code #
|
||||
#######################
|
||||
ERROR_CODE=$?
|
||||
|
||||
##############################
|
||||
# Check the shell for errors #
|
||||
##############################
|
||||
if [ ${ERROR_CODE} -ne 0 ] || [ -z "${GET_VERSION_CMD[*]}" ]; then
|
||||
warn "[${LINTER}]: Failed to get version info for:"
|
||||
else
|
||||
##########################
|
||||
# Print the version info #
|
||||
##########################
|
||||
debug "Successfully found version for ${F[W]}[${LINTER}]${F[B]}: ${F[W]}${GET_VERSION_CMD[*]}"
|
||||
fi
|
||||
done
|
||||
##############################
|
||||
# Check the shell for errors #
|
||||
##############################
|
||||
if [ ${ERROR_CODE} -ne 0 ]; then
|
||||
# Failure
|
||||
warn "Failed to view version file:[${VERSION_FILE}]"
|
||||
else
|
||||
# Success
|
||||
debug "${CAT_CMD}"
|
||||
fi
|
||||
|
||||
#########################
|
||||
# Print version footers #
|
||||
|
|
132
lib/linterVersions.sh
Executable file
132
lib/linterVersions.sh
Executable file
|
@ -0,0 +1,132 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
################################################################################
|
||||
################################################################################
|
||||
########### Super-Linter (Get the linter versions) @admiralawkbar ##############
|
||||
################################################################################
|
||||
################################################################################
|
||||
|
||||
#########################
|
||||
# Source Function Files #
|
||||
#########################
|
||||
# shellcheck source=/dev/null
|
||||
source /action/lib/log.sh # Source the function script(s)
|
||||
|
||||
###########
|
||||
# GLOBALS #
|
||||
###########
|
||||
VERSION_FILE='/action/lib/linter-versions.txt' # File to store linter versions
|
||||
ARM_TTK_PSD1='/usr/bin/arm-ttk' # Powershell var
|
||||
|
||||
#######################################
|
||||
# Linter array for information prints #
|
||||
#######################################
|
||||
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'
|
||||
'hadolint' 'htmlhint' 'jsonlint' 'ktlint' 'lintr' 'lua' 'markdownlint' 'npm-groovy-lint' 'perl' 'protolint'
|
||||
'pwsh' 'pylint' 'raku' 'rubocop' 'shellcheck' 'shfmt' 'spectral' 'standard' 'stylelint' 'sql-lint'
|
||||
'terrascan' 'tflint' 'xmllint' 'yamllint')
|
||||
|
||||
################################################################################
|
||||
########################## FUNCTIONS BELOW #####################################
|
||||
################################################################################
|
||||
################################################################################
|
||||
#### Function BuildLinterVersions ##############################################
|
||||
BuildLinterVersions() {
|
||||
#########################
|
||||
# Print version headers #
|
||||
#########################
|
||||
info "---------------------------------------------"
|
||||
info "Linter Version Info:"
|
||||
|
||||
##########################################################
|
||||
# Go through the array of linters and print version info #
|
||||
##########################################################
|
||||
for LINTER in "${LINTER_ARRAY[@]}"; do
|
||||
if [ -n "${LINTER}" ]; then
|
||||
####################
|
||||
# Get the versions #
|
||||
####################
|
||||
if [[ ${LINTER} == "arm-ttk" ]]; then
|
||||
# Need specific command for ARM
|
||||
mapfile -t GET_VERSION_CMD < <(grep -iE 'version' "${ARM_TTK_PSD1}" | xargs 2>&1)
|
||||
elif [[ ${LINTER} == "protolint" ]] || [[ ${LINTER} == "editorconfig-checker" ]] || [[ ${LINTER} == "bash-exec" ]]; then
|
||||
# Need specific command for Protolint and editorconfig-checker
|
||||
mapfile -t GET_VERSION_CMD < <(echo "--version not supported")
|
||||
elif [[ ${LINTER} == "lintr" ]]; then
|
||||
# Need specific command for lintr (--slave is deprecated in R 4.0 and replaced by --no-echo)
|
||||
mapfile -t GET_VERSION_CMD < <(R --slave -e "r_ver <- R.Version()\$version.string; \
|
||||
lintr_ver <- packageVersion('lintr'); \
|
||||
glue::glue('lintr { lintr_ver } on { r_ver }')")
|
||||
elif [[ ${LINTER} == "lua" ]]; then
|
||||
# Semi standardversion command
|
||||
mapfile -t GET_VERSION_CMD < <("${LINTER}" -v 2>&1)
|
||||
elif [[ ${LINTER} == "terrascan" ]]; then
|
||||
mapfile -t GET_VERSION_CMD < <("${LINTER}" version 2>&1)
|
||||
elif [[ ${LINTER} == "checkstyle" ]]; then
|
||||
mapfile -t GET_VERSION_CMD < <("java -jar /usr/bin/${LINTER}" --version 2>&1)
|
||||
else
|
||||
# Standard version command
|
||||
mapfile -t GET_VERSION_CMD < <("${LINTER}" --version 2>&1)
|
||||
fi
|
||||
|
||||
#######################
|
||||
# Load the error code #
|
||||
#######################
|
||||
ERROR_CODE=$?
|
||||
|
||||
##############################
|
||||
# Check the shell for errors #
|
||||
##############################
|
||||
if [ ${ERROR_CODE} -ne 0 ] || [ -z "${GET_VERSION_CMD[*]}" ]; then
|
||||
warn "[${LINTER}]: Failed to get version info for:"
|
||||
WriteFile "${LINTER}" "Failed to get version info"
|
||||
else
|
||||
##########################
|
||||
# Print the version info #
|
||||
##########################
|
||||
info "Successfully found version for ${F[W]}[${LINTER}]${F[B]}: ${F[W]}${GET_VERSION_CMD[*]}"
|
||||
WriteFile "${LINTER}" "${GET_VERSION_CMD[*]}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
#########################
|
||||
# Print version footers #
|
||||
#########################
|
||||
info "---------------------------------------------"
|
||||
}
|
||||
################################################################################
|
||||
#### Function WriteFile ########################################################
|
||||
WriteFile() {
|
||||
##############
|
||||
# Read Input #
|
||||
##############
|
||||
LINTER="$1" # Name of the linter
|
||||
VERSION="$2" # Version returned from check
|
||||
|
||||
#################################
|
||||
# Write the data to output file #
|
||||
#################################
|
||||
echo "${LINTER}: ${VERSION}" >> "${VERSION_FILE}" 2>&1
|
||||
|
||||
#######################
|
||||
# Load the error code #
|
||||
#######################
|
||||
ERROR_CODE=$?
|
||||
|
||||
##############################
|
||||
# Check the shell for errors #
|
||||
##############################
|
||||
if [ $ERROR_CODE -ne 0 ]; then
|
||||
fatal "Failed to write data to file!"
|
||||
fi
|
||||
}
|
||||
################################################################################
|
||||
############################### MAIN ###########################################
|
||||
################################################################################
|
||||
|
||||
#######################
|
||||
# BuildLinterVersions #
|
||||
#######################
|
||||
BuildLinterVersions
|
Loading…
Reference in a new issue