From 2bac04aa4bee301f1140ffe4b938d1672f092522 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Thu, 17 Oct 2024 13:45:11 +0100 Subject: [PATCH] ci/shellcheck: Don't exit on first failure It's really tedious having to run shellcheck in a loop to find every failure; go through them all and print them all at once. Signed-off-by: Daniel Stone Part-of: --- .gitlab-ci/run-shellcheck.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci/run-shellcheck.sh b/.gitlab-ci/run-shellcheck.sh index a445b7b6693..79d8ab3597a 100755 --- a/.gitlab-ci/run-shellcheck.sh +++ b/.gitlab-ci/run-shellcheck.sh @@ -9,15 +9,14 @@ is_bash() { return 1 } +anyfailed=0 + while IFS= read -r -d $'' file; do if is_bash "$file" ; then - shellcheck -x -W0 -s bash "$file" - rc=$? - if [ "${rc}" -eq 0 ] - then - continue - else - exit 1 + if ! shellcheck -x -W0 -s bash "$file"; then + anyfailed=1 fi fi done < <(find "$SCRIPTS_DIR" -type f \! -path "./.git/*" -print0) + +exit "$anyfailed"