summaryrefslogtreecommitdiffstats
path: root/tools/shellcheck-all.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/shellcheck-all.sh')
-rwxr-xr-xtools/shellcheck-all.sh24
1 files changed, 22 insertions, 2 deletions
diff --git a/tools/shellcheck-all.sh b/tools/shellcheck-all.sh
index 34384a8afd..c1514c7197 100755
--- a/tools/shellcheck-all.sh
+++ b/tools/shellcheck-all.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2020-2021 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2020-2024 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -55,7 +55,27 @@ done
root_path=$(cd "$(dirname "${0}")/.." && pwd)
cd "${root_path}"
+# Disable shellcheck warnings:
+# SC1117: Backslash is literal in "\/". Prefer explicit escaping: "\\/".
+# SC2119: Use "$@" if function's $1 should mean script's $1.
+# SC2039: In POSIX sh, 'local' is undefined.
+# SC3043: In POSIX sh, 'local' is undefined.
+shellcheck_opts="--exclude=SC1117 --exclude=SC2119 --exclude=SC2039 --exclude=SC3043"
+
+files="$(find . -type f -name '*.sh' -or -name '*.sh.in' | sort)"
+
+# Add shell script files that don't end in .sh or .sh.in.
+for i in \
+ src/bin/admin/kea-admin.in \
+ src/bin/keactrl/keactrl.conf.in \
+ src/bin/keactrl/keactrl.in \
+; do
+ if test -f "${i}"; then
+ files="${files} ${i}"
+ fi
+done
+
# shellcheck disable=SC2046
# SC2046: Quote this to prevent word splitting.
# Reason: We explicitly want the parameters split.
-shellcheck $(grep -F 'SHELLCHECK_OPTS:' ./.gitlab-ci.yml | cut -d '"' -f 2 | xargs | sort -uV) $(grep -F 'SCRIPTS+=' ./.gitlab-ci.yml | cut -d '"' -f 2 | xargs | sort -uV)
+shellcheck ${shellcheck_opts} ${files}