clang-format: Set Bitcoin Core IncludeCategories
What changed, and why it matters
This commit only changes code-formatting rules and reorders one test file's #include lines accordingly. It has no effect on program behavior or security.
No security action needed; this is a routine code-style maintenance commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch updates src/.clang-format to define Bitcoin Core-specific include categories (e.g., bitcoin-build-config.h first, then boost/Qt, then system headers, then local headers) and applies that ordering to src/test/blockchain_tests.cpp. This is a pure style/tooling change with no functional code modifications.
Changed components
src/.clang-formatsrc/test/blockchain_tests.cppInspect captured patch +11 / −8
diff --git a/src/.clang-format b/src/.clang-format
index dd3f1070..bef63e64 100644
--- a/src/.clang-format
+++ b/src/.clang-format
@@ -99,17 +99,20 @@ IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Preserve
IncludeCategories:
- - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
+ - Regex: '^<bitcoin-build-config\.h>'
+ Priority: -1
+ CaseSensitive: true
+ - Regex: '^<boost/'
Priority: 2
- SortPriority: 0
- CaseSensitive: false
- - Regex: '^(<|"(gtest|gmock|isl|json)/)'
+ CaseSensitive: true
+ - Regex: '^<Q'
+ Priority: 2
+ CaseSensitive: true
+ - Regex: '^<[^>.]*>'
Priority: 3
- SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 1
- SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
diff --git a/src/test/blockchain_tests.cpp b/src/test/blockchain_tests.cpp
index 5da2841c..23556884 100644
--- a/src/test/blockchain_tests.cpp
+++ b/src/test/blockchain_tests.cpp
@@ -2,8 +2,6 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#include <boost/test/unit_test.hpp>
-
#include <chain.h>
#include <node/blockstorage.h>
#include <rpc/blockchain.h>
@@ -11,6 +9,8 @@
#include <test/util/setup_common.h>
#include <util/string.h>
+#include <boost/test/unit_test.hpp>
+
#include <cstdlib>
using util::ToString;
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.