mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-28 09:01:09 -05:00
fix: export test_case_run (#5499)
- Export the TEST_CASE_RUN variable because subprocesses reference it when building the file list. - Remove a duplicate file that we didn't catch because Jscpd was not running due to the TEST_CASE_RUN variable not being exported. Fix #5483
This commit is contained in:
parent
25cb7af49d
commit
cb109f45f1
3 changed files with 2 additions and 92 deletions
|
@ -199,7 +199,7 @@ BuildFileArrays() {
|
|||
RAW_FILE_ARRAY=("$@")
|
||||
|
||||
debug "Categorizing the following files: ${RAW_FILE_ARRAY[*]}"
|
||||
debug "FILTER_REGEX_INCLUDE: ${FILTER_REGEX_INCLUDE}, FILTER_REGEX_EXCLUDE: ${FILTER_REGEX_EXCLUDE}"
|
||||
debug "FILTER_REGEX_INCLUDE: ${FILTER_REGEX_INCLUDE}, FILTER_REGEX_EXCLUDE: ${FILTER_REGEX_EXCLUDE}, TEST_CASE_RUN: ${TEST_CASE_RUN}"
|
||||
|
||||
ValidateBooleanVariable "IGNORE_GENERATED_FILES" "${IGNORE_GENERATED_FILES}"
|
||||
ValidateBooleanVariable "IGNORE_GITIGNORED_FILES" "${IGNORE_GITIGNORED_FILES}"
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
GetLinterVersions() {
|
||||
debug "WRITE_LINTER_VERSIONS_FILE: ${WRITE_LINTER_VERSIONS_FILE}"
|
||||
|
||||
if [ "${WRITE_LINTER_VERSIONS_FILE}" = "true" ]; then
|
||||
debug "Building linter version file: ${VERSION_FILE}"
|
||||
if BuildLinterVersions "${VERSION_FILE}" "${LINTER_NAMES_ARRAY[@]}"; then
|
||||
info "Linter version file built correctly."
|
||||
exit
|
||||
else
|
||||
fatal "Error while building the versions file."
|
||||
fi
|
||||
else
|
||||
debug "Skipping versions file build..."
|
||||
fi
|
||||
|
||||
if ! cat "${VERSION_FILE}"; then
|
||||
fatal "Failed to view version file: ${VERSION_FILE}"
|
||||
fi
|
||||
}
|
||||
################################################################################
|
||||
#### Function BuildLinterVersions ##############################################
|
||||
BuildLinterVersions() {
|
||||
VERSION_FILE="${1}" && shift
|
||||
LINTER_ARRAY=("$@")
|
||||
|
||||
# Start with an empty file. We might have built this file in a previous build
|
||||
# stage, so we start fresh here.
|
||||
rm -rfv "${VERSION_FILE}"
|
||||
|
||||
debug "Building linter version file ${VERSION_FILE} for the following linters: ${LINTER_ARRAY[*]}..."
|
||||
|
||||
##########################################################
|
||||
# Go through the array of linters and print version info #
|
||||
##########################################################
|
||||
for LINTER in "${LINTER_ARRAY[@]}"; do
|
||||
if [ -n "${LINTER}" ]; then
|
||||
|
||||
# Some linters need to account for special commands to get their version
|
||||
|
||||
if [[ ${LINTER} == "arm-ttk" ]]; then
|
||||
GET_VERSION_CMD="$(grep -iE 'version' "/usr/bin/arm-ttk" | xargs 2>&1)"
|
||||
# Some linters don't support a "get version" command
|
||||
elif [[ ${LINTER} == "bash-exec" ]] || [[ ${LINTER} == "gherkin-lint" ]]; then
|
||||
GET_VERSION_CMD="Version command not supported"
|
||||
elif [[ ${LINTER} == "checkstyle" ]] || [[ ${LINTER} == "google-java-format" ]]; then
|
||||
GET_VERSION_CMD="$(java -jar "/usr/bin/${LINTER}" --version 2>&1)"
|
||||
elif [[ ${LINTER} == "clippy" ]]; then
|
||||
GET_VERSION_CMD="$(cargo-clippy --version 2>&1)"
|
||||
elif [[ ${LINTER} == "editorconfig-checker" ]]; then
|
||||
GET_VERSION_CMD="$(${LINTER} -version)"
|
||||
elif [[ ${LINTER} == "kubeconform" ]]; then
|
||||
GET_VERSION_CMD="$(${LINTER} -v)"
|
||||
elif [[ ${LINTER} == "lintr" ]]; then
|
||||
# Need specific command for lintr (--slave is deprecated in R 4.0 and replaced by --no-echo)
|
||||
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} == "protolint" ]] || [[ ${LINTER} == "gitleaks" ]]; then
|
||||
GET_VERSION_CMD="$(${LINTER} version)"
|
||||
elif [[ ${LINTER} == "lua" ]]; then
|
||||
GET_VERSION_CMD="$("${LINTER}" -v 2>&1)"
|
||||
elif [[ ${LINTER} == "renovate-config-validator" ]]; then
|
||||
GET_VERSION_CMD="$(renovate --version 2>&1)"
|
||||
elif [[ ${LINTER} == "terrascan" ]]; then
|
||||
GET_VERSION_CMD="$("${LINTER}" version 2>&1)"
|
||||
else
|
||||
# Unset TF_LOG_LEVEL so that the version file doesn't contain debug log when running
|
||||
# commands that read TF_LOG_LEVEL or TFLINT_LOG, which are likely set to DEBUG when
|
||||
# building the versions file
|
||||
GET_VERSION_CMD="$(
|
||||
unset TF_LOG_LEVEL
|
||||
unset TFLINT_LOG
|
||||
"${LINTER}" --version 2>&1
|
||||
)"
|
||||
fi
|
||||
|
||||
ERROR_CODE=$?
|
||||
|
||||
if [ ${ERROR_CODE} -ne 0 ]; then
|
||||
fatal "[${LINTER}]: Failed to get version info. Exit code: ${ERROR_CODE}. Output: ${GET_VERSION_CMD}"
|
||||
else
|
||||
info "Successfully found version for ${LINTER}: ${GET_VERSION_CMD}"
|
||||
if ! echo "${LINTER}: ${GET_VERSION_CMD}" >>"${VERSION_FILE}" 2>&1; then
|
||||
fatal "Failed to write data to file!"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
|
@ -93,6 +93,7 @@ SUPPRESS_POSSUM="${SUPPRESS_POSSUM:-false}"
|
|||
declare -l TEST_CASE_RUN
|
||||
# Option to tell code to run only test cases
|
||||
TEST_CASE_RUN="${TEST_CASE_RUN:-"false"}"
|
||||
export TEST_CASE_RUN
|
||||
|
||||
# We want a lowercase value
|
||||
declare -l USE_FIND_ALGORITHM
|
||||
|
|
Loading…
Reference in a new issue