tools: Add shellcheck.sh
[babeltrace.git] / tools / shellcheck.sh
diff --git a/tools/shellcheck.sh b/tools/shellcheck.sh
new file mode 100755 (executable)
index 0000000..6cf23b3
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/bash
+#
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# SPDX-FileCopyrightText: 2023 Michael Jeanson <mjeanson@efficios.com>
+
+set -eu
+
+retcode=0
+
+while read -r script_file; do
+       echo "Running ShellCheck on \`$script_file\`"
+       pushd "${script_file%/*}" >/dev/null
+       shellcheck -x "${script_file##*/}" || retcode=$?
+       popd >/dev/null
+done <<< "$(find . -type f -name '*.sh' \
+       ! -path './.git/*' \
+        ! -path ./config/ltmain.sh \
+       ! -path ./tests/utils/tap-driver.sh \
+       ! -path ./tests/utils/tap/tap.sh)"
+
+exit $retcode
This page took 0.023022 seconds and 4 git commands to generate.