aboutsummaryrefslogtreecommitdiff
path: root/test/lint
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2020-11-09 15:00:48 -0500
committerCarl Dong <contact@carldong.me>2020-11-09 16:58:27 -0500
commit618cbd2c1a630a60bed9212718dce78fe5f50108 (patch)
treef3889e6876c55fc98c96b86cadc10d2504a1e7e9 /test/lint
parent6c7e8f067dcf4c5d793d162aeb84f074f9a14664 (diff)
downloadbitcoin-618cbd2c1a630a60bed9212718dce78fe5f50108.tar.xz
lint: Also lint files with shellcheck directive
Files like config.site.in are not referenced by any other script in our tree, so we need to mark it manually with a "shellcheck shell=" directive and make sure that shellcheck is run on them.
Diffstat (limited to 'test/lint')
-rwxr-xr-xtest/lint/lint-shell.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/lint/lint-shell.sh b/test/lint/lint-shell.sh
index 9a26cd9c02..351b65dea6 100755
--- a/test/lint/lint-shell.sh
+++ b/test/lint/lint-shell.sh
@@ -36,7 +36,8 @@ fi
SHELLCHECK_CMD=(shellcheck --external-sources --check-sourced)
EXCLUDE="--exclude=$(IFS=','; echo "${disabled[*]}")"
-if ! "${SHELLCHECK_CMD[@]}" "$EXCLUDE" $(git ls-files -- '*.sh' | grep -vE 'src/(leveldb|secp256k1|univalue)/'); then
+SOURCED_FILES=$(git ls-files | xargs gawk '/^# shellcheck shell=/ {print FILENAME} {nextfile}') # Check shellcheck directive used for sourced files
+if ! "${SHELLCHECK_CMD[@]}" "$EXCLUDE" $SOURCED_FILES $(git ls-files -- '*.sh' | grep -vE 'src/(leveldb|secp256k1|univalue)/'); then
EXIT_CODE=1
fi