Skip to content

Commit 407e25a

Browse files
committed
[build] Use clang-format's include sorting
1 parent 603a59f commit 407e25a

File tree

321 files changed

+667
-617
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

321 files changed

+667
-617
lines changed

.clang-format

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -104,25 +104,52 @@ ForEachMacros:
104104
- BOOST_FOREACH
105105
IfMacros:
106106
- KJ_IF_MAYBE
107-
IncludeBlocks: Regroup
107+
IncludeBlocks: Regroup
108108
IncludeCategories:
109-
- Regex: '^<ext/.*\.h>'
110-
Priority: 2
111-
SortPriority: 0
112-
CaseSensitive: false
113-
- Regex: '^<.*\.h>'
114-
Priority: 1
115-
SortPriority: 0
116-
CaseSensitive: false
117-
- Regex: '^<.*'
118-
Priority: 2
119-
SortPriority: 0
120-
CaseSensitive: false
121-
- Regex: '.*'
122-
Priority: 3
123-
SortPriority: 0
124-
CaseSensitive: false
125-
IncludeIsMainRegex: '([-_](test|unittest))?$'
109+
# C standard library headers
110+
#
111+
# https://en.cppreference.com/w/cpp/header:
112+
# * C compatibility headers
113+
# * Special C compatibility headers
114+
# * Empty C headers
115+
# * Meaningless C headers
116+
# * Unsupported C headers
117+
- Regex: '^<(assert\.h|ctype\.h|errno\.h|fenv\.h|float\.h|inttypes\.h|limits\.h|locale\.h|math\.h|setjmp\.h|signal\.h|stdarg\.h|stddef\.h|stdint\.h|stdio\.h|stdlib\.h|string\.h|time\.h|uchar\.h|wchar\.h|wctype\.h|stdatomic\.h|ccomplex|complex\.h|ctgmath|tgmath\.h|ciso646|cstdalign|cstdbool|iso646\.h|stdalign\.h|stdbool\.h|stdatomic\.h|stdnoreturn\.h|threads\.h)>'
118+
Priority: 1
119+
SortPriority: 0
120+
# Linux system headers
121+
- Regex: '^<((arpa\/|linux\/|net/|netinet\/|sys\/).*|arm_neon\.h|dirent\.h|dlfcn\.h|fcntl\.h|ifaddrs\.h|jni\.h|libgen\.h|poll\.h|spawn\.h|termios\.h|unistd\.h)>'
122+
Priority: 1
123+
SortPriority: 1
124+
# winsock2.h
125+
- Regex: '^<winsock2\.h>'
126+
Priority: 1
127+
SortPriority: 2
128+
# windows.h
129+
- Regex: '^<windows.\h>'
130+
Priority: 1
131+
SortPriority: 3
132+
# Windows def.h headers
133+
- Regex: '^<(comdef\.h|ws2def\.h|ws2ipdef\.h)>'
134+
Priority: 1
135+
SortPriority: 4
136+
# Windows system headers
137+
- Regex: '^<(dbghelp\.h|dbt\.h|delayimp\.h|dshow\.h|io\.h|iphlpapi\.h|ks\.h|ksmedia\.h|memoryapi\.h|mfapi\.h|mferror\.h|mfidl\.h|mfreadwrite\.h|netioapi\.h|shellapi\.h|shlwapi\.h|sysinfoapi\.h|windns\.h|windowsx\.h|ws2tcpip\.h)>'
138+
Priority: 1
139+
SortPriority: 5
140+
# C++ standard library headers (lowercase and underscores with no .h suffix)
141+
- Regex: '^<([a-z_]+|cxxabi\.h)>'
142+
Priority: 2
143+
SortPriority: 6
144+
# Other library headers (angle brackets)
145+
- Regex: '^<.*'
146+
Priority: 3
147+
SortPriority: 7
148+
# Project headers (double quotes)
149+
- Regex: '^".*'
150+
Priority: 4
151+
SortPriority: 8
152+
IncludeIsMainRegex: '(Test|_bench|_test)?$'
126153
IncludeIsMainSourceRegex: ''
127154
IndentAccessModifiers: false
128155
IndentCaseBlocks: false
@@ -213,7 +240,7 @@ RequiresClausePosition: OwnLine
213240
RequiresExpressionIndentation: OuterScope
214241
SeparateDefinitionBlocks: Leave
215242
ShortNamespaceLines: 1
216-
SortIncludes: false
243+
SortIncludes: true
217244
SortJavaStaticImport: Before
218245
SortUsingDeclarations: LexicographicNumeric
219246
SpaceAfterCStyleCast: false

.styleguide

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,3 @@ generatedFileExclude {
3535
repoRootNameOverride {
3636
wpilib
3737
}
38-
39-
includeOtherLibs {
40-
^Eigen/
41-
^cameraserver/
42-
^cscore
43-
^fmt/
44-
^glass/
45-
^gtest/
46-
^imgui
47-
^implot
48-
^mockdata/
49-
^opencv2/
50-
^support/
51-
^units/
52-
^unsupported/
53-
^upb/
54-
^vision/
55-
}

apriltag/src/main/native/cpp/jni/AprilTagJNI.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@
88
#include <cstring>
99

1010
#define WPI_RAWFRAME_JNI
11-
#include "wpi/util/RawFrame.h"
12-
#include "wpi/util/jni_util.hpp"
13-
1411
#include "org_wpilib_vision_apriltag_jni_AprilTagJNI.h"
1512
#include "wpi/apriltag/AprilTag.hpp"
1613
#include "wpi/apriltag/AprilTagDetector.hpp"
1714
#include "wpi/apriltag/AprilTagPoseEstimator.hpp"
15+
#include "wpi/util/RawFrame.h"
16+
#include "wpi/util/jni_util.hpp"
1817

1918
using namespace wpi::apriltag;
2019
using namespace wpi::util::java;

apriltag/src/test/native/cpp/AprilTagDetectorTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
// Open Source Software; you can modify and/or share it under the terms of
33
// the WPILib BSD license file in the root directory of this project.
44

5-
#include <gtest/gtest.h>
6-
75
#include "wpi/apriltag/AprilTagDetector.hpp"
86

7+
#include <gtest/gtest.h>
8+
99
using namespace wpi::apriltag;
1010

1111
TEST(AprilTagDetectorTest, ConfigDefaults) {

cameraserver/.styleguide

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@ repoRootNameOverride {
1212
cameraserver
1313
}
1414

15-
includeOtherLibs {
16-
^fmt/
17-
^gtest/
18-
^opencv2/
19-
^support/
20-
}
21-
2215
includeGuardRoots {
2316
cameraserver/src/main/native/include/
2417
}

commandsv2/.styleguide

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,3 @@ repoRootNameOverride {
1515
generatedFileExclude {
1616
commandsv2/src/generated/
1717
}
18-
19-
includeOtherLibs {
20-
^gtest/
21-
^imgui
22-
^mockdata/
23-
^networktables/
24-
^opencv2/
25-
^support/
26-
^units/
27-
^vision/
28-
}

commandsv2/src/main/native/cpp/frc2/command/ProxyCommand.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
#include "wpi/commands2/ProxyCommand.hpp"
66

7-
#include <fmt/format.h>
8-
97
#include <string>
108
#include <utility>
119

10+
#include <fmt/format.h>
11+
1212
#include "wpi/util/deprecated.hpp"
1313
#include "wpi/util/sendable/SendableBuilder.hpp"
1414

commandsv2/src/test/native/cpp/wpi/command/CommandPtrTest.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
// Open Source Software; you can modify and/or share it under the terms of
33
// the WPILib BSD license file in the root directory of this project.
44

5+
#include "wpi/commands2/CommandPtr.hpp"
6+
57
#include <utility>
68

79
#include "CommandTestBase.hpp"
8-
#include "wpi/commands2/CommandPtr.hpp"
910
#include "wpi/commands2/CommandScheduler.hpp"
1011
#include "wpi/commands2/Commands.hpp"
1112
#include "wpi/system/Errors.hpp"

commandsv2/src/test/native/cpp/wpi/command/ConditionalCommandTest.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
// Open Source Software; you can modify and/or share it under the terms of
33
// the WPILib BSD license file in the root directory of this project.
44

5+
#include "wpi/commands2/ConditionalCommand.hpp"
6+
57
#include <memory>
68
#include <utility>
79

810
#include "CommandTestBase.hpp"
911
#include "wpi/commands2/Commands.hpp"
10-
#include "wpi/commands2/ConditionalCommand.hpp"
1112
#include "wpi/commands2/InstantCommand.hpp"
1213

1314
using namespace wpi::cmd;

commandsv2/src/test/native/cpp/wpi/command/DeferredCommandTest.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
// Open Source Software; you can modify and/or share it under the terms of
33
// the WPILib BSD license file in the root directory of this project.
44

5+
#include "wpi/commands2/DeferredCommand.hpp"
6+
57
#include "CommandTestBase.hpp"
68
#include "wpi/commands2/Commands.hpp"
7-
#include "wpi/commands2/DeferredCommand.hpp"
89
#include "wpi/commands2/FunctionalCommand.hpp"
910

1011
using namespace wpi::cmd;

0 commit comments

Comments
 (0)