test: Enable SC2046 shellcheck rule

This commit is contained in:
Hennadii Stepanov
2021-11-07 14:37:56 +02:00
parent 9a1ad7bc0d
commit fe0ff569ea
10 changed files with 17 additions and 13 deletions

View File

@@ -10,7 +10,6 @@ export LC_ALL=C
# Disabled warnings:
disabled=(
SC2046 # Quote this to prevent word splitting.
SC2162 # read without -r will mangle backslashes.
)
@@ -25,7 +24,8 @@ SHELLCHECK_CMD=(shellcheck --external-sources --check-sourced)
EXCLUDE="--exclude=$(IFS=','; echo "${disabled[*]}")"
# Check shellcheck directive used for sourced files
mapfile -t SOURCED_FILES < <(git ls-files | xargs gawk '/^# shellcheck shell=/ {print FILENAME} {nextfile}')
if ! "${SHELLCHECK_CMD[@]}" "$EXCLUDE" "${SOURCED_FILES[@]}" $(git ls-files -- '*.sh' | grep -vE 'src/(leveldb|secp256k1|minisketch|univalue)/'); then
mapfile -t FILES < <(git ls-files -- '*.sh' | grep -vE 'src/(leveldb|secp256k1|minisketch|univalue)/')
if ! "${SHELLCHECK_CMD[@]}" "$EXCLUDE" "${SOURCED_FILES[@]}" "${FILES[@]}"; then
EXIT_CODE=1
fi