forked from square/spacecommander
/
.clang-format
302 lines (196 loc) · 6.19 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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
---
# http://releases.llvm.org/8.0.0/tools/clang/docs/ClangFormatStyleOptions.html
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
# Language: Cpp
# BasedOnStyle: LLVM
# 访问修饰符如@public、@private、@protected的缩进
AccessModifierOffset: -2
# 括号中不在同一行的参数垂直对齐
AlignAfterOpenBracket: Align
# 连续赋值语句=对齐
AlignConsecutiveAssignments: false
# 连续变量名定义,变量名起始位置对齐
AlignConsecutiveDeclarations: false
# 转义换行符反斜杠对齐
AlignEscapedNewlines: Left
# 水平对齐二元和三元表达式的操作数
AlignOperands: false
# 对齐连续的紧跟注释
AlignTrailingComments: false
# 在超过规定列数之后,在方法声明中将所有参数换行显示
AllowAllParametersOfDeclarationOnNextLine: false
# 折叠空block
AllowShortBlocksOnASingleLine: true
# 允许只有Break语句的case标签在一行显示
AllowShortCaseLabelsOnASingleLine: false
# 允许只有一行的Function在一行显示
AllowShortFunctionsOnASingleLine: Empty
# 允许较短的if判断在一行显示
AllowShortIfStatementsOnASingleLine: false
# 允许较短的循环在一行显示
AllowShortLoopsOnASingleLine: false
# The function definition return type breaking style to use. This option is deprecated and is retained for backwards compatibility.
AlwaysBreakAfterDefinitionReturnType: None
# The function declaration return type breaking style to use.
AlwaysBreakAfterReturnType: None
# 多行文本前插入空行
AlwaysBreakBeforeMultilineStrings: false
# template声明换行方式
AlwaysBreakTemplateDeclarations: No
# 方法调用参数对齐方式
BinPackArguments: false
# 方法声明参数对齐方式
BinPackParameters: false
# 大括号换行,只有当BreakBeforeBraces设置为Custom时才有效
BraceWrapping:
# class定义后面
AfterClass: true
# 控制语句后面
AfterControlStatement: false
# enum定义后面
AfterEnum: false
# 函数定义后面
AfterFunction: true
# 命名空间定义后面
AfterNamespace: true
# OC定义后面
AfterObjCDeclaration: true
# struct定义后面
AfterStruct: false
# union定义后面
AfterUnion: false
# extern语句后面
AfterExternBlock: false
# catch之前
BeforeCatch: false
# else之前
BeforeElse: false
# 缩进大括号
IndentBraces: false
# 空函数体换行
SplitEmptyFunction: false
# 空类换行
SplitEmptyRecord: false
# 空命名空间换行
SplitEmptyNamespace: false
# 长语句运算符换行方式
BreakBeforeBinaryOperators: NonAssignment
# 花括号的换行标准
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
# 类继承样式
BreakInheritanceList: AfterColon
# 长三元表达式换行方式
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: true
BreakStringLiterals: true
ColumnLimit: 0
CommentPragmas: '^ IWYU pragma:'
# 嵌套名空间排版
CompactNamespaces: false
# 构造函数参数对齐方式
ConstructorInitializerAllOnOneLineOrOnePerLine: false
# 构造函数声明缩进
ConstructorInitializerIndentWidth: 4
# 连续行的缩进长度
ContinuationIndentWidth: 4
# 大括号紧凑样式
Cpp11BracedListStyle: true
DerivePointerAlignment: false
# 停用配置
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
# 名空间尾部加名字注释
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
# include语句排序
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
# case语句缩进
IndentCaseLabels: true
# 预编译指令对齐方式
IndentPPDirectives: None
# 缩进列数
IndentWidth: 4
# 方法名换行是否缩进
IndentWrappedFunctionNames: true
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
# 方法名后面加换行
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
# 最大连续空行数
MaxEmptyLinesToKeep: 2
# 名空间缩进
NamespaceIndentation: All
# OC类声明实现协议列表换行方式
ObjCBinPackProtocolList: Auto
# block 缩进
ObjCBlockIndentWidth: 4
# 在@property之后添加一个空格
ObjCSpaceAfterProperty: true
# 在类与协议名的左括号之间添加一空格
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 4
PenaltyBreakBeforeFirstCallParameter: 10000
PenaltyBreakComment: 120
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 120
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
# 所有位置的指针星号(*)或取地址符号(&)对齐位置
PointerAlignment: Right
# 注释自动换行
ReflowComments: true
# 自动排序include语句
SortIncludes: false
# 自动排序using语句
SortUsingDeclarations: false
# 类型强转括号号码加空格
SpaceAfterCStyleCast: false
# template关键字后面插入空格
SpaceAfterTemplateKeyword: false
# 在赋值运算符前后添加一个空格
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
# 在括号之前添加一个空格
SpaceBeforeParens: ControlStatements
# 循环语句的条件语句空格样式
SpaceBeforeRangeBasedForLoopColon: true
# 在空括号内添加空格
SpaceInEmptyParentheses: false
# 在紧跟注释之前所留空格数
SpacesBeforeTrailingComments: 2
# 在尖括号和内容之间各留一个空格
SpacesInAngles: false
# 在Containerliterals(NSArray)之间添加空格
SpacesInContainerLiterals: false
# 在C风格的强制转换的时候添加空格
SpacesInCStyleCastParentheses: false
# 自动给mehtod-body内的括号和内容之间添加空格
SpacesInParentheses: false
# 中括号之间加空格
SpacesInSquareBrackets: false
Standard: Cpp11
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 4
UseTab: Never
...