Skip to content

Commit 38d7e6c

Browse files
Configure clang-format include ordering with IncludeCategories
Change IncludeBlocks from Preserve to Regroup and define priority categories to enforce consistent include ordering: global.hpp first, then standard library headers, then third-party headers, then project headers. 🤖 Commit message by [Claude Code](https://claude.com/claude-code)
1 parent 61773d1 commit 38d7e6c

6 files changed

Lines changed: 17 additions & 12 deletions

File tree

.clang-format

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
---
22
Standard: c++20
33
BasedOnStyle: Google
4-
IncludeBlocks: Preserve
4+
IncludeBlocks: Regroup
5+
IncludeCategories:
6+
- Regex: '^"global\.hpp"$'
7+
Priority: -1
8+
- Regex: '^<[a-z_]+>$'
9+
Priority: 2
10+
- Regex: '^<.*>$'
11+
Priority: 3
12+
- Regex: '^".*"$'
13+
Priority: 4
514
AttributeMacros:
615
- UNODB_DETAIL_UNUSED
716
- UNODB_DETAIL_USED_IN_DEBUG

art_internal.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55

66
// IWYU pragma: no_include <__ostream/basic_ostream.h>
77

8-
#include "art_internal.hpp" // IWYU pragma: keep
9-
10-
#include "art_common.hpp"
11-
128
#include <cstddef>
139
#include <iomanip>
1410
#include <iostream> // IWYU pragma: keep
1511

12+
#include "art_common.hpp"
13+
#include "art_internal.hpp" // IWYU pragma: keep
14+
1615
namespace unodb::detail {
1716

1817
[[gnu::cold]] UNODB_DETAIL_NOINLINE void dump_byte(std::ostream &os,

benchmark/micro_benchmark.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@
1515

1616
#include "art_common.hpp"
1717
#include "art_internal.hpp" // IWYU pragma: keep
18-
#include "node_type.hpp"
19-
2018
#include "micro_benchmark_node_utils.hpp"
2119
#include "micro_benchmark_utils.hpp"
20+
#include "node_type.hpp"
2221

2322
namespace {
2423

qsbr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
// IWYU pragma: no_include <__new/exceptions.h>
1515
// IWYU pragma: no_include <__hash_table>
1616

17-
#include "qsbr.hpp"
18-
1917
#include <atomic>
2018
#include <cstdint>
2119
#include <exception>
@@ -24,6 +22,8 @@
2422
#include <new> // IWYU pragma: keep
2523
#include <utility>
2624

25+
#include "qsbr.hpp"
26+
2727
#ifdef UNODB_DETAIL_WITH_STATS
2828
#include <mutex>
2929
#endif // UNODB_DETAIL_WITH_STATS

test/db_test_utils.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@
2828
#include <gmock/gmock.h>
2929
#include <gtest/gtest.h>
3030

31-
#include "gtest_utils.hpp"
32-
3331
#include "art.hpp"
3432
#include "art_common.hpp"
3533
#include "art_internal.hpp"
3634
#include "assert.hpp"
35+
#include "gtest_utils.hpp"
3736
#include "mutex_art.hpp"
3837
#include "node_type.hpp"
3938
#include "olc_art.hpp"

test/qsbr_gtest_utils.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include "qsbr_gtest_utils.hpp" // IWYU pragma: keep
77

88
#include "qsbr.hpp"
9-
109
#include "qsbr_test_utils.hpp"
1110

1211
namespace unodb::test {

0 commit comments

Comments
 (0)