文章

clang-tidy rule file sample [2]

文件名:.clang-tidy 引用自 cnl/.clang-tidy at main · johnmcfarlane/cnl (github.com)

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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
---
Checks: >
  *,
  -abseil-*,
  -altera-*,
  -android-*,
  -cert-err58-cpp,
  -clang-analyzer-osx.*,
  -cppcoreguidelines-avoid-magic-numbers,
  -darwin-dispatch-once-nonstatic,
  -fuchsia-*,
  -google-build-using-namespace,
  -google-readability-namespace-comments,
  -google-runtime-int,
  -google-runtime-references,
  -hicpp-named-parameter,
  -hicpp-signed-bitwise,
  -llvm-namespace-comment,
  -llvm-qualified-auto,
  -llvmlibc-*,
  -modernize-use-trailing-return-type,
  -objc-*,
  -openmp-*,
  -readability-identifier-length,
  -readability-implicit-bool-conversion,
  -readability-magic-numbers,
  -readability-named-parameter,
  -readability-qualified-auto,
  -zircon-*,
  -bugprone-easily-swappable-parameters,
  -cppcoreguidelines-pro-bounds-array-to-pointer-decay,
  -cppcoreguidelines-pro-bounds-constant-array-index,
  -cppcoreguidelines-pro-bounds-pointer-arithmetic,
  -cppcoreguidelines-pro-type-vararg,
  -google-readability-todo,
  -hicpp-avoid-c-arrays,
  -hicpp-no-array-decay,
  -hicpp-vararg,
  -misc-definitions-in-headers,
  -misc-no-recursion,
  -modernize-avoid-c-arrays,
  -modernize-concat-nested-namespaces,
  -modernize-unary-static-assert,
  -readability-avoid-const-params-in-decls,
  -readability-function-cognitive-complexity,

WarningsAsErrors: '*'
HeaderFilterRegex: '.*'
AnalyzeTemporaryDtors: false
FormatStyle:     none
User:            john
CheckOptions:
  - key:             cert-dcl16-c.NewSuffixes
    value:           'L;LL;LU;LLU'
  - key:             cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
    value:           '1'
  - key:             google-readability-braces-around-statements.ShortStatementLines
    value:           '1'
  - key:             google-readability-function-size.StatementThreshold
    value:           '800'
  - key:             google-readability-namespace-comments.ShortNamespaceLines
    value:           '10'
  - key:             google-readability-namespace-comments.SpacesBeforeComments
    value:           '2'
  - key:             modernize-loop-convert.MaxCopySize
    value:           '16'
  - key:             modernize-loop-convert.MinConfidence
    value:           reasonable
  - key:             modernize-loop-convert.NamingStyle
    value:           CamelCase
  - key:             modernize-pass-by-value.IncludeStyle
    value:           llvm
  - key:             modernize-replace-auto-ptr.IncludeStyle
    value:           llvm
  - key:             modernize-use-nullptr.NullMacros
    value:           'NULL'


  # because _impl isn't technically lower_case
  # - key:             readability-identifier-naming.NamespaceCase
  #   value:           lower_case
  - key:             readability-identifier-naming.InlineNamespaceCase
    value:           lower_case
  - key:             readability-identifier-naming.EnumConstantCase
    value:           lower_case
  # - key:             readability-identifier-naming.ConstexprVariableCase
  #   value:           lower_case
  - key:             readability-identifier-naming.ConstantMemberCase
    value:           lower_case
  - key:             readability-identifier-naming.PrivateMemberCase
    value:           lower_case
  - key:             readability-identifier-naming.ProtectedMemberCase
    value:           lower_case
  - key:             readability-identifier-naming.PublicMemberCase
    value:           lower_case
  - key:             readability-identifier-naming.MemberCase
    value:           lower_case
  # - key:             readability-identifier-naming.ClassConstantCase
  #   value:           lower_case
  # - key:             readability-identifier-naming.ClassMemberCase
  #   value:           lower_case
  # - key:             readability-identifier-naming.GlobalConstantCase
  #   value:           lower_case
  - key:             readability-identifier-naming.GlobalConstantPointerCase
    value:           lower_case
  - key:             readability-identifier-naming.GlobalPointerCase
    value:           lower_case
  # - key:             readability-identifier-naming.GlobalVariableCase
  #   value:           lower_case
  - key:             readability-identifier-naming.LocalConstantCase
    value:           lower_case
  - key:             readability-identifier-naming.LocalConstantPointerCase
    value:           lower_case
  - key:             readability-identifier-naming.LocalPointerCase
    value:           lower_case
  - key:             readability-identifier-naming.LocalVariableCase
    value:           lower_case
  - key:             readability-identifier-naming.StaticConstantCase
    value:           lower_case
  - key:             readability-identifier-naming.StaticVariableCase
    value:           lower_case
  # - key:             readability-identifier-naming.ConstantCase
  #   value:           lower_case
  # - key:             readability-identifier-naming.VariableCase
  #   value:           lower_case
  - key:             readability-identifier-naming.ConstantParameterCase
    value:           lower_case
  - key:             readability-identifier-naming.ParameterPackCase
    value:           lower_case
  - key:             readability-identifier-naming.ParameterCase
    value:           lower_case
  - key:             readability-identifier-naming.PointerParameterCase
    value:           lower_case
  - key:             readability-identifier-naming.ConstantPointerParameterCase
    value:           lower_case
  - key:             readability-identifier-naming.AbstractClassCase
    value:           lower_case
  - key:             readability-identifier-naming.StructCase
    value:           lower_case
  - key:             readability-identifier-naming.ClassCase
    value:           lower_case
  - key:             readability-identifier-naming.UnionCase
    value:           lower_case
  - key:             readability-identifier-naming.EnumCase
    value:           lower_case
  - key:             readability-identifier-naming.GlobalFunctionCase
    value:           lower_case
  # - key:             readability-identifier-naming.ConstexprFunctionCase
  #   value:           lower_case
  - key:             readability-identifier-naming.FunctionCase
    value:           lower_case
  # - key:             readability-identifier-naming.ConstexprMethodCase
  #   value:           lower_case
  - key:             readability-identifier-naming.VirtualMethodCase
    value:           lower_case
  # - key:             readability-identifier-naming.ClassMethodCase
  #   value:           lower_case
  - key:             readability-identifier-naming.PrivateMethodCase
    value:           lower_case
  - key:             readability-identifier-naming.ProtectedMethodCase
    value:           lower_case
  - key:             readability-identifier-naming.PublicMethodCase
    value:           lower_case
  - key:             readability-identifier-naming.MethodCase
    value:           lower_case
  - key:             readability-identifier-naming.TypedefCase
    value:           lower_case
  # https://bugs.llvm.org/show_bug.cgi?id=46752
  # - key:             readability-identifier-naming.TypeTemplateParameterCase
  #   value:           CamelCase
  - key:             readability-identifier-naming.ValueTemplateParameterCase
    value:           CamelCase
  - key:             readability-identifier-naming.TemplateTemplateParameterCase
    value:           CamelCase
  # https://bugs.llvm.org/show_bug.cgi?id=46752
  # - key:             readability-identifier-naming.TemplateParameterCase
  #   value:           CamelCase
  - key:             readability-identifier-naming.TypeAliasCase
    value:           lower_case
  - key:             readability-identifier-naming.MacroDefinitionCase
    value:           UPPER_CASE
  - key:             readability-identifier-naming.ObjcIvarCase
    value:           lower_case
  - key:             readability-identifier-naming.NamespacePrefix
    value:           ''
  - key:             readability-identifier-naming.InlineNamespacePrefix
    value:           ''
  - key:             readability-identifier-naming.EnumConstantPrefix
    value:           ''
  - key:             readability-identifier-naming.ConstexprVariablePrefix
    value:           ''
  - key:             readability-identifier-naming.ConstantMemberPrefix
    value:           ''
  - key:             readability-identifier-naming.PrivateMemberPrefix
    value:           '_'
  - key:             readability-identifier-naming.ProtectedMemberPrefix
    value:           '_'
  - key:             readability-identifier-naming.PublicMemberPrefix
    value:           ''
  - key:             readability-identifier-naming.MemberPrefix
    value:           ''
  - key:             readability-identifier-naming.ClassConstantPrefix
    value:           ''
  - key:             readability-identifier-naming.ClassMemberPrefix
    value:           ''
  - key:             readability-identifier-naming.GlobalConstantPrefix
    value:           ''
  - key:             readability-identifier-naming.GlobalConstantPointerPrefix
    value:           ''
  - key:             readability-identifier-naming.GlobalPointerPrefix
    value:           ''
  - key:             readability-identifier-naming.GlobalVariablePrefix
    value:           ''
  - key:             readability-identifier-naming.LocalConstantPrefix
    value:           ''
  - key:             readability-identifier-naming.LocalConstantPointerPrefix
    value:           ''
  - key:             readability-identifier-naming.LocalPointerPrefix
    value:           ''
  - key:             readability-identifier-naming.LocalVariablePrefix
    value:           ''
  - key:             readability-identifier-naming.StaticConstantPrefix
    value:           ''
  - key:             readability-identifier-naming.StaticVariablePrefix
    value:           ''
  - key:             readability-identifier-naming.ConstantPrefix
    value:           ''
  - key:             readability-identifier-naming.VariablePrefix
    value:           ''
  - key:             readability-identifier-naming.ConstantParameterPrefix
    value:           ''
  - key:             readability-identifier-naming.ParameterPackPrefix
    value:           ''
  - key:             readability-identifier-naming.ParameterPrefix
    value:           ''
  - key:             readability-identifier-naming.PointerParameterPrefix
    value:           ''
  - key:             readability-identifier-naming.ConstantPointerParameterPrefix
    value:           ''
  - key:             readability-identifier-naming.AbstractClassPrefix
    value:           ''
  - key:             readability-identifier-naming.StructPrefix
    value:           ''
  - key:             readability-identifier-naming.ClassPrefix
    value:           ''
  - key:             readability-identifier-naming.UnionPrefix
    value:           ''
  - key:             readability-identifier-naming.EnumPrefix
    value:           ''
  - key:             readability-identifier-naming.GlobalFunctionPrefix
    value:           ''
  - key:             readability-identifier-naming.ConstexprFunctionPrefix
    value:           ''
  - key:             readability-identifier-naming.FunctionPrefix
    value:           ''
  - key:             readability-identifier-naming.ConstexprMethodPrefix
    value:           ''
  - key:             readability-identifier-naming.VirtualMethodPrefix
    value:           ''
  - key:             readability-identifier-naming.ClassMethodPrefix
    value:           ''
  - key:             readability-identifier-naming.PrivateMethodPrefix
    value:           ''
  - key:             readability-identifier-naming.ProtectedMethodPrefix
    value:           ''
  - key:             readability-identifier-naming.PublicMethodPrefix
    value:           ''
  - key:             readability-identifier-naming.MethodPrefix
    value:           ''
  - key:             readability-identifier-naming.TypedefPrefix
    value:           ''
  - key:             readability-identifier-naming.TypeTemplateParameterPrefix
    value:           ''
  - key:             readability-identifier-naming.ValueTemplateParameterPrefix
    value:           ''
  - key:             readability-identifier-naming.TemplateTemplateParameterPrefix
    value:           ''
  - key:             readability-identifier-naming.TemplateParameterPrefix
    value:           ''
  - key:             readability-identifier-naming.TypeAliasPrefix
    value:           ''
  - key:             readability-identifier-naming.MacroDefinitionPrefix
    value:           ''
  - key:             readability-identifier-naming.ObjcIvarPrefix
    value:           ''
  - key:             readability-identifier-naming.NamespaceSuffix
    value:           ''
  - key:             readability-identifier-naming.InlineNamespaceSuffix
    value:           ''
  - key:             readability-identifier-naming.EnumConstantSuffix
    value:           ''
  - key:             readability-identifier-naming.ConstexprVariableSuffix
    value:           ''
  - key:             readability-identifier-naming.ConstantMemberSuffix
    value:           ''
  - key:             readability-identifier-naming.PrivateMemberSuffix
    value:           ''
  - key:             readability-identifier-naming.ProtectedMemberSuffix
    value:           ''
  - key:             readability-identifier-naming.PublicMemberSuffix
    value:           ''
  - key:             readability-identifier-naming.MemberSuffix
    value:           ''
  - key:             readability-identifier-naming.ClassConstantSuffix
    value:           ''
  - key:             readability-identifier-naming.ClassMemberSuffix
    value:           ''
  - key:             readability-identifier-naming.GlobalConstantSuffix
    value:           ''
  - key:             readability-identifier-naming.GlobalConstantPointerSuffix
    value:           ''
  - key:             readability-identifier-naming.GlobalPointerSuffix
    value:           ''
  - key:             readability-identifier-naming.GlobalVariableSuffix
    value:           ''
  - key:             readability-identifier-naming.LocalConstantSuffix
    value:           ''
  - key:             readability-identifier-naming.LocalConstantPointerSuffix
    value:           ''
  - key:             readability-identifier-naming.LocalPointerSuffix
    value:           ''
  - key:             readability-identifier-naming.LocalVariableSuffix
    value:           ''
  - key:             readability-identifier-naming.StaticConstantSuffix
    value:           ''
  - key:             readability-identifier-naming.StaticVariableSuffix
    value:           ''
  - key:             readability-identifier-naming.ConstantSuffix
    value:           ''
  - key:             readability-identifier-naming.VariableSuffix
    value:           ''
  - key:             readability-identifier-naming.ConstantParameterSuffix
    value:           ''
  - key:             readability-identifier-naming.ParameterPackSuffix
    value:           ''
  - key:             readability-identifier-naming.ParameterSuffix
    value:           ''
  - key:             readability-identifier-naming.PointerParameterSuffix
    value:           ''
  - key:             readability-identifier-naming.ConstantPointerParameterSuffix
    value:           ''
  - key:             readability-identifier-naming.AbstractClassSuffix
    value:           ''
  - key:             readability-identifier-naming.StructSuffix
    value:           ''
  - key:             readability-identifier-naming.ClassSuffix
    value:           ''
  - key:             readability-identifier-naming.UnionSuffix
    value:           ''
  - key:             readability-identifier-naming.EnumSuffix
    value:           ''
  - key:             readability-identifier-naming.GlobalFunctionSuffix
    value:           ''
  - key:             readability-identifier-naming.ConstexprFunctionSuffix
    value:           ''
  - key:             readability-identifier-naming.FunctionSuffix
    value:           ''
  - key:             readability-identifier-naming.ConstexprMethodSuffix
    value:           ''
  - key:             readability-identifier-naming.VirtualMethodSuffix
    value:           ''
  - key:             readability-identifier-naming.ClassMethodSuffix
    value:           ''
  - key:             readability-identifier-naming.PrivateMethodSuffix
    value:           ''
  - key:             readability-identifier-naming.ProtectedMethodSuffix
    value:           ''
  - key:             readability-identifier-naming.PublicMethodSuffix
    value:           ''
  - key:             readability-identifier-naming.MethodSuffix
    value:           ''
  - key:             readability-identifier-naming.TypedefSuffix
    value:           ''
  - key:             readability-identifier-naming.TypeTemplateParameterSuffix
    value:           ''
  - key:             readability-identifier-naming.ValueTemplateParameterSuffix
    value:           ''
  - key:             readability-identifier-naming.TemplateTemplateParameterSuffix
    value:           ''
  - key:             readability-identifier-naming.TemplateParameterSuffix
    value:           ''
  - key:             readability-identifier-naming.TypeAliasSuffix
    value:           ''
  - key:             readability-identifier-naming.MacroDefinitionSuffix
    value:           ''
  - key:             readability-identifier-naming.ObjcIvarSuffix
    value:           ''
...
本文由作者按照 CC BY 4.0 进行授权