1 # Please refer to https://github.com/mozilla-mobile/firefox-android/blob/main/android-components/config/detekt.yml
2 # for the source of truth for our detekt configuration.
6 excludeCorrectable: false
16 # - 'DetektProgressListener'
17 # - 'KtFileCountProcessor'
18 # - 'PackageCountProcessor'
19 # - 'ClassCountProcessor'
20 # - 'FunctionCountProcessor'
21 # - 'PropertyCountProcessor'
22 # - 'ProjectComplexityProcessor'
23 # - 'ProjectCognitiveComplexityProcessor'
24 # - 'ProjectLLOCProcessor'
25 # - 'ProjectCLOCProcessor'
26 # - 'ProjectLOCProcessor'
27 # - 'ProjectSLOCProcessor'
28 # - 'LicenseHeaderLoaderExtension'
33 # - 'ProjectStatisticsReport'
34 # - 'ComplexityReport'
35 # - 'NotificationReport'
37 # - 'FileBasedFindingsReport'
38 - 'LiteFindingsReport'
42 AbsentOrWrongFileLicense:
44 licenseTemplateFile: 'license.template'
45 licenseTemplateIsRegex: false
46 CommentOverPrivateFunction:
48 CommentOverPrivateProperty:
54 endOfSentenceFormat: '([.?!][ \t\n\r\f<])|([.?!:]$)'
55 OutdatedDocumentation:
57 matchTypeParameters: true
58 matchDeclarationsOrder: true
59 UndocumentedPublicClass:
61 searchInNestedClass: true
62 searchInInnerClass: true
63 searchInInnerObject: true
64 searchInInnerInterface: true
65 UndocumentedPublicFunction:
67 UndocumentedPublicProperty:
78 includeStaticDeclarations: false
79 includePrivateDeclarations: false
83 ignoreSingleWhenExpression: true
84 ignoreSimpleWhenEntries: false
85 ignoreNestingFunctions: false
108 constructorThreshold: 7
109 ignoreDefaultParameters: true
110 ignoreDataClasses: true
111 ignoreAnnotatedParameter: []
121 ReplaceSafeCallChainWithRun:
123 StringLiteralDuplication:
126 ignoreAnnotation: true
127 excludeStringsWithLessThan5Characters: true
128 ignoreStringsRegex: '$^'
132 thresholdInClasses: 26
133 thresholdInInterfaces: 26
134 thresholdInObjects: 26
136 ignoreDeprecated: false
138 ignoreOverridden: false
142 GlobalCoroutineUsage:
150 RedundantSuspendModifier:
154 SuspendFunWithFlowReturnType:
161 allowedExceptionNameRegex: '_|(ignore|expected).*'
164 EmptyDefaultConstructor:
176 ignoreOverridden: false
183 EmptySecondaryConstructor:
194 ExceptionRaisedInUnexpectedLocation:
201 InstanceOfCheckForException:
203 NotImplementedDeclaration:
205 ObjectExtendsThrowable:
209 RethrowCaughtException:
216 ignoredExceptionTypes:
217 - 'InterruptedException'
218 - 'MalformedURLException'
219 - 'NumberFormatException'
221 allowedExceptionNameRegex: '_|(ignore|expected).*'
222 ThrowingExceptionFromFinally:
224 ThrowingExceptionInMain:
226 ThrowingExceptionsWithoutMessageOrCause:
229 - 'ArrayIndexOutOfBoundsException'
231 - 'IllegalArgumentException'
232 - 'IllegalMonitorStateException'
233 - 'IllegalStateException'
234 - 'IndexOutOfBoundsException'
235 - 'NullPointerException'
238 ThrowingNewInstanceOfSameException:
240 TooGenericExceptionCaught:
243 - 'ArrayIndexOutOfBoundsException'
246 - 'IllegalMonitorStateException'
247 - 'IndexOutOfBoundsException'
248 - 'NullPointerException'
251 allowedExceptionNameRegex: '_|(ignore|expected).*'
252 TooGenericExceptionThrown:
262 BooleanPropertyNaming:
264 allowedPattern: '^(is|has|are)'
267 classPattern: '[A-Z][a-zA-Z0-9]*'
268 ConstructorParameterNaming:
270 parameterPattern: '[a-z][A-Za-z0-9]*'
271 privateParameterPattern: '[a-z][A-Za-z0-9]*'
272 excludeClassPattern: '$^'
273 ignoreOverridden: true
276 enumEntryPattern: '[A-Z][_a-zA-Z0-9]*'
282 maximumFunctionNameLength: 30
285 minimumFunctionNameLength: 3
288 functionPattern: '([a-z][a-zA-Z0-9]*)|(`.*`)'
289 excludeClassPattern: '$^'
290 ignoreOverridden: true
291 ignoreAnnotated: ['Composable']
292 FunctionParameterNaming:
294 parameterPattern: '[a-z][A-Za-z0-9]*'
295 excludeClassPattern: '$^'
296 ignoreOverridden: true
297 InvalidPackageDeclaration:
300 LambdaParameterNaming:
302 parameterPattern: '[a-z][A-Za-z0-9]*|_'
303 MatchingDeclarationName:
306 MemberNameEqualsClassName:
308 ignoreOverridden: true
311 NonBooleanPropertyPrefixedWithIs:
313 ObjectPropertyNaming:
315 constantPattern: '[A-Za-z][_A-Za-z0-9]*'
316 propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
317 privatePropertyPattern: '(_)?[A-Za-z][_A-Za-z0-9]*'
320 packagePattern: '[a-z]+(\.[a-z][A-Za-z0-9]*)*'
321 TopLevelPropertyNaming:
323 constantPattern: '[A-Z][_A-Z0-9]*'
324 propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
325 privatePropertyPattern: '_?[A-Za-z][_A-Za-z0-9]*'
328 maximumVariableNameLength: 64
331 minimumVariableNameLength: 1
334 variablePattern: '[a-z][A-Za-z0-9]*'
335 privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*'
336 excludeClassPattern: '$^'
337 ignoreOverridden: true
347 UnnecessaryTemporaryInstantiation:
352 AvoidReferentialEquality:
354 forbiddenTypePatterns:
360 DontDowncastCollectionTypes:
362 DoubleMutabilityForCollection:
364 DuplicateCaseInWhenExpression:
366 EqualsAlwaysReturnsTrueOrFalse:
368 EqualsWithHashCodeExist:
372 ExplicitGarbageCollectionCall:
378 restrictToAnnotatedMethods: true
379 returnValueAnnotations:
381 - '*.CheckReturnValue'
382 ignoreReturnValueAnnotations:
383 - '*.CanIgnoreReturnValue'
384 ImplicitDefaultLocale:
386 ImplicitUnitReturnType:
388 allowExplicitReturnType: true
391 IteratorHasNextCallsNextMethod:
393 IteratorNotThrowingNoSuchElementException:
397 ignoreOnClassesPattern: ''
398 MapGetWithNotNullAssertionOperator:
400 MissingPackageDeclaration:
402 excludes: ['**/*.kts']
405 allowElseExpression: true
406 NullableToStringCall:
410 UnconditionalJumpStatementInLoop:
412 UnnecessaryNotNullOperator:
416 UnreachableCatchBlock:
420 UnsafeCallOnNullableType:
426 UselessPostfixExpression:
428 WrongEqualsTypeParameter:
435 CollapsibleIfStatements:
437 DataClassContainsFunctions:
439 conversionFunctionPrefix: 'to'
440 DataClassShouldBeImmutable:
442 DestructuringDeclarationWithTooManyEntries:
444 maxDestructuringEntries: 3
447 EqualsOnSignatureLine:
449 ExplicitCollectionElementAccessMethod:
451 ExplicitItLambdaParameter:
453 ExpressionBodySyntax:
455 includeLineWrapping: false
467 forbiddenPatterns: ''
472 - 'kotlin.io.println'
473 ForbiddenPublicDataClass:
481 ignoreOverridden: false
482 ignoreUsageInGenerics: false
483 FunctionOnlyReturningConstant:
485 ignoreOverridableFunction: true
486 ignoreActualFunction: true
487 excludedFunctions: ''
488 LibraryCodeMustSpecifyReturnType:
491 LibraryEntitiesShouldNotBePublic:
494 LoopWithTooManyJumpStatements:
504 ignoreHashCodeFunction: true
505 ignorePropertyDeclaration: true
506 ignoreLocalVariableDeclaration: false
507 ignoreConstantDeclaration: true
508 ignoreCompanionObjectPropertyDeclaration: true
509 ignoreAnnotation: false
510 ignoreNamedArgument: true
513 ignoreExtensionFunctions: true
514 MandatoryBracesIfStatements:
516 MandatoryBracesLoops:
521 excludePackageStatements: true
522 excludeImportStatements: true
523 excludeCommentStatements: false
528 MultilineLambdaItParameter:
530 NestedClassesVisibility:
536 ObjectLiteralToLambda:
538 OptionalAbstractKeyword:
544 PreferToOverPairSyntax:
546 ProtectedMemberInFinalClass:
548 RedundantExplicitType:
550 RedundantHigherOrderMapUsage:
552 RedundantVisibilityModifierRule:
557 excludedFunctions: 'equals'
558 excludeLabeled: false
559 excludeReturnFromLambda: true
560 excludeGuardClauses: false
563 SerialVersionUIDInSerializableClass:
565 SpacingBetweenPackageAndImports:
570 excludeGuardClauses: false
573 UnderscoresInNumericLiterals:
576 UnnecessaryAbstractClass:
578 UnnecessaryAnnotationUseSiteTarget:
584 UnnecessaryInheritance:
588 UnnecessaryParentheses:
590 UntilInsteadOfRangeTo:
598 allowedNames: '(_|ignored|expected|serialVersionUID)'
599 ignoreAnnotated: ['Composable']
600 UseAnyOrNoneInsteadOfFind:
602 UseArrayLiteralsInAnnotations:
625 UselessCallOnNotNull:
627 UtilityClassWithPublicConstructor: