-
Type:
Task
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Server Programmability
-
Fully Compatible
-
None
-
3
-
TBD
-
None
-
None
-
None
-
None
-
None
-
None
The main purpose of this change is to have clang-format handle the grouping of headers and the ordering of those groups. Our style guide currently requires that the headers follow the order:
- main header
- third-party headers
- first-party headers
However, many files don't follow that rule. Also clangd when it inserts headers will violate it. By turning on IncludeBlocks: Reorder clang-format will automatically handle this bit of formatting for us, and clangd will start putting the headers in the right places. Note that it will only reorder headers across blank lines: non-blank, non-include lines (including comments and other directives like #if or #undef) will act as barriers to reordering.
As part of this change we are switching to a new order:
- main header
- first-party headers
- c++ stdlib headers (no / and no . in path)
- unnamespaced headers (no / in path)
- remaining third-party headers
This is intended to make it both more likely to detect first-party headers that are missing includes, and makes it a bit easier to visually scan through the third-party headers.
- is related to
-
SERVER-102907 Consider leveraging new features of clang-format
-
- Open
-