-
Notifications
You must be signed in to change notification settings - Fork 0
/
.clang-tidy
228 lines (209 loc) · 8.2 KB
/
.clang-tidy
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
---
# Configure clang-tidy for this project.
# Here is an explanation for why some of the checks are disabled:
#
# -google-readability-namespace-comments: the *_CLIENT_NS is a macro, and
# clang-tidy fails to match it against the initial value.
#
# -modernize-use-trailing-return-type: clang-tidy recommends using
# `auto Foo() -> std::string { return ...; }`, we think the code is less
# readable in this form.
#
# --modernize-concat-nested-namespaces: clang-tidy recommends
# `namespace google::cloud {}` over `namespace google { namespace cloud { } }`
# We need to support C++14, which does not supported nested namespaces.
#
# --modernize-use-nodiscard: clang-tidy recommends adding a nodiscard annotation
# to functions where the return value should not be ignored.
# We need to support C++14, which does not supported the annotation.
#
# -modernize-return-braced-init-list: We think removing typenames and using
# only braced-init can hurt readability.
#
# -modernize-avoid-c-arrays: We only use C arrays when they seem to be the
# right tool for the job, such as `char foo[] = "hello"`. In these cases,
# avoiding C arrays often makes the code less readable, and std::array is
# not a drop-in replacement because it doesn't deduce the size.
#
# -performance-move-const-arg: This warning requires the developer to
# know/care more about the implementation details of types/functions than
# should be necessary. For example, `A a; F(std::move(a));` will trigger a
# warning IFF `A` is a trivial type (and therefore the move is
# meaningless). It would also warn if `F` accepts by `const&`, which is
# another detail that the caller need not care about.
#
# -performance-avoid-endl: we would like to turn this on, but there are too
# many legitimate uses in our samples.
#
# -readability-redundant-declaration: A friend declaration inside a class
# counts as a declaration, so if we also declare that friend outside the
# class in order to document it as part of the public API, that will
# trigger a redundant declaration warning from this check.
#
# -readability-function-cognitive-complexity: too many false positives with
# clang-tidy-12. We need to disable this check in macros, and that setting
# only appears in clang-tidy-13.
#
# -bugprone-narrowing-conversions: too many false positives around
# `std::size_t` vs. `*::difference_type`.
#
# -bugprone-easily-swappable-parameters: too many false positives.
#
# -bugprone-implicit-widening-of-multiplication-result: too many false positives.
# Almost any expression of the form `2 * variable` or `long x = a_int * b_int;`
# generates an error.
#
# -bugprone-unchecked-optional-access: too many false positives in tests.
# Despite what the documentation says, this warning appears after
# `ASSERT_TRUE(variable)` or `ASSERT_TRUE(variable.has_value())`.
#
# -misc-include-cleaner: too many *true* positives. We need to clean up the
# code, but we should do that over time, maybe per-directory, instead of
# blocking the adoption of Clang 17 until it is all fixed.
#
Checks: >
-abseil-*
-android-*
boost-use-to-string,
bugprone-*,
cert-dcl21-cpp,
cert-dcl50-cpp,
cert-dcl58-cpp,
cert-env33-c,
cert-err34-c,
cert-err52-cpp,
cert-err58-cpp,
cert-err60-cpp,
cert-flp30-c,
cert-msc50-cpp,
cert-msc51-cpp,
clang-analyzer-apiModeling.StdCLibraryFunctions,
clang-analyzer-apiModeling.TrustNonnull,
clang-analyzer-apiModeling.google.GTest,
clang-analyzer-core.CallAndMessage,
clang-analyzer-core.DivideZero,
clang-analyzer-core.DynamicTypePropagation,
clang-analyzer-core.NonNullParamChecker,
clang-analyzer-core.NonnilStringConstants,
clang-analyzer-core.NullDereference,
clang-analyzer-core.StackAddressEscape,
clang-analyzer-core.UndefinedBinaryOperatorResult,
clang-analyzer-core.VLASize,
clang-analyzer-core.builtin.BuiltinFunctions,
clang-analyzer-core.builtin.NoReturnFunctions,
clang-analyzer-core.uninitialized.ArraySubscript,
clang-analyzer-core.uninitialized.Assign,
clang-analyzer-core.uninitialized.Branch,
clang-analyzer-core.uninitialized.CapturedBlockVariable,
clang-analyzer-core.uninitialized.UndefReturn,
clang-analyzer-cplusplus.InnerPointer,
clang-analyzer-cplusplus.Move,
clang-analyzer-cplusplus.NewDelete,
clang-analyzer-cplusplus.NewDeleteLeaks,
clang-analyzer-cplusplus.SelfAssignment,
clang-analyzer-deadcode.DeadStores,
clang-analyzer-nullability.NullPassedToNonnull,
clang-analyzer-nullability.NullReturnedFromNonnull,
clang-analyzer-nullability.NullableDereferenced,
clang-analyzer-nullability.NullablePassedToNonnull,
clang-analyzer-nullability.NullableReturnedFromNonnull,
clang-analyzer-optin.cplusplus.VirtualCall,
clang-analyzer-optin.mpi.MPI-Checker,
clang-analyzer-optin.osx.cocoa.localizability.EmptyLocalizationContextChecker,
clang-analyzer-optin.osx.cocoa.localizability.NonLocalizedStringChecker,
clang-analyzer-optin.performance.GCDAntipattern,
clang-analyzer-optin.performance.Padding,
clang-analyzer-optin.portability.UnixAPI,
-clang-analyzer-osx.*
clang-analyzer-security.FloatLoopCounter,
clang-analyzer-security.insecureAPI.UncheckedReturn,
clang-analyzer-security.insecureAPI.bcmp,
clang-analyzer-security.insecureAPI.bcopy,
clang-analyzer-security.insecureAPI.bzero,
clang-analyzer-security.insecureAPI.getpw,
clang-analyzer-security.insecureAPI.gets,
clang-analyzer-security.insecureAPI.mkstemp,
clang-analyzer-security.insecureAPI.mktemp,
clang-analyzer-security.insecureAPI.rand,
clang-analyzer-security.insecureAPI.strcpy,
clang-analyzer-security.insecureAPI.vfork,
clang-analyzer-unix.API,
clang-analyzer-unix.Malloc,
clang-analyzer-unix.MallocSizeof,
clang-analyzer-unix.MismatchedDeallocator,
clang-analyzer-unix.Vfork,
clang-analyzer-unix.cstring.BadSizeArg,
clang-analyzer-unix.cstring.NullArg,
clang-analyzer-valist.CopyToSelf,
clang-analyzer-valist.Uninitialized,
clang-analyzer-valist.Unterminated,
cppcoreguidelines-avoid-goto,
cppcoreguidelines-interfaces-global-init,
cppcoreguidelines-macro-usage,
cppcoreguidelines-narrowing-conversions,
cppcoreguidelines-no-malloc,
cppcoreguidelines-owning-memory,
cppcoreguidelines-pro-bounds-array-to-pointer-decay,
cppcoreguidelines-pro-bounds-constant-array-index,
cppcoreguidelines-pro-bounds-pointer-arithmetic,
cppcoreguidelines-pro-type-const-cast,
cppcoreguidelines-pro-type-cstyle-cast,
cppcoreguidelines-pro-type-member-init,
-cppcoreguidelines-pro-type-reinterpret-cast,
cppcoreguidelines-pro-type-static-cast-downcast,
cppcoreguidelines-pro-type-union-access,
cppcoreguidelines-pro-type-vararg,
cppcoreguidelines-slicing,
cppcoreguidelines-special-member-functions,
-fuchsia-default-arguments,
fuchsia-multiple-inheritance,
-fuchsia-overloaded-operator,
fuchsia-restrict-system-includes,
fuchsia-statically-constructed-objects,
-fuchsia-trailing-return,
fuchsia-virtual-inheritance,
google-build-explicit-make-pair,
google-build-namespaces,
google-build-using-namespace,
google-default-arguments,
google-explicit-constructor,
google-global-names-in-headers,
-google-objc-avoid-throwing-exception,
-google-objc-function-naming,
-google-objc-global-variable-declaration,
google-readability-avoid-underscore-in-googletest-name,
google-readability-casting,
google-readability-todo,
google-runtime-int,
google-runtime-operator,
google-runtime-references,
hicpp-avoid-goto,
hicpp-exception-baseclass,
-hicpp-multiway-paths-covered,
hicpp-no-assembler,
hicpp-signed-bitwise,
-llvm-header-guard,
llvm-include-order,
llvm-namespace-comment,
-llvm-twine-local,
misc-*,
-misc-unused-parameters,
modernize-*,
-modernize-use-nodiscard,
-mpi-*
-objc-*
-openmp-*
performance-*,
readability-*,
-readability-implicit-bool-conversion,
-readability-magic-numbers,
-readability-named-parameter,
-readability-uppercase-literal-suffix,
-zircon-temporary-objects
WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: none
CheckOptions:
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: 1