-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.clang-format
More file actions
141 lines (129 loc) · 4.92 KB
/
.clang-format
File metadata and controls
141 lines (129 loc) · 4.92 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# .clang-format
# Google C++ Style Guide with Modern C++17 support
# Reference: https://google.github.io/styleguide/cppguide.html
# clang-format options: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
#
# Usage:
# clang-format -i <file> # Format single file
# ./scripts/format_all.sh # Format all files in project
Language: Cpp
BasedOnStyle: Google
Standard: c++17
# =============================================================================
# Indentation
# =============================================================================
IndentWidth: 2
TabWidth: 2
UseTab: Never
AccessModifierOffset: -1
IndentCaseLabels: true
IndentPPDirectives: None
IndentWrappedFunctionNames: false
NamespaceIndentation: None
# =============================================================================
# Line Width and Wrapping
# =============================================================================
ColumnLimit: 120
ContinuationIndentWidth: 4
# =============================================================================
# Braces and Blocks
# =============================================================================
BreakBeforeBraces: Attach
Cpp11BracedListStyle: true
# =============================================================================
# Alignment
# =============================================================================
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
# =============================================================================
# Short Statements (Single Line)
# =============================================================================
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
# =============================================================================
# Breaking Rules
# =============================================================================
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
# =============================================================================
# Spaces
# =============================================================================
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: true
SpacesInParentheses: false
SpacesInSquareBrackets: false
# =============================================================================
# Include Sorting (Google Style)
# =============================================================================
IncludeBlocks: Regroup
IncludeCategories:
# Main header (same name as .cpp file)
- Regex: '^"[^/]*\.(h|hpp)"$'
Priority: 1
# Project headers
- Regex: '^".*"$'
Priority: 2
# C++ wrappers for C headers
- Regex: '^<c(assert|ctype|errno|fenv|float|inttypes|limits|locale|math|setjmp|signal|stdarg|stddef|stdint|stdio|stdlib|string|time|uchar|wchar|wctype)>$'
Priority: 3
# C++ standard library headers
- Regex: '^<.*>$'
Priority: 4
SortIncludes: true
SortUsingDeclarations: true
# =============================================================================
# Pointers and References
# =============================================================================
DerivePointerAlignment: false
PointerAlignment: Left
# =============================================================================
# Namespace and Comments
# =============================================================================
CompactNamespaces: false
FixNamespaceComments: true
MaxEmptyLinesToKeep: 1
ReflowComments: true
CommentPragmas: '^ IWYU pragma:|^ NOLINT'
# =============================================================================
# Penalties (Line Breaking Decisions)
# =============================================================================
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200