fix: remove intro text from stdout and stderr (#6020)

- Remove introductory text from stdout and stderr files.
- Always create stdout and stderr files, not only when there are errors.
This commit is contained in:
Marco Ferrari 2024-08-14 18:16:44 +02:00 committed by GitHub
parent 48d5391b7b
commit 3d3274d18a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 22 deletions

View file

@ -209,16 +209,12 @@ function LintCodebase() {
fi
if [ -n "${STDOUT_LINTER}" ]; then
local STDOUT_LINTER_LOG_MESSAGE
STDOUT_LINTER_LOG_MESSAGE="Command output for ${FILE_TYPE}:\n------\n${STDOUT_LINTER}\n------"
info "${STDOUT_LINTER_LOG_MESSAGE}"
info "Command output for ${FILE_TYPE}:\n------\n${STDOUT_LINTER}\n------"
if [ ${PARALLEL_COMMAND_RETURN_CODE} -ne 0 ]; then
local STDOUT_LINTER_FILE_PATH
STDOUT_LINTER_FILE_PATH="${SUPER_LINTER_PRIVATE_OUTPUT_DIRECTORY_PATH}/super-linter-parallel-stdout-${FILE_TYPE}"
debug "Saving stdout for ${FILE_TYPE} to ${STDOUT_LINTER_FILE_PATH} in case we need it later"
printf '%s\n' "${STDOUT_LINTER_LOG_MESSAGE}" >"${STDOUT_LINTER_FILE_PATH}"
fi
local STDOUT_LINTER_FILE_PATH
STDOUT_LINTER_FILE_PATH="${SUPER_LINTER_PRIVATE_OUTPUT_DIRECTORY_PATH}/super-linter-parallel-stdout-${FILE_TYPE}"
debug "Saving stdout for ${FILE_TYPE} to ${STDOUT_LINTER_FILE_PATH} in case we need it later"
printf '%s\n' "${STDOUT_LINTER}" >"${STDOUT_LINTER_FILE_PATH}"
else
debug "Stdout for ${FILE_TYPE} is empty"
fi
@ -229,15 +225,12 @@ function LintCodebase() {
fi
if [ -n "${STDERR_LINTER}" ]; then
local STDERR_LINTER_LOG_MESSAGE
STDERR_LINTER_LOG_MESSAGE="Stderr contents for ${FILE_TYPE}:\n------\n${STDERR_LINTER}\n------"
info "${STDERR_LINTER_LOG_MESSAGE}"
if [ ${PARALLEL_COMMAND_RETURN_CODE} -ne 0 ]; then
local STDERR_LINTER_FILE_PATH
STDERR_LINTER_FILE_PATH="${SUPER_LINTER_PRIVATE_OUTPUT_DIRECTORY_PATH}/super-linter-parallel-stderr-${FILE_TYPE}"
debug "Saving stderr for ${FILE_TYPE} to ${STDERR_LINTER_FILE_PATH} in case we need it later"
printf '%s\n' "${STDERR_LINTER_LOG_MESSAGE}" >"${STDERR_LINTER_FILE_PATH}"
fi
info "Stderr contents for ${FILE_TYPE}:\n------\n${STDERR_LINTER}\n------"
local STDERR_LINTER_FILE_PATH
STDERR_LINTER_FILE_PATH="${SUPER_LINTER_PRIVATE_OUTPUT_DIRECTORY_PATH}/super-linter-parallel-stderr-${FILE_TYPE}"
debug "Saving stderr for ${FILE_TYPE} to ${STDERR_LINTER_FILE_PATH} in case we need it later"
printf '%s\n' "${STDERR_LINTER}" >"${STDERR_LINTER_FILE_PATH}"
else
debug "Stderr for ${FILE_TYPE} is empty"
fi

View file

@ -502,13 +502,13 @@ Footer() {
WriteSummaryLineFailure "${SUPER_LINTER_SUMMARY_OUTPUT_PATH}" "${LANGUAGE}"
fi
# Print output as error in case users disabled the INFO level so they
# get feedback
# Print stdout and stderr in case the log level is higher than INFO
# so users still get feedback. Print output as error so it gets emitted
if [[ "${LOG_VERBOSE}" != "true" ]]; then
local STDOUT_LINTER_FILE_PATH
STDOUT_LINTER_FILE_PATH="${SUPER_LINTER_PRIVATE_OUTPUT_DIRECTORY_PATH}/super-linter-parallel-stdout-${LANGUAGE}"
if [[ -e "${STDOUT_LINTER_FILE_PATH}" ]]; then
error "$(cat "${STDOUT_LINTER_FILE_PATH}")"
error "Stdout contents for ${LANGUAGE}:\n------\n$(cat "${STDOUT_LINTER_FILE_PATH}")\n------"
else
debug "Stdout output file path for ${LANGUAGE} (${STDOUT_LINTER_FILE_PATH}) doesn't exist"
fi
@ -516,7 +516,7 @@ Footer() {
local STDERR_LINTER_FILE_PATH
STDERR_LINTER_FILE_PATH="${SUPER_LINTER_PRIVATE_OUTPUT_DIRECTORY_PATH}/super-linter-parallel-stderr-${LANGUAGE}"
if [[ -e "${STDERR_LINTER_FILE_PATH}" ]]; then
error "$(cat "${STDERR_LINTER_FILE_PATH}")"
error "Stderr contents for ${LANGUAGE}:\n------\n$(cat "${STDERR_LINTER_FILE_PATH}")\n------"
else
debug "Stderr output file path for ${LANGUAGE} (${STDERR_LINTER_FILE_PATH}) doesn't exist"
fi