2018-06-20 11:54:54 +02:00
|
|
|
#!/usr/bin/env bash
|
2018-04-05 16:18:26 +02:00
|
|
|
#
|
2019-12-30 10:39:22 +01:00
|
|
|
# Copyright (c) 2018-2019 The Bitcoin Core developers
|
2018-04-05 16:18:26 +02:00
|
|
|
# Distributed under the MIT software license, see the accompanying
|
|
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#
|
|
|
|
# Check that all logs are terminated with '\n'
|
|
|
|
#
|
|
|
|
# Some logs are continued over multiple lines. They should be explicitly
|
|
|
|
# commented with \* Continued *\
|
|
|
|
#
|
|
|
|
# There are some instances of LogPrintf() in comments. Those can be
|
|
|
|
# ignored
|
|
|
|
|
2018-06-13 16:50:48 +02:00
|
|
|
export LC_ALL=C
|
2018-05-02 15:12:18 +02:00
|
|
|
UNTERMINATED_LOGS=$(git grep --extended-regexp "LogPrintf?\(" -- "*.cpp" | \
|
2018-04-05 16:18:26 +02:00
|
|
|
grep -v '\\n"' | \
|
2019-10-07 20:11:34 +02:00
|
|
|
grep -v '\.\.\.' | \
|
2018-04-05 16:18:26 +02:00
|
|
|
grep -v "/\* Continued \*/" | \
|
2018-05-02 15:12:18 +02:00
|
|
|
grep -v "LogPrint()" | \
|
2018-04-05 16:18:26 +02:00
|
|
|
grep -v "LogPrintf()")
|
|
|
|
if [[ ${UNTERMINATED_LOGS} != "" ]]; then
|
2019-07-02 18:48:08 +02:00
|
|
|
# shellcheck disable=SC2028
|
2018-05-02 15:12:18 +02:00
|
|
|
echo "All calls to LogPrintf() and LogPrint() should be terminated with \\n"
|
2018-04-05 16:18:26 +02:00
|
|
|
echo
|
|
|
|
echo "${UNTERMINATED_LOGS}"
|
|
|
|
exit 1
|
|
|
|
fi
|