mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
f226e8dc1f
fae211c0ae0dd90876a3390eb21449b7b0bb45c4 lint: Start to use py lint scripts (MarcoFalke) fa82e890e7950fe5ba6d4fa88fcd922cc929dc47 Move lint script and data file to avoid lint- prefix (MarcoFalke) Pull request description: ACKs for top commit: fjahr: tACK fae211c0ae0dd90876a3390eb21449b7b0bb45c4 Tree-SHA512: f8272a1bab9efb8203cac121710baae68f01f79e520ad71ff15aa516d19763d61c088b411b019de105a6a30e7ee3c274814d59963f6ac22ba1084560fb601f45
45 lines
1.4 KiB
Bash
Executable File
45 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Copyright (c) 2018-2020 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"
|
|
"tfm::format,1" # Assuming tfm::::format(std::ostream&, ...
|
|
"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/run-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/(dashbls|leveldb|secp256k1|tinyformat|univalue|test/fuzz/strprintf.cpp)"); do
|
|
MATCHING_FILES+=("${MATCHING_FILE}")
|
|
done
|
|
if ! "test/lint/run-lint-format-strings.py" --skip-arguments "${SKIP_ARGUMENTS}" "${FUNCTION_NAME}" "${MATCHING_FILES[@]}"; then
|
|
EXIT_CODE=1
|
|
fi
|
|
done
|
|
exit ${EXIT_CODE}
|