mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-25 02:01:02 -05:00
fix: don't add unnecessary empty lines (#5221)
This commit is contained in:
parent
ef9449e2b0
commit
eded42747b
5 changed files with 17 additions and 16 deletions
|
@ -379,7 +379,7 @@ ENV PATH="${PATH}:${DART_SDK}/bin:/root/.pub-cache/bin"
|
|||
|
||||
# Initialize Terrascan
|
||||
# Initialize ChkTeX config file
|
||||
RUN terrascan init \
|
||||
RUN terrascan init --log-level "debug" \
|
||||
&& touch ~/.chktexrc
|
||||
|
||||
ENTRYPOINT ["/action/lib/linter.sh"]
|
||||
|
|
|
@ -150,14 +150,14 @@ function BuildFileList() {
|
|||
|
||||
local RESULTS_OBJECT
|
||||
RESULTS_OBJECT=
|
||||
if ! RESULTS_OBJECT=$(jq -n '[inputs]' "${PARALLEL_RESULTS_FILE_PATH}"); then
|
||||
if ! RESULTS_OBJECT=$(jq --raw-output -n '[inputs]' "${PARALLEL_RESULTS_FILE_PATH}"); then
|
||||
fatal "Error loading results when building the file list: ${RESULTS_OBJECT}"
|
||||
fi
|
||||
debug "RESULTS_OBJECT for ${FILE_TYPE}:\n${RESULTS_OBJECT}"
|
||||
|
||||
local STDOUT_BUILD_FILE_LIST
|
||||
# Get raw output so we can strip quotes from the data we load
|
||||
if ! STDOUT_BUILD_FILE_LIST="$(jq --raw-output '.[].Stdout' <<<"${RESULTS_OBJECT}")"; then
|
||||
if ! STDOUT_BUILD_FILE_LIST="$(jq --raw-output '.[].Stdout[:-1]' <<<"${RESULTS_OBJECT}")"; then
|
||||
fatal "Error when loading stdout when building the file list: ${STDOUT_BUILD_FILE_LIST}"
|
||||
fi
|
||||
|
||||
|
@ -168,12 +168,12 @@ function BuildFileList() {
|
|||
fi
|
||||
|
||||
local STDERR_BUILD_FILE_LIST
|
||||
if ! STDERR_BUILD_FILE_LIST="$(jq --raw-output '.[].Stderr' <<<"${RESULTS_OBJECT}")"; then
|
||||
if ! STDERR_BUILD_FILE_LIST="$(jq --raw-output '.[].Stderr[:-1]' <<<"${RESULTS_OBJECT}")"; then
|
||||
fatal "Error when loading stderr when building the file list:\n${STDERR_BUILD_FILE_LIST}"
|
||||
fi
|
||||
|
||||
if [ -n "${STDERR_BUILD_FILE_LIST}" ]; then
|
||||
info "Command output when building the file list:\n------\n${STDERR_BUILD_FILE_LIST}\n------"
|
||||
info "Stderr when building the file list:\n------\n${STDERR_BUILD_FILE_LIST}\n------"
|
||||
else
|
||||
debug "Stderr when building the file list is empty"
|
||||
fi
|
||||
|
|
|
@ -173,7 +173,7 @@ function LintCodebase() {
|
|||
|
||||
local RESULTS_OBJECT
|
||||
RESULTS_OBJECT=
|
||||
if ! RESULTS_OBJECT=$(jq -n '[inputs]' "${PARALLEL_RESULTS_FILE_PATH}"); then
|
||||
if ! RESULTS_OBJECT=$(jq --raw-output -n '[inputs]' "${PARALLEL_RESULTS_FILE_PATH}"); then
|
||||
fatal "Error loading results for ${FILE_TYPE}: ${RESULTS_OBJECT}"
|
||||
fi
|
||||
debug "RESULTS_OBJECT for ${FILE_TYPE}:\n${RESULTS_OBJECT}"
|
||||
|
@ -187,8 +187,8 @@ function LintCodebase() {
|
|||
debug "Set INDEX for ${FILE_TYPE} to: ${INDEX}"
|
||||
|
||||
local STDOUT_LINTER
|
||||
# Get raw output so we can strip quotes from the data we load
|
||||
if ! STDOUT_LINTER="$(jq --raw-output '.[].Stdout' <<<"${RESULTS_OBJECT}")"; then
|
||||
# Get raw output so we can strip quotes from the data we load. Also, strip the final newline to avoid adding it two times
|
||||
if ! STDOUT_LINTER="$(jq --raw-output '.[].Stdout[:-1]' <<<"${RESULTS_OBJECT}")"; then
|
||||
fatal "Error when loading stdout for ${FILE_TYPE}:\n${STDOUT_LINTER}"
|
||||
fi
|
||||
|
||||
|
@ -199,12 +199,12 @@ function LintCodebase() {
|
|||
fi
|
||||
|
||||
local STDERR_LINTER
|
||||
if ! STDERR_LINTER="$(jq --raw-output '.[].Stderr' <<<"${RESULTS_OBJECT}")"; then
|
||||
if ! STDERR_LINTER="$(jq --raw-output '.[].Stderr[:-1]' <<<"${RESULTS_OBJECT}")"; then
|
||||
fatal "Error when loading stderr for ${FILE_TYPE}:\n${STDERR_LINTER}"
|
||||
fi
|
||||
|
||||
if [ -n "${STDERR_LINTER}" ]; then
|
||||
info "Command output for ${FILE_TYPE}:\n------\n${STDERR_LINTER}\n------"
|
||||
info "Stderr contents for ${FILE_TYPE}:\n------\n${STDERR_LINTER}\n------"
|
||||
else
|
||||
debug "Stderr for ${FILE_TYPE} is empty"
|
||||
fi
|
||||
|
|
|
@ -929,13 +929,13 @@ debug "PARALLEL_COMMAND_OUTPUT when running linters (exit code: ${PARALLEL_COMMA
|
|||
debug "Parallel output file (${PARALLEL_RESULTS_FILE_PATH}) contents when running linters:\n$(cat "${PARALLEL_RESULTS_FILE_PATH}")"
|
||||
|
||||
RESULTS_OBJECT=
|
||||
if ! RESULTS_OBJECT=$(jq -n '[inputs]' "${PARALLEL_RESULTS_FILE_PATH}"); then
|
||||
if ! RESULTS_OBJECT=$(jq --raw-output -n '[inputs]' "${PARALLEL_RESULTS_FILE_PATH}"); then
|
||||
fatal "Error loading results when building the file list: ${RESULTS_OBJECT}"
|
||||
fi
|
||||
debug "RESULTS_OBJECT when running linters:\n${RESULTS_OBJECT}"
|
||||
|
||||
# Get raw output so we can strip quotes from the data we load
|
||||
if ! STDOUT_LINTERS="$(jq --raw-output '.[].Stdout' <<<"${RESULTS_OBJECT}")"; then
|
||||
# Get raw output so we can strip quotes from the data we load. Also, strip the final newline to avoid adding it two times
|
||||
if ! STDOUT_LINTERS="$(jq --raw-output '.[].Stdout[:-1]' <<<"${RESULTS_OBJECT}")"; then
|
||||
fatal "Error when loading stdout when running linters:\n${STDOUT_LINTERS}"
|
||||
fi
|
||||
|
||||
|
@ -945,12 +945,12 @@ else
|
|||
debug "Stdout when running linters is empty"
|
||||
fi
|
||||
|
||||
if ! STDERR_LINTERS="$(jq --raw-output '.[].Stderr' <<<"${RESULTS_OBJECT}")"; then
|
||||
if ! STDERR_LINTERS="$(jq --raw-output '.[].Stderr[:-1]' <<<"${RESULTS_OBJECT}")"; then
|
||||
fatal "Error when loading stderr for ${FILE_TYPE}:\n${STDERR_LINTERS}"
|
||||
fi
|
||||
|
||||
if [ -n "${STDERR_LINTERS}" ]; then
|
||||
info "Command output for ${FILE_TYPE}:\n------\n${STDERR_LINTERS}\n------"
|
||||
info "Stderr when running linters:\n------\n${STDERR_LINTERS}\n------"
|
||||
else
|
||||
debug "Stderr when running linters is empty"
|
||||
fi
|
||||
|
|
|
@ -483,7 +483,8 @@ control "super-linter-validate-files" do
|
|||
"/action/lib/.automation/.yaml-lint.yml",
|
||||
"/action/lib/.automation/phpcs.xml",
|
||||
"/action/lib/.automation/phpstan.neon",
|
||||
"/action/lib/.automation/psalm.xml"
|
||||
"/action/lib/.automation/psalm.xml",
|
||||
"/root/.chktexrc"
|
||||
]
|
||||
|
||||
files.each do |item|
|
||||
|
|
Loading…
Reference in a new issue