Bug 1806170 - Align detekt config between Focus and Android Components
[gecko.git] / mobile / android / focus-android / quality / detekt.yml
blob51c4b4433dc8a69b97debdd4f99e534a986f49b9
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.
4 build:
5   maxIssues: 0
6   excludeCorrectable: false
7   weights:
8     # complexity: 2
9     # LongParameterList: 1
10     # style: 1
11     # comments: 1
13 processors:
14   active: true
15   exclude:
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'
30 console-reports:
31   active: true
32   exclude:
33   #  - 'ProjectStatisticsReport'
34   #  - 'ComplexityReport'
35   #  - 'NotificationReport'
36   #  - 'FindingsReport'
37   #  - 'FileBasedFindingsReport'
38     - 'LiteFindingsReport'
40 comments:
41   active: true
42   AbsentOrWrongFileLicense:
43     active: false
44     licenseTemplateFile: 'license.template'
45     licenseTemplateIsRegex: false
46   CommentOverPrivateFunction:
47     active: false
48   CommentOverPrivateProperty:
49     active: false
50   DeprecatedBlockTag:
51     active: false
52   EndOfSentenceFormat:
53     active: false
54     endOfSentenceFormat: '([.?!][ \t\n\r\f<])|([.?!:]$)'
55   OutdatedDocumentation:
56     active: false
57     matchTypeParameters: true
58     matchDeclarationsOrder: true
59   UndocumentedPublicClass:
60     active: true
61     searchInNestedClass: true
62     searchInInnerClass: true
63     searchInInnerObject: true
64     searchInInnerInterface: true
65   UndocumentedPublicFunction:
66     active: true
67   UndocumentedPublicProperty:
68     active: false
70 complexity:
71   active: true
72   ComplexCondition:
73     active: true
74     threshold: 4
75   ComplexInterface:
76     active: false
77     threshold: 10
78     includeStaticDeclarations: false
79     includePrivateDeclarations: false
80   ComplexMethod:
81     active: true
82     threshold: 18
83     ignoreSingleWhenExpression: true
84     ignoreSimpleWhenEntries: false
85     ignoreNestingFunctions: false
86     nestingFunctions:
87       - 'also'
88       - 'apply'
89       - 'forEach'
90       - 'isNotNull'
91       - 'ifNull'
92       - 'let'
93       - 'run'
94       - 'use'
95       - 'with'
96   LabeledExpression:
97     active: false
98     ignoredLabels: []
99   LargeClass:
100     active: true
101     threshold: 600
102   LongMethod:
103     active: true
104     threshold: 75
105   LongParameterList:
106     active: true
107     functionThreshold: 6
108     constructorThreshold: 7
109     ignoreDefaultParameters: true
110     ignoreDataClasses: true
111     ignoreAnnotatedParameter: []
112   MethodOverloading:
113     active: false
114     threshold: 6
115   NamedArguments:
116     active: false
117     threshold: 3
118   NestedBlockDepth:
119     active: true
120     threshold: 4
121   ReplaceSafeCallChainWithRun:
122     active: false
123   StringLiteralDuplication:
124     active: false
125     threshold: 3
126     ignoreAnnotation: true
127     excludeStringsWithLessThan5Characters: true
128     ignoreStringsRegex: '$^'
129   TooManyFunctions:
130     active: true
131     thresholdInFiles: 26
132     thresholdInClasses: 26
133     thresholdInInterfaces: 26
134     thresholdInObjects: 26
135     thresholdInEnums: 11
136     ignoreDeprecated: false
137     ignorePrivate: false
138     ignoreOverridden: false
140 coroutines:
141   active: true
142   GlobalCoroutineUsage:
143     active: false
144   InjectDispatcher:
145     active: false
146     dispatcherNames:
147       - 'IO'
148       - 'Default'
149       - 'Unconfined'
150   RedundantSuspendModifier:
151     active: false
152   SleepInsteadOfDelay:
153     active: false
154   SuspendFunWithFlowReturnType:
155     active: false
157 empty-blocks:
158   active: true
159   EmptyCatchBlock:
160     active: true
161     allowedExceptionNameRegex: '_|(ignore|expected).*'
162   EmptyClassBlock:
163     active: true
164   EmptyDefaultConstructor:
165     active: true
166   EmptyDoWhileBlock:
167     active: true
168   EmptyElseBlock:
169     active: true
170   EmptyFinallyBlock:
171     active: true
172   EmptyForBlock:
173     active: true
174   EmptyFunctionBlock:
175     active: true
176     ignoreOverridden: false
177   EmptyIfBlock:
178     active: true
179   EmptyInitBlock:
180     active: true
181   EmptyKtFile:
182     active: true
183   EmptySecondaryConstructor:
184     active: true
185   EmptyTryBlock:
186     active: true
187   EmptyWhenBlock:
188     active: true
189   EmptyWhileBlock:
190     active: true
192 exceptions:
193   active: true
194   ExceptionRaisedInUnexpectedLocation:
195     active: false
196     methodNames:
197       - 'equals'
198       - 'finalize'
199       - 'hashCode'
200       - 'toString'
201   InstanceOfCheckForException:
202     active: false
203   NotImplementedDeclaration:
204     active: false
205   ObjectExtendsThrowable:
206     active: false
207   PrintStackTrace:
208     active: true
209   RethrowCaughtException:
210     active: false
211   ReturnFromFinally:
212     active: true
213     ignoreLabeled: false
214   SwallowedException:
215     active: false
216     ignoredExceptionTypes:
217       - 'InterruptedException'
218       - 'MalformedURLException'
219       - 'NumberFormatException'
220       - 'ParseException'
221     allowedExceptionNameRegex: '_|(ignore|expected).*'
222   ThrowingExceptionFromFinally:
223     active: true
224   ThrowingExceptionInMain:
225     active: false
226   ThrowingExceptionsWithoutMessageOrCause:
227     active: false
228     exceptions:
229       - 'ArrayIndexOutOfBoundsException'
230       - 'Exception'
231       - 'IllegalArgumentException'
232       - 'IllegalMonitorStateException'
233       - 'IllegalStateException'
234       - 'IndexOutOfBoundsException'
235       - 'NullPointerException'
236       - 'RuntimeException'
237       - 'Throwable'
238   ThrowingNewInstanceOfSameException:
239     active: true
240   TooGenericExceptionCaught:
241     active: true
242     exceptionNames:
243       - 'ArrayIndexOutOfBoundsException'
244       - 'Error'
245       - 'Exception'
246       - 'IllegalMonitorStateException'
247       - 'IndexOutOfBoundsException'
248       - 'NullPointerException'
249       - 'RuntimeException'
250       - 'Throwable'
251     allowedExceptionNameRegex: '_|(ignore|expected).*'
252   TooGenericExceptionThrown:
253     active: true
254     exceptionNames:
255       - 'Error'
256       - 'Exception'
257       - 'RuntimeException'
258       - 'Throwable'
260 naming:
261   active: true
262   BooleanPropertyNaming:
263     active: false
264     allowedPattern: '^(is|has|are)'
265   ClassNaming:
266     active: true
267     classPattern: '[A-Z][a-zA-Z0-9]*'
268   ConstructorParameterNaming:
269     active: true
270     parameterPattern: '[a-z][A-Za-z0-9]*'
271     privateParameterPattern: '[a-z][A-Za-z0-9]*'
272     excludeClassPattern: '$^'
273     ignoreOverridden: true
274   EnumNaming:
275     active: true
276     enumEntryPattern: '[A-Z][_a-zA-Z0-9]*'
277   ForbiddenClassName:
278     active: false
279     forbiddenName: []
280   FunctionMaxLength:
281     active: false
282     maximumFunctionNameLength: 30
283   FunctionMinLength:
284     active: false
285     minimumFunctionNameLength: 3
286   FunctionNaming:
287     active: true
288     functionPattern: '([a-z][a-zA-Z0-9]*)|(`.*`)'
289     excludeClassPattern: '$^'
290     ignoreOverridden: true
291     ignoreAnnotated: ['Composable']
292   FunctionParameterNaming:
293     active: true
294     parameterPattern: '[a-z][A-Za-z0-9]*'
295     excludeClassPattern: '$^'
296     ignoreOverridden: true
297   InvalidPackageDeclaration:
298     active: false
299     rootPackage: ''
300   LambdaParameterNaming:
301     active: false
302     parameterPattern: '[a-z][A-Za-z0-9]*|_'
303   MatchingDeclarationName:
304     active: true
305     mustBeFirst: true
306   MemberNameEqualsClassName:
307     active: false
308     ignoreOverridden: true
309   NoNameShadowing:
310     active: false
311   NonBooleanPropertyPrefixedWithIs:
312     active: false
313   ObjectPropertyNaming:
314     active: true
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]*'
318   PackageNaming:
319     active: true
320     packagePattern: '[a-z]+(\.[a-z][A-Za-z0-9]*)*'
321   TopLevelPropertyNaming:
322     active: true
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]*'
326   VariableMaxLength:
327     active: false
328     maximumVariableNameLength: 64
329   VariableMinLength:
330     active: false
331     minimumVariableNameLength: 1
332   VariableNaming:
333     active: true
334     variablePattern: '[a-z][A-Za-z0-9]*'
335     privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*'
336     excludeClassPattern: '$^'
337     ignoreOverridden: true
339 performance:
340   active: true
341   ArrayPrimitive:
342     active: true
343   ForEachOnRange:
344     active: true
345   SpreadOperator:
346     active: true
347   UnnecessaryTemporaryInstantiation:
348     active: true
350 potential-bugs:
351   active: true
352   AvoidReferentialEquality:
353     active: false
354     forbiddenTypePatterns:
355       - 'kotlin.String'
356   CastToNullableType:
357     active: false
358   Deprecation:
359     active: false
360   DontDowncastCollectionTypes:
361     active: false
362   DoubleMutabilityForCollection:
363     active: false
364   DuplicateCaseInWhenExpression:
365     active: true
366   EqualsAlwaysReturnsTrueOrFalse:
367     active: true
368   EqualsWithHashCodeExist:
369     active: true
370   ExitOutsideMain:
371     active: false
372   ExplicitGarbageCollectionCall:
373     active: true
374   HasPlatformType:
375     active: false
376   IgnoredReturnValue:
377     active: false
378     restrictToAnnotatedMethods: true
379     returnValueAnnotations:
380       - '*.CheckResult'
381       - '*.CheckReturnValue'
382     ignoreReturnValueAnnotations:
383       - '*.CanIgnoreReturnValue'
384   ImplicitDefaultLocale:
385     active: false
386   ImplicitUnitReturnType:
387     active: false
388     allowExplicitReturnType: true
389   InvalidRange:
390     active: true
391   IteratorHasNextCallsNextMethod:
392     active: true
393   IteratorNotThrowingNoSuchElementException:
394     active: true
395   LateinitUsage:
396     active: false
397     ignoreOnClassesPattern: ''
398   MapGetWithNotNullAssertionOperator:
399     active: false
400   MissingPackageDeclaration:
401     active: false
402     excludes: ['**/*.kts']
403   MissingWhenCase:
404     active: true
405     allowElseExpression: true
406   NullableToStringCall:
407     active: false
408   RedundantElseInWhen:
409     active: true
410   UnconditionalJumpStatementInLoop:
411     active: false
412   UnnecessaryNotNullOperator:
413     active: true
414   UnnecessarySafeCall:
415     active: true
416   UnreachableCatchBlock:
417     active: false
418   UnreachableCode:
419     active: true
420   UnsafeCallOnNullableType:
421     active: true
422   UnsafeCast:
423     active: true
424   UnusedUnaryOperator:
425     active: false
426   UselessPostfixExpression:
427     active: false
428   WrongEqualsTypeParameter:
429     active: true
431 style:
432   active: true
433   ClassOrdering:
434     active: false
435   CollapsibleIfStatements:
436     active: true
437   DataClassContainsFunctions:
438     active: false
439     conversionFunctionPrefix: 'to'
440   DataClassShouldBeImmutable:
441     active: false
442   DestructuringDeclarationWithTooManyEntries:
443     active: false
444     maxDestructuringEntries: 3
445   EqualsNullCall:
446     active: true
447   EqualsOnSignatureLine:
448     active: false
449   ExplicitCollectionElementAccessMethod:
450     active: false
451   ExplicitItLambdaParameter:
452     active: false
453   ExpressionBodySyntax:
454     active: false
455     includeLineWrapping: false
456   ForbiddenComment:
457     active: true
458     values:
459       - 'FIXME:'
460       - 'STOPSHIP:'
461       - 'TODO:'
462     allowedPatterns: ''
463     customMessage: ''
464   ForbiddenImport:
465     active: false
466     imports: []
467     forbiddenPatterns: ''
468   ForbiddenMethodCall:
469     active: false
470     methods:
471       - 'kotlin.io.print'
472       - 'kotlin.io.println'
473   ForbiddenPublicDataClass:
474     active: true
475     excludes: ['**']
476     ignorePackages:
477       - '*.internal'
478       - '*.internal.*'
479   ForbiddenVoid:
480     active: false
481     ignoreOverridden: false
482     ignoreUsageInGenerics: false
483   FunctionOnlyReturningConstant:
484     active: true
485     ignoreOverridableFunction: true
486     ignoreActualFunction: true
487     excludedFunctions: ''
488   LibraryCodeMustSpecifyReturnType:
489     active: true
490     excludes: ['**']
491   LibraryEntitiesShouldNotBePublic:
492     active: true
493     excludes: ['**']
494   LoopWithTooManyJumpStatements:
495     active: false
496     maxJumpCount: 1
497   MagicNumber:
498     active: true
499     ignoreNumbers:
500       - '-1'
501       - '0'
502       - '1'
503       - '2'
504     ignoreHashCodeFunction: true
505     ignorePropertyDeclaration: true
506     ignoreLocalVariableDeclaration: false
507     ignoreConstantDeclaration: true
508     ignoreCompanionObjectPropertyDeclaration: true
509     ignoreAnnotation: false
510     ignoreNamedArgument: true
511     ignoreEnums: false
512     ignoreRanges: false
513     ignoreExtensionFunctions: true
514   MandatoryBracesIfStatements:
515     active: true
516   MandatoryBracesLoops:
517     active: false
518   MaxLineLength:
519     active: true
520     maxLineLength: 120
521     excludePackageStatements: true
522     excludeImportStatements: true
523     excludeCommentStatements: false
524   MayBeConst:
525     active: true
526   ModifierOrder:
527     active: true
528   MultilineLambdaItParameter:
529     active: false
530   NestedClassesVisibility:
531     active: true
532   NewLineAtEndOfFile:
533     active: true
534   NoTabs:
535     active: true
536   ObjectLiteralToLambda:
537     active: false
538   OptionalAbstractKeyword:
539     active: true
540   OptionalUnit:
541     active: false
542   OptionalWhenBraces:
543     active: false
544   PreferToOverPairSyntax:
545     active: false
546   ProtectedMemberInFinalClass:
547     active: true
548   RedundantExplicitType:
549     active: false
550   RedundantHigherOrderMapUsage:
551     active: false
552   RedundantVisibilityModifierRule:
553     active: false
554   ReturnCount:
555     active: true
556     max: 3
557     excludedFunctions: 'equals'
558     excludeLabeled: false
559     excludeReturnFromLambda: true
560     excludeGuardClauses: false
561   SafeCast:
562     active: true
563   SerialVersionUIDInSerializableClass:
564     active: true
565   SpacingBetweenPackageAndImports:
566     active: true
567   ThrowsCount:
568     active: true
569     max: 2
570     excludeGuardClauses: false
571   TrailingWhitespace:
572     active: false
573   UnderscoresInNumericLiterals:
574     active: false
575     acceptableLength: 4
576   UnnecessaryAbstractClass:
577     active: true
578   UnnecessaryAnnotationUseSiteTarget:
579     active: false
580   UnnecessaryApply:
581     active: true
582   UnnecessaryFilter:
583     active: false
584   UnnecessaryInheritance:
585     active: true
586   UnnecessaryLet:
587     active: false
588   UnnecessaryParentheses:
589     active: false
590   UntilInsteadOfRangeTo:
591     active: false
592   UnusedImports:
593     active: false
594   UnusedPrivateClass:
595     active: true
596   UnusedPrivateMember:
597     active: true
598     allowedNames: '(_|ignored|expected|serialVersionUID)'
599     ignoreAnnotated: ['Composable']
600   UseAnyOrNoneInsteadOfFind:
601     active: false
602   UseArrayLiteralsInAnnotations:
603     active: false
604   UseCheckNotNull:
605     active: true
606   UseCheckOrError:
607     active: false
608   UseDataClass:
609     active: false
610     allowVars: false
611   UseEmptyCounterpart:
612     active: false
613   UseIfEmptyOrIfBlank:
614     active: false
615   UseIfInsteadOfWhen:
616     active: false
617   UseIsNullOrEmpty:
618     active: false
619   UseOrEmpty:
620     active: true
621   UseRequire:
622     active: true
623   UseRequireNotNull:
624     active: true
625   UselessCallOnNotNull:
626     active: true
627   UtilityClassWithPublicConstructor:
628     active: true
629   VarCouldBeVal:
630     active: true
631   WildcardImport:
632     active: true
633     excludeImports:
634       - 'java.util.*'