This script will run ShellCheck on all files in the tree with the '.sh'
extension and return a non-zero exit code if any of the files has an
issue.
Change-Id: Ib65dcf1c9bd447a92a773284cc138ec0ed01444b
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11293
std-ext-lib.txt \
tools/format-cpp.sh \
tools/lint-py.sh \
+ tools/shellcheck.sh \
version
--- /dev/null
+#!/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