mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-09 10:43:19 -05:00
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.
This commit is contained in:
parent
6c7e8f067d
commit
618cbd2c1a
2 changed files with 13 additions and 2 deletions
|
@ -1,3 +1,13 @@
|
||||||
|
# shellcheck shell=sh disable=SC2034 # Many variables set will be used in
|
||||||
|
# ./configure but shellcheck doesn't know
|
||||||
|
# that, hence: disable=SC2034
|
||||||
|
|
||||||
|
true # Dummy command because shellcheck treats all directives before first
|
||||||
|
# command as file-wide, and we only want to disable for one line.
|
||||||
|
#
|
||||||
|
# See: https://github.com/koalaman/shellcheck/wiki/Directive
|
||||||
|
|
||||||
|
# shellcheck disable=SC2154
|
||||||
depends_prefix="$(cd "$(dirname ${ac_site_file})/.." && pwd)"
|
depends_prefix="$(cd "$(dirname ${ac_site_file})/.." && pwd)"
|
||||||
|
|
||||||
cross_compiling=maybe
|
cross_compiling=maybe
|
||||||
|
@ -50,7 +60,7 @@ if test x@host_os@ = xdarwin; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PATH=$depends_prefix/native/bin:$PATH
|
PATH=$depends_prefix/native/bin:$PATH
|
||||||
PKG_CONFIG="`which pkg-config` --static"
|
PKG_CONFIG="$(which pkg-config) --static"
|
||||||
|
|
||||||
# These two need to remain exported because pkg-config does not see them
|
# These two need to remain exported because pkg-config does not see them
|
||||||
# otherwise. That means they must be unexported at the end of configure.ac to
|
# otherwise. That means they must be unexported at the end of configure.ac to
|
||||||
|
|
|
@ -36,7 +36,8 @@ fi
|
||||||
|
|
||||||
SHELLCHECK_CMD=(shellcheck --external-sources --check-sourced)
|
SHELLCHECK_CMD=(shellcheck --external-sources --check-sourced)
|
||||||
EXCLUDE="--exclude=$(IFS=','; echo "${disabled[*]}")"
|
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
|
EXIT_CODE=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue