Merge #16327: scripts and tools: Update ShellCheck linter

1ac454a384 Enable ShellCheck rules (Hennadii Stepanov)

Pull request description:

  Enable some simple ShellCheck rules.

  Note for reviewers: `bash` and `shellcheck` on macOS are different from ones on Ubuntu.
  For local tests the latest `shellcheck` version 0.6.0 should be used (see #15166).

ACKs for top commit:
  practicalswift:
    utACK 1ac454a384
  dongcarl:
    utACK 1ac454a
  fanquake:
    ACK 1ac454a384

Tree-SHA512: 8d0a3a5c09fe1a0c22120178f5e6b80f81f746f8c3356b7701ff301c117acb2edea8fe08f08fb54ed73f94b1617515fb239fa28e7ab4121f74872e6494b6f20e
This commit is contained in:
fanquake 2019-07-05 09:00:44 +08:00
commit 1088b90cba
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1
17 changed files with 42 additions and 57 deletions

View file

@ -18,7 +18,7 @@ test/lint/check-doc.py
test/lint/check-rpc-mappings.py . test/lint/check-rpc-mappings.py .
test/lint/lint-all.sh test/lint/lint-all.sh
if [ "$TRAVIS_REPO_SLUG" = "bitcoin/bitcoin" -a "$TRAVIS_EVENT_TYPE" = "cron" ]; then if [ "$TRAVIS_REPO_SLUG" = "bitcoin/bitcoin" ] && [ "$TRAVIS_EVENT_TYPE" = "cron" ]; then
git log --merges --before="2 days ago" -1 --format='%H' > ./contrib/verify-commits/trusted-sha512-root-commit git log --merges --before="2 days ago" -1 --format='%H' > ./contrib/verify-commits/trusted-sha512-root-commit
travis_retry gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys $(<contrib/verify-commits/trusted-keys) && travis_retry gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys $(<contrib/verify-commits/trusted-keys) &&
./contrib/verify-commits/verify-commits.py --clean-merge=2; ./contrib/verify-commits/verify-commits.py --clean-merge=2;

View file

@ -10,10 +10,10 @@ DOCKER_EXEC echo \> \$HOME/.bitcoin # Make sure default datadir does not exist
mkdir -p depends/SDKs depends/sdk-sources mkdir -p depends/SDKs depends/sdk-sources
if [ -n "$OSX_SDK" -a ! -f depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz ]; then if [ -n "$OSX_SDK" ] && [ ! -f depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz ]; then
curl --location --fail $SDK_URL/MacOSX${OSX_SDK}.sdk.tar.gz -o depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz curl --location --fail $SDK_URL/MacOSX${OSX_SDK}.sdk.tar.gz -o depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz
fi fi
if [ -n "$OSX_SDK" -a -f depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz ]; then if [ -n "$OSX_SDK" ] && [ -f depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz ]; then
tar -C depends/SDKs -xf depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz tar -C depends/SDKs -xf depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz
fi fi
if [[ $HOST = *-mingw32 ]]; then if [[ $HOST = *-mingw32 ]]; then
@ -22,4 +22,3 @@ fi
if [ -z "$NO_DEPENDS" ]; then if [ -z "$NO_DEPENDS" ]; then
DOCKER_EXEC CONFIG_SHELL= make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS DOCKER_EXEC CONFIG_SHELL= make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS
fi fi

View file

@ -7,10 +7,10 @@ export LC_ALL=C
set -e set -e
srcdir="$(dirname $0)" srcdir="$(dirname $0)"
cd "$srcdir" cd "$srcdir"
if [ -z ${LIBTOOLIZE} ] && GLIBTOOLIZE="`which glibtoolize 2>/dev/null`"; then if [ -z ${LIBTOOLIZE} ] && GLIBTOOLIZE="$(command -v glibtoolize)"; then
LIBTOOLIZE="${GLIBTOOLIZE}" LIBTOOLIZE="${GLIBTOOLIZE}"
export LIBTOOLIZE export LIBTOOLIZE
fi fi
which autoreconf >/dev/null || \ command -v autoreconf >/dev/null || \
(echo "configuration failed, please install autoconf first" && exit 1) (echo "configuration failed, please install autoconf first" && exit 1)
autoreconf --install --force --warnings=all autoreconf --install --force --warnings=all

View file

@ -16,7 +16,7 @@ BITCOINQT=${BITCOINQT:-$BINDIR/qt/bitcoin-qt}
[ ! -x $BITCOIND ] && echo "$BITCOIND not found or not executable." && exit 1 [ ! -x $BITCOIND ] && echo "$BITCOIND not found or not executable." && exit 1
# The autodetected version git tag can screw up manpage output a little bit # The autodetected version git tag can screw up manpage output a little bit
BTCVER=($($BITCOINCLI --version | head -n1 | awk -F'[ -]' '{ print $6, $7 }')) read -r -a BTCVER <<< "$($BITCOINCLI --version | head -n1 | awk -F'[ -]' '{ print $6, $7 }')"
# Create a footer file with copyright content. # Create a footer file with copyright content.
# This gets autodetected fine for bitcoind if --version-string is not set, # This gets autodetected fine for bitcoind if --version-string is not set,

View file

@ -14,7 +14,7 @@ if [ -z "${1}" ]; then
fi fi
expand_path() { expand_path() {
echo "$(cd "${1}" && pwd -P)" cd "${1}" && pwd -P
} }
BDB_PREFIX="$(expand_path ${1})/db4"; shift; BDB_PREFIX="$(expand_path ${1})/db4"; shift;
@ -23,7 +23,7 @@ BDB_HASH='12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef'
BDB_URL="https://download.oracle.com/berkeley-db/${BDB_VERSION}.tar.gz" BDB_URL="https://download.oracle.com/berkeley-db/${BDB_VERSION}.tar.gz"
check_exists() { check_exists() {
which "$1" >/dev/null 2>&1 command -v "$1" >/dev/null
} }
sha256_check() { sha256_check() {
@ -95,7 +95,9 @@ make install
echo echo
echo "db4 build complete." echo "db4 build complete."
echo echo
# shellcheck disable=SC2016
echo 'When compiling bitcoind, run `./configure` in the following way:' echo 'When compiling bitcoind, run `./configure` in the following way:'
echo echo
echo " export BDB_PREFIX='${BDB_PREFIX}'" echo " export BDB_PREFIX='${BDB_PREFIX}'"
# shellcheck disable=SC2016
echo ' ./configure BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include" ...' echo ' ./configure BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include" ...'

View file

@ -36,13 +36,13 @@ if [ -z "${CODESIGN_ALLOCATE}" ]; then
fi fi
find ${TEMPDIR} -name "*.sign" | while read i; do find ${TEMPDIR} -name "*.sign" | while read i; do
SIZE=`stat -c %s "${i}"` SIZE=$(stat -c %s "${i}")
TARGET_FILE="`echo "${i}" | sed 's/\.sign$//'`" TARGET_FILE="$(echo "${i}" | sed 's/\.sign$//')"
echo "Allocating space for the signature of size ${SIZE} in ${TARGET_FILE}" echo "Allocating space for the signature of size ${SIZE} in ${TARGET_FILE}"
${CODESIGN_ALLOCATE} -i "${TARGET_FILE}" -a ${ARCH} ${SIZE} -o "${i}.tmp" ${CODESIGN_ALLOCATE} -i "${TARGET_FILE}" -a ${ARCH} ${SIZE} -o "${i}.tmp"
OFFSET=`${PAGESTUFF} "${i}.tmp" -p | tail -2 | grep offset | sed 's/[^0-9]*//g'` OFFSET=$(${PAGESTUFF} "${i}.tmp" -p | tail -2 | grep offset | sed 's/[^0-9]*//g')
if [ -z ${QUIET} ]; then if [ -z ${QUIET} ]; then
echo "Attaching signature at offset ${OFFSET}" echo "Attaching signature at offset ${OFFSET}"
fi fi

View file

@ -14,7 +14,7 @@ TEMPLIST=${TEMPDIR}/signatures.txt
OUT=signature-osx.tar.gz OUT=signature-osx.tar.gz
OUTROOT=osx OUTROOT=osx
if [ ! -n "$1" ]; then if [ -z "$1" ]; then
echo "usage: $0 <codesign args>" echo "usage: $0 <codesign args>"
echo "example: $0 -s MyIdentity" echo "example: $0 -s MyIdentity"
exit 1 exit 1
@ -26,20 +26,20 @@ mkdir -p ${TEMPDIR}
${CODESIGN} -f --file-list ${TEMPLIST} "$@" "${BUNDLE}" ${CODESIGN} -f --file-list ${TEMPLIST} "$@" "${BUNDLE}"
grep -v CodeResources < "${TEMPLIST}" | while read i; do grep -v CodeResources < "${TEMPLIST}" | while read i; do
TARGETFILE="${BUNDLE}/`echo "${i}" | sed "s|.*${BUNDLE}/||"`" TARGETFILE="${BUNDLE}/$(echo "${i}" | sed "s|.*${BUNDLE}/||")"
SIZE=`pagestuff "$i" -p | tail -2 | grep size | sed 's/[^0-9]*//g'` SIZE=$(pagestuff "$i" -p | tail -2 | grep size | sed 's/[^0-9]*//g')
OFFSET=`pagestuff "$i" -p | tail -2 | grep offset | sed 's/[^0-9]*//g'` OFFSET=$(pagestuff "$i" -p | tail -2 | grep offset | sed 's/[^0-9]*//g')
SIGNFILE="${TEMPDIR}/${OUTROOT}/${TARGETFILE}.sign" SIGNFILE="${TEMPDIR}/${OUTROOT}/${TARGETFILE}.sign"
DIRNAME="`dirname "${SIGNFILE}"`" DIRNAME="$(dirname "${SIGNFILE}")"
mkdir -p "${DIRNAME}" mkdir -p "${DIRNAME}"
echo "Adding detached signature for: ${TARGETFILE}. Size: ${SIZE}. Offset: ${OFFSET}" echo "Adding detached signature for: ${TARGETFILE}. Size: ${SIZE}. Offset: ${OFFSET}"
dd if="$i" of="${SIGNFILE}" bs=1 skip=${OFFSET} count=${SIZE} 2>/dev/null dd if="$i" of="${SIGNFILE}" bs=1 skip=${OFFSET} count=${SIZE} 2>/dev/null
done done
grep CodeResources < "${TEMPLIST}" | while read i; do grep CodeResources < "${TEMPLIST}" | while read i; do
TARGETFILE="${BUNDLE}/`echo "${i}" | sed "s|.*${BUNDLE}/||"`" TARGETFILE="${BUNDLE}/$(echo "${i}" | sed "s|.*${BUNDLE}/||")"
RESOURCE="${TEMPDIR}/${OUTROOT}/${TARGETFILE}" RESOURCE="${TEMPDIR}/${OUTROOT}/${TARGETFILE}"
DIRNAME="`dirname "${RESOURCE}"`" DIRNAME="$(dirname "${RESOURCE}")"
mkdir -p "${DIRNAME}" mkdir -p "${DIRNAME}"
echo "Adding resource for: \"${TARGETFILE}\"" echo "Adding resource for: \"${TARGETFILE}\""
cp "${i}" "${RESOURCE}" cp "${i}" "${RESOURCE}"

View file

@ -33,7 +33,7 @@ tc class add dev ${IF} parent 1:1 classid 1:11 htb rate ${LIMIT} ceil ${LIMIT} p
tc filter add dev ${IF} parent 1: protocol ip prio 1 handle 1 fw classid 1:10 tc filter add dev ${IF} parent 1: protocol ip prio 1 handle 1 fw classid 1:10
tc filter add dev ${IF} parent 1: protocol ip prio 2 handle 2 fw classid 1:11 tc filter add dev ${IF} parent 1: protocol ip prio 2 handle 2 fw classid 1:11
if [ ! -z "${LOCALNET_V6}" ] ; then if [ -n "${LOCALNET_V6}" ] ; then
# v6 cannot have the same priority value as v4 # v6 cannot have the same priority value as v4
tc filter add dev ${IF} parent 1: protocol ipv6 prio 3 handle 1 fw classid 1:10 tc filter add dev ${IF} parent 1: protocol ipv6 prio 3 handle 1 fw classid 1:10
tc filter add dev ${IF} parent 1: protocol ipv6 prio 4 handle 2 fw classid 1:11 tc filter add dev ${IF} parent 1: protocol ipv6 prio 4 handle 2 fw classid 1:11
@ -56,7 +56,7 @@ fi
iptables -t mangle -A OUTPUT -p tcp -m tcp --dport 8333 ! -d ${LOCALNET_V4} -j MARK --set-mark 0x2 iptables -t mangle -A OUTPUT -p tcp -m tcp --dport 8333 ! -d ${LOCALNET_V4} -j MARK --set-mark 0x2
iptables -t mangle -A OUTPUT -p tcp -m tcp --sport 8333 ! -d ${LOCALNET_V4} -j MARK --set-mark 0x2 iptables -t mangle -A OUTPUT -p tcp -m tcp --sport 8333 ! -d ${LOCALNET_V4} -j MARK --set-mark 0x2
if [ ! -z "${LOCALNET_V6}" ] ; then if [ -n "${LOCALNET_V6}" ] ; then
ip6tables -t mangle -A OUTPUT -p tcp -m tcp --dport 8333 ! -d ${LOCALNET_V6} -j MARK --set-mark 0x4 ip6tables -t mangle -A OUTPUT -p tcp -m tcp --dport 8333 ! -d ${LOCALNET_V6} -j MARK --set-mark 0x4
ip6tables -t mangle -A OUTPUT -p tcp -m tcp --sport 8333 ! -d ${LOCALNET_V6} -j MARK --set-mark 0x4 ip6tables -t mangle -A OUTPUT -p tcp -m tcp --sport 8333 ! -d ${LOCALNET_V6} -j MARK --set-mark 0x4
fi fi

View file

@ -21,7 +21,7 @@ else
# they've created a collision for. Not the most likely attack, but preventing # they've created a collision for. Not the most likely attack, but preventing
# it is pretty easy so we do so as a "belt-and-suspenders" measure. # it is pretty easy so we do so as a "belt-and-suspenders" measure.
GPG_RES="" GPG_RES=""
for LINE in "$(gpg --version)"; do for LINE in $(gpg --version); do
case "$LINE" in case "$LINE" in
"gpg (GnuPG) 1.4.1"*|"gpg (GnuPG) 2.0."*) "gpg (GnuPG) 1.4.1"*|"gpg (GnuPG) 2.0."*)
echo "Please upgrade to at least gpg 2.1.10 to check for weak signatures" > /dev/stderr echo "Please upgrade to at least gpg 2.1.10 to check for weak signatures" > /dev/stderr
@ -35,7 +35,7 @@ else
done done
[ "$GPG_RES" = "" ] && GPG_RES="$(printf '%s\n' "$INPUT" | gpg --trust-model always --weak-digest sha1 "$@" 2>/dev/null)" [ "$GPG_RES" = "" ] && GPG_RES="$(printf '%s\n' "$INPUT" | gpg --trust-model always --weak-digest sha1 "$@" 2>/dev/null)"
fi fi
for LINE in $(echo "$GPG_RES"); do for LINE in $GPG_RES; do
case "$LINE" in case "$LINE" in
"[GNUPG:] VALIDSIG "*) "[GNUPG:] VALIDSIG "*)
while read KEY; do while read KEY; do

View file

@ -13,7 +13,7 @@
export LC_ALL=C export LC_ALL=C
function clean_up { function clean_up {
for file in $* for file in "$@"
do do
rm "$file" 2> /dev/null rm "$file" 2> /dev/null
done done
@ -82,22 +82,20 @@ else
exit 2 exit 2
fi fi
#first we fetch the file containing the signature if ! WGETOUT=$(wget -N "$HOST1$BASEDIR$SIGNATUREFILENAME" 2>&1); then
WGETOUT=$(wget -N "$HOST1$BASEDIR$SIGNATUREFILENAME" 2>&1)
#and then see if wget completed successfully
if [ $? -ne 0 ]; then
echo "Error: couldn't fetch signature file. Have you specified the version number in the following format?" echo "Error: couldn't fetch signature file. Have you specified the version number in the following format?"
# shellcheck disable=SC1087
echo "[$VERSIONPREFIX]<version>-[$RCVERSIONSTRING[0-9]] (example: ${VERSIONPREFIX}0.10.4-${RCVERSIONSTRING}1)" echo "[$VERSIONPREFIX]<version>-[$RCVERSIONSTRING[0-9]] (example: ${VERSIONPREFIX}0.10.4-${RCVERSIONSTRING}1)"
echo "wget output:" echo "wget output:"
# shellcheck disable=SC2001
echo "$WGETOUT"|sed 's/^/\t/g' echo "$WGETOUT"|sed 's/^/\t/g'
exit 2 exit 2
fi fi
WGETOUT=$(wget -N -O "$SIGNATUREFILENAME.2" "$HOST2$BASEDIR$SIGNATUREFILENAME" 2>&1) if ! WGETOUT=$(wget -N -O "$SIGNATUREFILENAME.2" "$HOST2$BASEDIR$SIGNATUREFILENAME" 2>&1); then
if [ $? -ne 0 ]; then
echo "bitcoin.org failed to provide signature file, but bitcoincore.org did?" echo "bitcoin.org failed to provide signature file, but bitcoincore.org did?"
echo "wget output:" echo "wget output:"
# shellcheck disable=SC2001
echo "$WGETOUT"|sed 's/^/\t/g' echo "$WGETOUT"|sed 's/^/\t/g'
clean_up $SIGNATUREFILENAME clean_up $SIGNATUREFILENAME
exit 3 exit 3
@ -128,6 +126,7 @@ if [ $RET -ne 0 ]; then
fi fi
echo "gpg output:" echo "gpg output:"
# shellcheck disable=SC2001
echo "$GPGOUT"|sed 's/^/\t/g' echo "$GPGOUT"|sed 's/^/\t/g'
clean_up $SIGNATUREFILENAME $SIGNATUREFILENAME.2 $TMPFILE clean_up $SIGNATUREFILENAME $SIGNATUREFILENAME.2 $TMPFILE
exit "$RET" exit "$RET"

View file

@ -8,7 +8,7 @@ if [ -z "$OSSLSIGNCODE" ]; then
OSSLSIGNCODE=osslsigncode OSSLSIGNCODE=osslsigncode
fi fi
if [ ! -n "$1" ]; then if [ -z "$1" ]; then
echo "usage: $0 <osslcodesign args>" echo "usage: $0 <osslcodesign args>"
echo "example: $0 -key codesign.key" echo "example: $0 -key codesign.key"
exit 1 exit 1
@ -23,7 +23,7 @@ TIMESERVER=http://timestamp.comodoca.com
CERTFILE="win-codesign.cert" CERTFILE="win-codesign.cert"
mkdir -p "${OUTSUBDIR}" mkdir -p "${OUTSUBDIR}"
basename -a `ls -1 "${SRCDIR}"/*-unsigned.exe` | while read UNSIGNED; do basename -a $(ls -1 "${SRCDIR}"/*-unsigned.exe) | while read UNSIGNED; do
echo Signing "${UNSIGNED}" echo Signing "${UNSIGNED}"
"${OSSLSIGNCODE}" sign -certs "${CERTFILE}" -t "${TIMESERVER}" -in "${SRCDIR}/${UNSIGNED}" -out "${WORKDIR}/${UNSIGNED}" "$@" "${OSSLSIGNCODE}" sign -certs "${CERTFILE}" -t "${TIMESERVER}" -in "${SRCDIR}/${UNSIGNED}" -out "${WORKDIR}/${UNSIGNED}" "$@"
"${OSSLSIGNCODE}" extract-signature -pem -in "${WORKDIR}/${UNSIGNED}" -out "${OUTSUBDIR}/${UNSIGNED}.pem" && rm "${WORKDIR}/${UNSIGNED}" "${OSSLSIGNCODE}" extract-signature -pem -in "${WORKDIR}/${UNSIGNED}" -out "${OUTSUBDIR}/${UNSIGNED}.pem" && rm "${WORKDIR}/${UNSIGNED}"

View file

@ -24,7 +24,7 @@ git_check_in_repo() {
DESC="" DESC=""
SUFFIX="" SUFFIX=""
if [ "${BITCOIN_GENBUILD_NO_GIT}" != "1" -a -e "$(which git 2>/dev/null)" -a "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ] && git_check_in_repo share/genbuild.sh; then if [ "${BITCOIN_GENBUILD_NO_GIT}" != "1" ] && [ -e "$(command -v git)" ] && [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ] && git_check_in_repo share/genbuild.sh; then
# clean 'dirty' status of touched files that haven't been modified # clean 'dirty' status of touched files that haven't been modified
git diff >/dev/null 2>/dev/null git diff >/dev/null 2>/dev/null

View file

@ -9,6 +9,6 @@ FRAMEDIR=$(dirname $0)
for i in {0..35} for i in {0..35}
do do
frame=$(printf "%03d" $i) frame=$(printf "%03d" $i)
angle=$(($i * 10)) angle=$((i * 10))
convert $FRAMEDIR/../src/spinner.png -background "rgba(0,0,0,0.0)" -distort SRT $angle $FRAMEDIR/spinner-$frame.png convert $FRAMEDIR/../src/spinner.png -background "rgba(0,0,0,0.0)" -distort SRT $angle $FRAMEDIR/spinner-$frame.png
done done

View file

@ -18,12 +18,12 @@ if test "x$1" = "x"; then
fi fi
RET=0 RET=0
PREV_BRANCH=`git name-rev --name-only HEAD` PREV_BRANCH=$(git name-rev --name-only HEAD)
PREV_HEAD=`git rev-parse HEAD` PREV_HEAD=$(git rev-parse HEAD)
for commit in `git rev-list --reverse $1`; do for commit in $(git rev-list --reverse $1); do
if git rev-list -n 1 --pretty="%s" $commit | grep -q "^scripted-diff:"; then if git rev-list -n 1 --pretty="%s" $commit | grep -q "^scripted-diff:"; then
git checkout --quiet $commit^ || exit git checkout --quiet $commit^ || exit
SCRIPT="`git rev-list --format=%b -n1 $commit | sed '/^-BEGIN VERIFY SCRIPT-$/,/^-END VERIFY SCRIPT-$/{//!b};d'`" SCRIPT="$(git rev-list --format=%b -n1 $commit | sed '/^-BEGIN VERIFY SCRIPT-$/,/^-END VERIFY SCRIPT-$/{//!b};d')"
if test "x$SCRIPT" = "x"; then if test "x$SCRIPT" = "x"; then
echo "Error: missing script for: $commit" echo "Error: missing script for: $commit"
echo "Failed" echo "Failed"

View file

@ -39,7 +39,7 @@ CIRCULAR_DEPENDENCIES=()
IFS=$'\n' IFS=$'\n'
for CIRC in $(cd src && ../contrib/devtools/circular-dependencies.py {*,*/*,*/*/*}.{h,cpp} | sed -e 's/^Circular dependency: //'); do for CIRC in $(cd src && ../contrib/devtools/circular-dependencies.py {*,*/*,*/*/*}.{h,cpp} | sed -e 's/^Circular dependency: //'); do
CIRCULAR_DEPENDENCIES+=($CIRC) CIRCULAR_DEPENDENCIES+=( "$CIRC" )
IS_EXPECTED_CIRC=0 IS_EXPECTED_CIRC=0
for EXPECTED_CIRC in "${EXPECTED_CIRCULAR_DEPENDENCIES[@]}"; do for EXPECTED_CIRC in "${EXPECTED_CIRCULAR_DEPENDENCIES[@]}"; do
if [[ "${CIRC}" == "${EXPECTED_CIRC}" ]]; then if [[ "${CIRC}" == "${EXPECTED_CIRC}" ]]; then

View file

@ -19,6 +19,7 @@ UNTERMINATED_LOGS=$(git grep --extended-regexp "LogPrintf?\(" -- "*.cpp" | \
grep -v "LogPrint()" | \ grep -v "LogPrint()" | \
grep -v "LogPrintf()") grep -v "LogPrintf()")
if [[ ${UNTERMINATED_LOGS} != "" ]]; then if [[ ${UNTERMINATED_LOGS} != "" ]]; then
# shellcheck disable=SC2028
echo "All calls to LogPrintf() and LogPrint() should be terminated with \\n" echo "All calls to LogPrintf() and LogPrint() should be terminated with \\n"
echo echo
echo "${UNTERMINATED_LOGS}" echo "${UNTERMINATED_LOGS}"

View file

@ -23,25 +23,9 @@ fi
# Disabled warnings: # Disabled warnings:
disabled=( disabled=(
SC1087 # Use braces when expanding arrays, e.g. ${array[idx]} (or ${var}[.. to quiet).
SC2001 # See if you can use ${variable//search/replace} instead.
SC2004 # $/${} is unnecessary on arithmetic variables.
SC2005 # Useless echo? Instead of 'echo $(cmd)', just use 'cmd'.
SC2006 # Use $(..) instead of legacy `..`.
SC2016 # Expressions don't expand in single quotes, use double quotes for that.
SC2028 # echo won't expand escape sequences. Consider printf.
SC2046 # Quote this to prevent word splitting. SC2046 # Quote this to prevent word splitting.
SC2048 # Use "$@" (with quotes) to prevent whitespace problems.
SC2066 # Since you double quoted this, it will not word split, and the loop will only run once.
SC2086 # Double quote to prevent globbing and word splitting. SC2086 # Double quote to prevent globbing and word splitting.
SC2116 # Useless echo? Instead of 'cmd $(echo foo)', just use 'cmd foo'.
SC2162 # read without -r will mangle backslashes. SC2162 # read without -r will mangle backslashes.
SC2166 # Prefer [ p ] {&&,||} [ q ] as [ p -{a,o} q ] is not well defined.
SC2181 # Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.
SC2206 # Quote to prevent word splitting, or split robustly with mapfile or read -a.
SC2207 # Prefer mapfile or read -a to split command output (or quote to avoid splitting).
SC2230 # which is non-standard. Use builtin 'command -v' instead.
SC2236 # Don't force -n instead of ! -z.
) )
shellcheck -e "$(IFS=","; echo "${disabled[*]}")" \ shellcheck -e "$(IFS=","; echo "${disabled[*]}")" \
$(git ls-files -- "*.sh" | grep -vE 'src/(secp256k1|univalue)/') $(git ls-files -- "*.sh" | grep -vE 'src/(secp256k1|univalue)/')