mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
481254c86d
341f7c7b0e macOS fix: Check for correct version of flake8 to avoid spurious warnings. The brew installed flake8 version is Python 2 based and does not work. (practicalswift) 908a559f33 macOS fix: Add excludes for checks added in the newer shellcheck version installed by brew (practicalswift) ec4d57bbb3 macOS fix: Work around empty (sub)expression error when using BSD grep (practicalswift) b57d7d92fe macOS fix: Avoid mapfile due to ancient version of bash shipped with macOS (practicalswift) Pull request description: The linters are thoroughly tested under Ubuntu which is what we use in Travis. When reading #14041 I understood that some developers were experiencing problems when running the linters on their local machines. Assuming these local machines were running macOS I installed a fresh macOS VM, followed the instructions in `build-osx.md` and ran the linters. This PR contains the changes needed to make `lint-all.sh` run as expected. Ideally the linters would continuously run also under a Travis macOS environment to make sure we catch these kind of issues before merge. Tree-SHA512: b39c9a970d14d27db1fb592539923c0bc676b5217f415d02fda3f17bf54d46faa172376e8a3ecab07ca68a3acba9aebe00b2b1b2161b2a36b85fbb672e7efb5c
44 lines
1.3 KiB
Bash
Executable File
44 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Copyright (c) 2018 The Bitcoin Core developers
|
|
# Distributed under the MIT software license, see the accompanying
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
#
|
|
# Lint format strings: This program checks that the number of arguments passed
|
|
# to a variadic format string function matches the number of format specifiers
|
|
# in the format string.
|
|
|
|
export LC_ALL=C
|
|
|
|
FUNCTION_NAMES_AND_NUMBER_OF_LEADING_ARGUMENTS=(
|
|
FatalError,0
|
|
fprintf,1
|
|
LogConnectFailure,1
|
|
LogPrint,1
|
|
LogPrintf,0
|
|
printf,0
|
|
snprintf,2
|
|
sprintf,1
|
|
strprintf,0
|
|
vfprintf,1
|
|
vprintf,1
|
|
vsnprintf,1
|
|
vsprintf,1
|
|
WalletLogPrintf,0
|
|
)
|
|
|
|
EXIT_CODE=0
|
|
if ! python3 -m doctest test/lint/lint-format-strings.py; then
|
|
EXIT_CODE=1
|
|
fi
|
|
for S in "${FUNCTION_NAMES_AND_NUMBER_OF_LEADING_ARGUMENTS[@]}"; do
|
|
IFS="," read -r FUNCTION_NAME SKIP_ARGUMENTS <<< "${S}"
|
|
for MATCHING_FILE in $(git grep --full-name -l "${FUNCTION_NAME}" -- "*.c" "*.cpp" "*.h" | sort | grep -vE "^src/(leveldb|secp256k1|tinyformat|univalue)"); do
|
|
MATCHING_FILES+=("${MATCHING_FILE}")
|
|
done
|
|
if ! test/lint/lint-format-strings.py --skip-arguments "${SKIP_ARGUMENTS}" "${FUNCTION_NAME}" "${MATCHING_FILES[@]}"; then
|
|
EXIT_CODE=1
|
|
fi
|
|
done
|
|
exit ${EXIT_CODE}
|