mesa/.gitlab-ci/run-shellcheck.sh
Daniel Stone 2bac04aa4b 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 <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31602>
2024-10-20 11:32:42 +01:00

23 lines
505 B
Bash
Executable File

#!/usr/bin/env bash
SCRIPTS_DIR="$(realpath "$(dirname "$0")")"
is_bash() {
[[ $1 == *.sh ]] && return 0
[[ $1 == */bash-completion/* ]] && return 0
[[ $(file -b --mime-type "$1") == text/x-shellscript ]] && return 0
return 1
}
anyfailed=0
while IFS= read -r -d $'' file; do
if is_bash "$file" ; then
if ! shellcheck -x -W0 -s bash "$file"; then
anyfailed=1
fi
fi
done < <(find "$SCRIPTS_DIR" -type f \! -path "./.git/*" -print0)
exit "$anyfailed"