forked from JohanCDev/Bomberman
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.clang-format
199 lines (147 loc) · 5.53 KB
/
.clang-format
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
#===========================================================================#
# Language (C/C++) #
#===========================================================================#
Language: Cpp
#===========================================================================#
# Column limit and wrapping rules #
#===========================================================================#
# Rules: #
# + F3 #
# + L3 #
# + L4 #
#--------#
# F3 - Maximum columns count
ColumnLimit: 120
# F3 - Column limit wrapping for comments
ReflowComments: true
# L3 - Prevent alignment of wrapped names to avoid misplaced spaces
AlignAfterOpenBracket: DontAlign
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
IndentWrappedFunctionNames: false
BinPackArguments: true
BinPackParameters: true
AlignOperands: false
# L4 - Brace wrapping
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: true
AfterStruct: false
AfterUnion: false
AfterExternBlock: true
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
# Don't break after return type
AlwaysBreakAfterReturnType: None
#===========================================================================#
# Indentation and spaces #
#===========================================================================#
# Rules: #
# + L2 #
# + L3 #
# + G3 #
#--------#
# L2 - Indent width and indent character
TabWidth: 4
IndentWidth: 4
ContinuationIndentWidth: 4
UseTab: Never
# G3 - Preprocessor
IndentPPDirectives: BeforeHash
# L3 - Declarations and assignments
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
# L3 - Disable spaces after '{' and before '}' in lists
Cpp11BracedListStyle: true
# L3 - Place '*' and '&' next to the name of the variable
PointerAlignment: Right
# L3 - Space after a cast, but not in its parentheses
SpacesInCStyleCastParentheses: false
SpaceAfterCStyleCast: false
# L3 - Space after logical not '!' (it's an unary operator)
SpaceAfterLogicalNot: false
# L3 - Space before assignment operators '=', '+=', '|=', etc...
SpaceBeforeAssignmentOperators: true
# L3 - Space before control statement parentheses, but not function parentheses
SpaceBeforeParens: ControlStatements
# L3 - No space in empty blocks '{}' or parentheses '()'
# SpaceInEmptyBlock: false <- This one isn't compatible with my clang-format version
SpaceInEmptyParentheses: false
# L3 - No space between angles '<>'
SpacesInAngles: false
# L3 - No space in parentheses -- after '(' and before ')'
SpacesInParentheses: false
# L3 - No space inb square brackets -- after '[' and before ']'
SpacesInSquareBrackets: false
# L3 - No space in container literals
# var a = [1, 2, 3] (<- betweebn square brackets and values)
# f({a: 1, b: 2, c: 3}) (<- before ':' caracter)
SpacesInContainerLiterals: false
# Space after "template" keyword
SpaceAfterTemplateKeyword: true
# Cases in a switch statement
IndentCaseLabels: true
# Nested namespace indentation
NamespaceIndentation: All
#===========================================================================#
# Layout inside a function's scope #
#===========================================================================#
# Rules: #
# + L1 #
# + G3 #
#--------#
# L1 - Disable one-line bracketted code
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: None
AllowShortLoopsOnASingleLine: false
# Except for while/for to allow counters like `while (++i < condition) {}`
AllowShortBlocksOnASingleLine: true
# A simple case case be written `case X: do_something(); break;`
AllowShortCaseLabelsOnASingleLine: true
# G3 - Remove empty line in blocks
KeepEmptyLinesAtTheStartOfBlocks: false
#===========================================================================#
# Global scope #
#===========================================================================#
# Rules: #
# + G2 #
#--------#
# G2 - Max empty lines to keep
MaxEmptyLinesToKeep: 1
#===========================================================================#
# Readability improvements and extras #
#===========================================================================#
# Make macro declarations more eligible. Those won't trigger misplaced spaces.
AlignConsecutiveMacros: true
# Align backslashes when escaping linebreaks
AlignEscapedNewlines: Left
# Align trailing comments (//)
AlignTrailingComments: true
# Allow breaking string litterals when wrapping
BreakStringLiterals: true
# When wrapping, keep '=' on the top right, but put operators on the new line
BreakBeforeBinaryOperators: NonAssignment
#
BreakBeforeTernaryOperators: true
# Include sorting and priority - lowest priority gets sorted at the bottom of the list
SortIncludes: true
IncludeBlocks: Preserve
IncludeCategories:
IncludeCategories:
- Regex: '^"[[:alnum:]./]+"' # Any "my_header.h"
Priority: 3
- Regex: '<criterion/[a-z]+\.h>' # Criterion headers
Priority: 2
- Regex: '<[[:alnum:]./]+>' # System/Standard libs
Priority: 1
# Sort 'using' declarations
SortUsingDeclarations: true