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

View file

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