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: "16.0.2"
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-too-small-loop-variable
68 - name: bugprone-unused-raii
70 - name: bugprone-use-after-move
72 - name: clang-analyzer-core.CallAndMessage
74 - name: clang-analyzer-core.DivideZero
76 - name: clang-analyzer-core.NonNullParamChecker
78 - name: clang-analyzer-core.NullDereference
80 - name: clang-analyzer-core.UndefinedBinaryOperatorResult
82 - name: clang-analyzer-core.uninitialized.Assign
84 - name: clang-analyzer-core.uninitialized.Branch
86 - name: clang-analyzer-cplusplus.Move
88 - name: clang-analyzer-cplusplus.NewDelete
90 - name: clang-analyzer-cplusplus.NewDeleteLeaks
92 - name: clang-analyzer-deadcode.DeadStores
94 - name: clang-analyzer-optin.performance.Padding
99 - name: clang-analyzer-security.FloatLoopCounter
101 - name: clang-analyzer-security.insecureAPI.bcmp
103 - name: clang-analyzer-security.insecureAPI.bcopy
105 - name: clang-analyzer-security.insecureAPI.bzero
107 - name: clang-analyzer-security.insecureAPI.getpw
109 # We don't add clang-analyzer-security.insecureAPI.gets here; it's deprecated.
110 - name: clang-analyzer-security.insecureAPI.mkstemp
112 - name: clang-analyzer-security.insecureAPI.mktemp
114 - name: clang-analyzer-security.insecureAPI.rand
116 # C checker, that is outdated and doesn't check for the new std::rand calls.
118 - name: clang-analyzer-security.insecureAPI.strcpy
120 # The functions that should be used differ on POSIX and Windows, and there
121 # isn't a consensus on how we should approach this.
123 - name: clang-analyzer-security.insecureAPI.UncheckedReturn
125 - name: clang-analyzer-security.insecureAPI.vfork
127 - name: clang-analyzer-unix.Malloc
129 - name: clang-analyzer-unix.cstring.BadSizeArg
131 - name: clang-analyzer-unix.cstring.NullArg
133 - name: cppcoreguidelines-narrowing-conversions
135 - name: cppcoreguidelines-pro-type-member-init
137 - name: misc-non-copyable-objects
139 - name: misc-redundant-expression
141 - name: misc-unused-alias-decls
143 - name: misc-unused-using-decls
145 - name: modernize-avoid-bind
146 restricted-platforms:
150 - name: modernize-concat-nested-namespaces
152 - name: modernize-deprecated-ios-base-aliases
154 - name: modernize-loop-convert
156 - name: modernize-raw-string-literal
158 - name: modernize-redundant-void-arg
160 # We still have some old C code that is built with a C compiler, so this
161 # might break the build.
163 - name: modernize-shrink-to-fit
165 - name: modernize-use-auto
167 # Controversial, see bug 1371052.
169 - name: modernize-use-bool-literals
171 - name: modernize-use-equals-default
173 - name: modernize-use-equals-delete
175 - name: modernize-use-nullptr
177 - name: modernize-use-override
179 # Too noisy because of the way how we implement NS_IMETHOD. See Bug 1420366.
181 - name: modernize-use-using
185 - name: performance-faster-string-find
187 - name: performance-for-range-copy
189 - name: performance-implicit-conversion-in-loop
191 - name: performance-inefficient-algorithm
192 restricted-platforms:
196 # Disable as the test does not support C++17 yet
198 - name: performance-inefficient-string-concatenation
200 - name: performance-inefficient-vector-operation
202 - name: performance-move-const-arg
205 - key: CheckTriviallyCopyableMove
206 # As per Bug 1558359 - disable detection of trivially copyable types
207 # that do not have a move constructor.
209 - name: performance-move-constructor-init
211 - name: performance-noexcept-move-constructor
213 - name: performance-type-promotion-in-math-fn
215 - name: performance-unnecessary-copy-initialization
217 - name: performance-unnecessary-value-param
219 - name: readability-braces-around-statements
222 - key: ShortStatementLines
223 # Allow `if (foo) return;` without braces
224 # Still warns on `if (foo)\n return;`
226 - name: readability-const-return-type
228 # Note: this can be loosened up by using the ShortStatementLines option
229 - name: readability-container-size-empty
231 - name: readability-delete-null-pointer
233 - name: readability-else-after-return
236 - key: WarnOnConditionVariables
237 # Disable as we don't mind this kind of behavior
239 - name: readability-implicit-bool-conversion
241 # On automation the config flags act strange. Please see Bug 1500241.
244 - key: AllowIntegerConditions
245 # The check will allow conditional integer conversions.
247 - key: AllowPointerConditions
248 # The check will allow conditional pointer conversions.
250 - name: readability-inconsistent-declaration-parameter-name
252 - name: readability-isolate-declaration
253 # As per bug 1558987 - we don't want to have this enabled
256 - name: readability-magic-numbers
257 # Bug 1553495 - we must see first its impact on our code.
260 - name: readability-misleading-indentation
262 - name: readability-non-const-parameter
264 - name: readability-qualified-auto
266 - name: readability-redundant-control-flow
268 - name: readability-redundant-preprocessor
270 - name: readability-redundant-smartptr-get
272 - name: readability-redundant-string-cstr
274 - name: readability-redundant-string-init
276 - name: readability-static-accessed-through-instance
278 - name: readability-simplify-boolean-expr
281 - key: SimplifyDeMorgan
282 # Don't want to enable DeMorgan expressions because of MOZ_ASSERT()
285 - name: readability-uniqueptr-delete-release
287 # We don't publish the google checkers since we are interested in only having
288 # a general idea how our code complies with the rules added by these checkers.
289 - name: google-build-explicit-make-pair
292 - name: google-build-namespaces
295 - name: google-build-using-namespace
298 - name: google-default-arguments
301 - name: google-explicit-constructor
304 - name: google-global-names-in-headers
307 - name: google-readability-casting
310 - name: google-readability-function-size
313 - name: google-readability-namespace-comments
316 - name: google-readability-todo
319 - name: google-runtime-int
322 - name: google-runtime-operator
325 - name: google-runtime-references