-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy path.clang-format
More file actions
99 lines (84 loc) · 2.24 KB
/
.clang-format
File metadata and controls
99 lines (84 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
---
BasedOnStyle: Google
Language: Cpp
ColumnLimit: 120
IndentWidth: 2
TabWidth: 2
UseTab: Never
MaxEmptyLinesToKeep: 1
Standard: c++17
# Pointers & References - ROS 2 style (spaces around * and &)
DerivePointerAlignment: false
PointerAlignment: Middle
ReferenceAlignment: Middle
# Spaces
SpaceBeforeParens: ControlStatements
SpacesInAngles: false
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
# Templates
AlwaysBreakTemplateDeclarations: Yes
# Binary/Ternary operators
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
# Constructor initializers (modern syntax - replaces deprecated options)
BreakConstructorInitializers: BeforeComma
ConstructorInitializerIndentWidth: 2
PackConstructorInitializers: NextLine
# Short statements
AllowShortBlocksOnASingleLine: Never
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortLambdasOnASingleLine: Empty
# Braces
InsertBraces: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
# Comments
AlignTrailingComments: true
SpacesBeforeTrailingComments: 2
ReflowComments: true
# Includes - ROS 2 friendly
SortIncludes: CaseSensitive
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<.*>'
Priority: 1
- Regex: '^"rclcpp/.*"'
Priority: 2
- Regex: '^".*"'
Priority: 3
# Qualifiers
QualifierAlignment: Custom
QualifierOrder: ['static', 'inline', 'constexpr', 'const', 'volatile', 'type']
# Modern C++ options
InsertNewlineAtEOF: true
SeparateDefinitionBlocks: Leave
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
# Alignment
AlignAfterOpenBracket: Align
AlignOperands: Align
AlignEscapedNewlines: Left
# Penalties (prefer breaking at certain places)
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60