commit 65587dd600ab5f510314dc659ef3fc2d862c8b9b
parent 755a8490018f051853c4628ca6a0c952c11edfdf
Author: Nick Mathewson <nickm@torproject.org>
Date: Tue, 18 Nov 2025 11:26:17 -0500
shellcheck: Add new exception for trap handlers
Formerly a function that was only used in a trap handler would trigger
SC2317 ("command appears to be unreachable").
Now it triggers SC2329 ("function never invoked").
Diffstat:
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/scripts/maint/code-format.sh b/scripts/maint/code-format.sh
@@ -162,7 +162,7 @@ if [[ $GITIDX = 1 ]]; then
git stash -q --keep-index
# For some reasons, shellcheck is not seeing that we can call this
# function from the trap below.
- # shellcheck disable=SC2317
+ # shellcheck disable=SC2317,SC2329
function restoregit() {
note "Restoring git state"
git stash pop -q
@@ -170,7 +170,7 @@ if [[ $GITIDX = 1 ]]; then
else
# For some reasons, shellcheck is not seeing that we can call this
# function from the trap below.
- # shellcheck disable=SC2317
+ # shellcheck disable=SC2317,SC2329
function restoregit() {
true
}
diff --git a/src/test/test_include.sh b/src/test/test_include.sh
@@ -50,7 +50,7 @@ fi
tmpdir=
# For some reasons, shellcheck is not seeing that we can call this
# function from the trap below.
-# shellcheck disable=SC2317
+# shellcheck disable=SC2317,SC2329
clean () {
if [ -n "$tmpdir" ] && [ -d "$tmpdir" ]; then
rm -rf "$tmpdir"
diff --git a/src/test/test_rebind.sh b/src/test/test_rebind.sh
@@ -48,7 +48,7 @@ fi
tmpdir=
# For some reasons, shellcheck is not seeing that we can call this
# function from the trap below.
-# shellcheck disable=SC2317
+# shellcheck disable=SC2317,SC2329
clean () {
if [ -n "$tmpdir" ] && [ -d "$tmpdir" ]; then
ls -l "$tmpdir"