diff --git a/.arclint b/.arclint --- a/.arclint +++ b/.arclint @@ -15,6 +15,15 @@ "autopep8": { "type": "autopep8", "include": "(\\.py$)" + }, + "lint-format-strings": { + "type": "script-and-regex", + "include": "(^src/.*\\.(h|c|cpp)$)", + "exclude": [ + "(^src/(secp256k1|univalue|leveldb)/)" + ], + "script-and-regex.script": "test/lint/lint-format-strings.sh", + "script-and-regex.regex": "/^(?P.+): (?P.+)$/m" } } } diff --git a/test/lint/lint-format-strings.py b/test/lint/lint-format-strings.py --- a/test/lint/lint-format-strings.py +++ b/test/lint/lint-format-strings.py @@ -249,7 +249,7 @@ format_specifier_count = count_format_specifiers(format_str) if format_specifier_count != argument_count: exit_code = 1 - print("{}: Expected {} argument(s) after format string but found {} argument(s): {}".format( + print("{}: Expected {} argument(s) after format string but found {} argument(s) in {}".format( f.name, format_specifier_count, argument_count, relevant_function_call_str)) continue sys.exit(exit_code) diff --git a/test/lint/lint-format-strings.sh b/test/lint/lint-format-strings.sh --- a/test/lint/lint-format-strings.sh +++ b/test/lint/lint-format-strings.sh @@ -26,16 +26,13 @@ vsprintf,1 ) -EXIT_CODE=0 if ! python3 -m doctest test/lint/lint-format-strings.py; then - EXIT_CODE=1 + exit 1 fi for S in "${FUNCTION_NAMES_AND_NUMBER_OF_LEADING_ARGUMENTS[@]}"; do IFS="," read -r FUNCTION_NAME SKIP_ARGUMENTS <<< "${S}" - mapfile -t MATCHING_FILES < <(git grep --full-name -l "${FUNCTION_NAME}" -- "*.c" "*.cpp" "*.h" | sort | grep -vE "^src/(leveldb|secp256k1|tinyformat|univalue)") - if ! test/lint/lint-format-strings.py --skip-arguments "${SKIP_ARGUMENTS}" "${FUNCTION_NAME}" "${MATCHING_FILES[@]}"; then - EXIT_CODE=1 - fi + mapfile -t MATCHING_FILES < <(git grep --full-name -l "${FUNCTION_NAME}" -- ${1}) + test/lint/lint-format-strings.py --skip-arguments "${SKIP_ARGUMENTS}" "${FUNCTION_NAME}" "${MATCHING_FILES[@]}" done -exit ${EXIT_CODE} \ No newline at end of file +exit 0 \ No newline at end of file