diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2021-11-13 20:35:59 +0200 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2021-11-28 14:08:54 +0200 |
commit | a3f61676e83e908da67664c6163db61d1d11c5d2 (patch) | |
tree | 5ff45a8c5bc025f072cbd165f72de890b90a5dde | |
parent | 7f0f853373703a020529dd9394fca525475086b7 (diff) |
test: Make more shell scripts verifiable by the `shellcheck` tool
-rw-r--r-- | contrib/guix/libexec/prelude.bash | 4 | ||||
-rwxr-xr-x | test/lint/lint-shell.sh | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/contrib/guix/libexec/prelude.bash b/contrib/guix/libexec/prelude.bash index 40ae4b5208..1f287e9bbb 100644 --- a/contrib/guix/libexec/prelude.bash +++ b/contrib/guix/libexec/prelude.bash @@ -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 ################ diff --git a/test/lint/lint-shell.sh b/test/lint/lint-shell.sh index d697dfcbea..c8b88a777a 100755 --- a/test/lint/lint-shell.sh +++ b/test/lint/lint-shell.sh @@ -20,12 +20,13 @@ if ! command -v shellcheck > /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/(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 |