merge bitcoin#23506: Make more shell scripts verifiable by the shellcheck tool

This commit is contained in:
Kittywhiskers Van Gogh 2021-11-13 20:35:59 +02:00
parent 694c1a4582
commit 973ca7b46f
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
2 changed files with 5 additions and 4 deletions

View File

@ -2,10 +2,10 @@
export LC_ALL=C
set -e -o pipefail
# shellcheck source=../../shell/realpath.bash
# shellcheck source=contrib/shell/realpath.bash
source contrib/shell/realpath.bash
# shellcheck source=../../shell/git-utils.bash
# shellcheck source=contrib/shell/git-utils.bash
source contrib/shell/git-utils.bash
################

View File

@ -27,12 +27,13 @@ if ! command -v gawk > /dev/null; then
exit $EXIT_CODE
fi
SHELLCHECK_CMD=(shellcheck --external-sources --check-sourced)
SHELLCHECK_CMD=(shellcheck --external-sources --check-sourced --source-path=SCRIPTDIR)
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}')
mapfile -t GUIX_FILES < <(git ls-files contrib/guix contrib/shell | xargs gawk '/^#!\/usr\/bin\/env bash/ {print FILENAME} {nextfile}')
mapfile -t FILES < <(git ls-files -- '*.sh' | grep -vE 'src/(dashbls|immer|leveldb|secp256k1|minisketch|univalue)/')
if ! "${SHELLCHECK_CMD[@]}" "$EXCLUDE" "${SOURCED_FILES[@]}" "${FILES[@]}"; then
if ! "${SHELLCHECK_CMD[@]}" "$EXCLUDE" "${SOURCED_FILES[@]}" "${GUIX_FILES[@]}" "${FILES[@]}"; then
EXIT_CODE=1
fi