mesa/.gitlab-ci/run-shellcheck.sh
Eric Engestrom 460c2eb967 ci: move shellcheck options to .shellcheckrc
That way, IDEs get to have the same behaviour as the CI

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31826>
2024-10-24 22:43:03 +00:00

23 lines
490 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 "$file"; then
anyfailed=1
fi
fi
done < <(find "$SCRIPTS_DIR" -type f \! -path "./.git/*" -print0)
exit "$anyfailed"