mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-29 16:29:31 +02:00
Merge bitcoin/bitcoin#26296: ci: Integrate bitcoin-tidy clang-tidy plugin
1c976c691ctidy: Integrate bicoin-tidy clang-tidy plugin (fanquake)7de23cceb8refactor: fix unterminated LogPrintf()s (fanquake)0a1029aa29lint: remove /* Continued */ markers from codebase (fanquake)910007995dlint: remove lint-logs.py (fanquake)d86a83d6b8lint: drop DIR_IWYU global (fanquake) Pull request description: Demo of integrating the [bitcoin-tidy](https://github.com/theuni/bitcoin-tidy-plugin), [clang-tidy plugin](https://clang.llvm.org/extra/clang-tidy/) written by theuni into our tidy CI job. The plugin currently has a single check, `bitcoin-unterminated-logprintf`. This would replace our current Python driven, `git-grep`-based, `.cpp` file only, lint-logs linter. ACKs for top commit: TheCharlatan: ACK1c976c691ctheuni: ACK1c976c691cMarcoFalke: re-ACK1c976c691c👠 Tree-SHA512: 725b45c70e431d48e6f276671e05c694e10b6047cae1a31906ac3ee9093bc8105fb226b36a5bac6709557526ca6007222112d66aecec05a574434edc4897e4b8
This commit is contained in:
@@ -77,7 +77,7 @@ def main():
|
||||
|
||||
matching_files_filtered = []
|
||||
for matching_file in matching_files:
|
||||
if not re.search('^src/(leveldb|secp256k1|minisketch|tinyformat|test/fuzz/strprintf.cpp)', matching_file):
|
||||
if not re.search('^src/(leveldb|secp256k1|minisketch|tinyformat|test/fuzz/strprintf.cpp)|contrib/devtools/bitcoin-tidy/example_logprintf.cpp', matching_file):
|
||||
matching_files_filtered.append(matching_file)
|
||||
matching_files_filtered.sort()
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@ from typing import List
|
||||
HEADER_ID_PREFIX = 'BITCOIN_'
|
||||
HEADER_ID_SUFFIX = '_H'
|
||||
|
||||
EXCLUDE_FILES_WITH_PREFIX = ['src/crypto/ctaes',
|
||||
EXCLUDE_FILES_WITH_PREFIX = ['contrib/devtools/bitcoin-tidy',
|
||||
'src/crypto/ctaes',
|
||||
'src/leveldb',
|
||||
'src/crc32c',
|
||||
'src/secp256k1',
|
||||
|
||||
@@ -15,7 +15,8 @@ import sys
|
||||
from subprocess import check_output, CalledProcessError
|
||||
|
||||
|
||||
EXCLUDED_DIRS = ["src/leveldb/",
|
||||
EXCLUDED_DIRS = ["contrib/devtools/bitcoin-tidy/",
|
||||
"src/leveldb/",
|
||||
"src/crc32c/",
|
||||
"src/secp256k1/",
|
||||
"src/minisketch/",
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright (c) 2018-2022 The Bitcoin Core developers
|
||||
# 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 */
|
||||
|
||||
import re
|
||||
import sys
|
||||
|
||||
from subprocess import check_output
|
||||
|
||||
|
||||
def main():
|
||||
logs_list = check_output(["git", "grep", "--extended-regexp", r"(LogPrintLevel|LogPrintfCategory|LogPrintf?)\(", "--", "*.cpp"], text=True, encoding="utf8").splitlines()
|
||||
|
||||
unterminated_logs = [line for line in logs_list if not re.search(r'(\\n"|/\* Continued \*/)', line)]
|
||||
|
||||
if unterminated_logs != []:
|
||||
print("All calls to LogPrintf(), LogPrintfCategory(), LogPrint(), LogPrintLevel(), and WalletLogPrintf() should be terminated with \"\\n\".")
|
||||
print("")
|
||||
|
||||
for line in unterminated_logs:
|
||||
print(line)
|
||||
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user