2 target: obj-x86_64-pc-linux-gnu
3 # It is used by 'mach static-analysis' and 'phabricator static-analysis bot'
4 # in order to have consistency across the used checkers.
5 # All the clang checks used by the static-analysis tools.
7 # To add a new checker:
8 # 1. Add it in this file
9 # 2. Create a C/C++ test case in tools/clang-tidy/test/ reproducing the
10 # warning/error that the checker will detect
11 # 3. Run './mach static-analysis autotest -d' to create the reference
12 # 4. Check the json file in tools/clang-tidy/test/
13 # 5. Commit this file + the .cpp test case + the json result
19 # Minimum clang-tidy version that is required for all the following checkers
21 # This is also used by 'mach clang-format'
22 package_version: "17.0.6"
26 - name: bugprone-argument-comment
28 - name: bugprone-assert-side-effect
30 - name: bugprone-bool-pointer-implicit-conversion
32 - name: bugprone-forward-declaration-namespace
34 - name: bugprone-incorrect-roundings
36 - name: bugprone-integer-division
38 - name: bugprone-macro-parentheses
40 - name: bugprone-macro-repeated-side-effects
42 - name: bugprone-misplaced-widening-cast
44 - name: bugprone-move-forwarding-reference
46 - name: bugprone-multiple-statement-macro
47 # Incompatible with our code base, see bug 1496379.
50 - name: bugprone-sizeof-expression
52 - name: bugprone-string-constructor
54 - name: bugprone-string-integer-assignment
56 - name: bugprone-suspicious-memset-usage
58 - name: bugprone-suspicious-missing-comma
60 - name: bugprone-suspicious-semicolon
62 - name: bugprone-suspicious-string-compare
64 - name: bugprone-swapped-arguments
66 - name: bugprone-switch-missing-default-case
68 - name: bugprone-too-small-loop-variable
70 - name: bugprone-unused-raii
72 - name: bugprone-use-after-move
74 - name: clang-analyzer-core.CallAndMessage
76 - name: clang-analyzer-core.DivideZero
78 - name: clang-analyzer-core.NonNullParamChecker
80 - name: clang-analyzer-core.NullDereference
82 - name: clang-analyzer-core.UndefinedBinaryOperatorResult
84 - name: clang-analyzer-core.uninitialized.Assign
86 - name: clang-analyzer-core.uninitialized.Branch
88 - name: clang-analyzer-cplusplus.Move
90 - name: clang-analyzer-cplusplus.NewDelete
92 - name: clang-analyzer-cplusplus.NewDeleteLeaks
94 - name: clang-analyzer-deadcode.DeadStores
96 - name: clang-analyzer-optin.performance.Padding
101 - name: clang-analyzer-security.FloatLoopCounter
103 - name: clang-analyzer-security.insecureAPI.bcmp
105 - name: clang-analyzer-security.insecureAPI.bcopy
107 - name: clang-analyzer-security.insecureAPI.bzero
109 - name: clang-analyzer-security.insecureAPI.getpw
111 # We don't add clang-analyzer-security.insecureAPI.gets here; it's deprecated.
112 - name: clang-analyzer-security.insecureAPI.mkstemp
114 - name: clang-analyzer-security.insecureAPI.mktemp
116 - name: clang-analyzer-security.insecureAPI.rand
118 # C checker, that is outdated and doesn't check for the new std::rand calls.
120 - name: clang-analyzer-security.insecureAPI.strcpy
122 # The functions that should be used differ on POSIX and Windows, and there
123 # isn't a consensus on how we should approach this.
125 - name: clang-analyzer-security.insecureAPI.UncheckedReturn
127 - name: clang-analyzer-security.insecureAPI.vfork
129 - name: clang-analyzer-unix.Malloc
131 - name: clang-analyzer-unix.cstring.BadSizeArg
133 - name: clang-analyzer-unix.cstring.NullArg
135 - name: cppcoreguidelines-narrowing-conversions
137 - name: cppcoreguidelines-pro-type-member-init
139 - name: misc-include-cleaner
140 # Disable this checker until we move to before/after
143 - name: misc-non-copyable-objects
145 - name: misc-redundant-expression
147 - name: misc-unused-alias-decls
149 - name: misc-unused-using-decls
151 - name: modernize-avoid-bind
152 restricted-platforms:
156 - name: modernize-concat-nested-namespaces
158 - name: modernize-deprecated-ios-base-aliases
160 - name: modernize-loop-convert
162 - name: modernize-raw-string-literal
164 - name: modernize-redundant-void-arg
166 # We still have some old C code that is built with a C compiler, so this
167 # might break the build.
169 - name: modernize-shrink-to-fit
171 - name: modernize-use-auto
173 # Controversial, see bug 1371052.
175 - name: modernize-use-bool-literals
177 - name: modernize-use-equals-default
179 - name: modernize-use-equals-delete
181 - name: modernize-use-nullptr
183 - name: modernize-use-override
185 # Too noisy because of the way how we implement NS_IMETHOD. See Bug 1420366.
187 - name: modernize-use-using
191 - name: performance-avoid-endl
193 # enable from clang 18
194 # - name: performance-enum-size
196 - name: performance-faster-string-find
198 - name: performance-for-range-copy
200 - name: performance-implicit-conversion-in-loop
202 - name: performance-inefficient-algorithm
203 restricted-platforms:
207 # Disable as the test does not support C++17 yet
209 - name: performance-inefficient-string-concatenation
211 - name: performance-inefficient-vector-operation
213 - name: performance-move-const-arg
216 - key: CheckTriviallyCopyableMove
217 # As per Bug 1558359 - disable detection of trivially copyable types
218 # that do not have a move constructor.
220 - name: performance-move-constructor-init
222 - name: performance-noexcept-move-constructor
224 - name: performance-type-promotion-in-math-fn
226 - name: performance-unnecessary-copy-initialization
228 - name: performance-unnecessary-value-param
232 # Allow EnumSet because it only has a non-trivial copy constructor
234 value: ::mozilla::EnumSet
235 - name: readability-braces-around-statements
238 - key: ShortStatementLines
239 # Allow `if (foo) return;` without braces
240 # Still warns on `if (foo)\n return;`
242 - name: readability-const-return-type
244 # Note: this can be loosened up by using the ShortStatementLines option
245 - name: readability-container-size-empty
247 - name: readability-delete-null-pointer
249 - name: readability-else-after-return
252 - key: WarnOnConditionVariables
253 # Disable as we don't mind this kind of behavior
255 - name: readability-implicit-bool-conversion
257 # On automation the config flags act strange. Please see Bug 1500241.
260 - key: AllowIntegerConditions
261 # The check will allow conditional integer conversions.
263 - key: AllowPointerConditions
264 # The check will allow conditional pointer conversions.
266 - name: readability-inconsistent-declaration-parameter-name
268 - name: readability-isolate-declaration
269 # As per bug 1558987 - we don't want to have this enabled
272 - name: readability-magic-numbers
273 # Bug 1553495 - we must see first its impact on our code.
276 - name: readability-misleading-indentation
278 - name: readability-non-const-parameter
280 - name: readability-qualified-auto
282 - name: readability-redundant-control-flow
284 - name: readability-redundant-member-init
286 - name: readability-redundant-preprocessor
288 - name: readability-redundant-smartptr-get
290 - name: readability-redundant-string-cstr
292 - name: readability-redundant-string-init
294 - name: readability-static-accessed-through-instance
296 - name: readability-simplify-boolean-expr
299 - key: SimplifyDeMorgan
300 # Don't want to enable DeMorgan expressions because of MOZ_ASSERT()
303 - name: readability-uniqueptr-delete-release
305 # We don't publish the google checkers since we are interested in only having
306 # a general idea how our code complies with the rules added by these checkers.
307 - name: google-build-explicit-make-pair
310 - name: google-build-namespaces
313 - name: google-build-using-namespace
316 - name: google-default-arguments
319 - name: google-explicit-constructor
322 - name: google-global-names-in-headers
325 - name: google-readability-casting
328 - name: google-readability-function-size
331 - name: google-readability-namespace-comments
334 - name: google-readability-todo
337 - name: google-runtime-int
340 - name: google-runtime-operator
343 - name: google-runtime-references