Skip to content

Commit 588ea5d

Browse files
authored
Merge pull request kubernetes#76871 from cblecker/shellcheck-colour
Fix malformed JUNIT XML with shellcheck failures
2 parents a961c13 + 5236850 commit 588ea5d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

hack/verify-shellcheck.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ else
123123
fi
124124
fi
125125

126+
# if KUBE_JUNIT_REPORT_DIR is set, disable colorized output.
127+
# Colorized output causes malformed XML in the JUNIT report.
128+
SHELLCHECK_COLORIZED_OUTPUT="auto"
129+
if [[ -n "${KUBE_JUNIT_REPORT_DIR:-}" ]]; then
130+
SHELLCHECK_COLORIZED_OUTPUT="never"
131+
fi
132+
126133
# common arguments we'll pass to shellcheck
127134
SHELLCHECK_OPTIONS=(
128135
# allow following sourced files that are not specified in the command,
@@ -131,6 +138,8 @@ SHELLCHECK_OPTIONS=(
131138
"--external-sources"
132139
# include our disabled lints
133140
"--exclude=${SHELLCHECK_DISABLED}"
141+
# set colorized output
142+
"--color=${SHELLCHECK_COLORIZED_OUTPUT}"
134143
)
135144

136145
# lint each script, tracking failures

0 commit comments

Comments
 (0)