diff --git a/scripts/run-shellcheck.sh b/scripts/run-shellcheck.sh index 1e7dfd1..b458e46 100755 --- a/scripts/run-shellcheck.sh +++ b/scripts/run-shellcheck.sh @@ -44,8 +44,16 @@ filter_shell_scripts"' "$@"' # function that creates a separate JSON file if shellcheck detects anything wrap_shellcheck() { dst="${SC_RESULTS_DIR}/sc-$$.json" - (set -x && timeout "${SC_TIMEOUT}" shellcheck --format=json1 "$@" > "$dst") + + # This is a compatibility workaround for old versions of shellcheck + # that do not support `--format=json1`. + echo '{"comments":' > "$dst" + + (set -x && timeout "${SC_TIMEOUT}" shellcheck --format=json "$@" >> "$dst") EC=$? + + echo '}' >> "$dst" + case $EC in 0) # no findings detected -> remove the output file