-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdetekt.yml
More file actions
442 lines (429 loc) · 16.1 KB
/
Copy pathdetekt.yml
File metadata and controls
442 lines (429 loc) · 16.1 KB
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
build:
maxIssues: 0
excludeCorrectable: false
weights:
complexity: 2
LongParameterList: 1
style: 1
comments: 1
config:
validation: true
warningsAsErrors: true
console-reports:
active: true
formatting:
active: true
android: false
autoCorrect: true
ImportOrderingRule:
active: true
autoCorrect: true
layout:
- 'java.*'
- 'javax.*'
- 'kotlin.*'
- 'kotlinx.*'
- '^'
IndentationRule:
active: true
autoCorrect: true
indentSize: 2
MaxLineLengthRule:
active: true
maxLineLength: 180
excludeCommentStatements: true
ModifierOrderRule:
active: true
autoCorrect: true
MultiLineIfElseRule:
active: true
autoCorrect: true
NoConsecutiveBlankLinesRule:
active: true
autoCorrect: true
NoEmptyClassBodyRule:
active: true
autoCorrect: true
complexity:
active: true
# This rule checks for complex conditions.
# Documentation: https://detekt.dev/docs/rules/complexity/#complexcondition
ComplexCondition:
active: true
threshold: 4
# This rule checks for complex methods.
# Documentation: https://detekt.dev/docs/rules/complexity/#cognitivecomplexmethod
CyclomaticComplexMethod:
active: true
# This rule checks for large classes.
# Documentation: https://detekt.dev/docs/rules/complexity/#largeclass
LargeClass:
active: true
excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt'
threshold: 600
# This rule checks for long methods.
# Documentation: https://detekt.dev/docs/rules/complexity/#longmethod
LongMethod:
active: true
excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt'
threshold: 60
# This rule checks for long parameter lists.
# Documentation: https://detekt.dev/docs/rules/complexity/#longparameterlist
LongParameterList:
active: true
functionThreshold: 6
constructorThreshold: 6
# This rule checks for nested block depth.
# Documentation: https://detekt.dev/docs/rules/complexity/#nestedblockdepth
NestedBlockDepth:
active: true
threshold: 4
# This rule checks for string literal duplication.
# Documentation: https://detekt.dev/docs/rules/complexity/#stringliteralduplication
StringLiteralDuplication:
active: true
# Documentation: https://detekt.dev/docs/rules/coroutines/
coroutines:
active: true
# This rule checks for the usage of GlobalScope.
# Documentation: https://detekt.dev/docs/rules/complexity/#globalcoroutineusage
GlobalCoroutineUsage:
active: true
# This rule checks for redundant suspend modifiers.
# Documentation: https://detekt.dev/docs/rules/coroutines#redundantsuspendmodifier
RedundantSuspendModifier:
active: true
# Documentation: https://detekt.dev/docs/rules/#empty-blocks/
empty-blocks:
active: true
# This rule checks for empty catch blocks.
# Documentation: https://detekt.dev/docs/rules/#emptycatchblock
EmptyCatchBlock:
active: true
# This rule checks for empty class blocks.
# Documentation: https://detekt.dev/docs/rules/#emptyclassblock
EmptyClassBlock:
active: true
# This rule checks for empty default constructors.
# Documentation: https://detekt.dev/docs/rules/#emptydefaultconstructor
EmptyDefaultConstructor:
active: true
# This rule checks for empty do-while blocks.
# Documentation: https://detekt.dev/docs/rules/#emptydowhileblock
EmptyDoWhileBlock:
active: true
# This rule checks for empty else blocks.
# Documentation: https://detekt.dev/docs/rules/#emptyelseblock
EmptyElseBlock:
active: true
# This rule checks for empty finally blocks.
# Documentation: https://detekt.dev/docs/rules/#emptyfinallyblock
EmptyFinallyBlock:
active: true
# This rule checks for empty for blocks.
# Documentation: https://detekt.dev/docs/rules/#emptyforblock
EmptyForBlock:
active: true
# This rule checks for empty function blocks.
# Documentation: https://detekt.dev/docs/rules/#emptyfunctionblock
EmptyFunctionBlock:
active: false
# This rule checks for empty if blocks.
# Documentation: https://detekt.dev/docs/rules/#emptyifblock
EmptyIfBlock:
active: true
# This rule checks for empty init blocks.
# Documentation: https://detekt.dev/docs/rules/#emptyinitblock
EmptyInitBlock:
active: true
# This rule checks for empty Kotlin files.
# Documentation: https://detekt.dev/docs/rules/#emptyktfile
EmptyKtFile:
active: true
# This rule checks for empty secondary constructors.
# Documentation: https://detekt.dev/docs/rules/#emptysecondaryconstructor
EmptySecondaryConstructor:
active: true
# This rule checks for empty try blocks.
# Documentation: https://detekt.dev/docs/rules/#emptytryblock
EmptyTryBlock:
active: true
# This rule checks for empty when blocks.
# Documentation: https://detekt.dev/docs/rules/#emptywhenblock
EmptyWhenBlock:
active: true
# This rule checks for empty while blocks.
# Documentation: https://detekt.dev/docs/rules/#emptywhileblock
EmptyWhileBlock:
active: true
# Documentation: https://detekt.dev/docs/rules/exceptions/
exceptions:
active: true
# This rule checks for instance of checks for exceptions.
# Documentation: https://detekt.dev/docs/rules/exceptions#instanceofcheckforexception
InstanceOfCheckForException:
active: true
# This rule checks for not implemented declarations.
# Documentation: https://detekt.dev/docs/rules/exceptions#notimplementeddeclaration
NotImplementedDeclaration:
active: true
# Documentation: https://detekt.dev/docs/rules/exceptions#printstacktrace
# This rule checks for print stack trace calls.
PrintStackTrace:
active: true
# Documentation: https://detekt.dev/docs/rules/exceptions/#rethrowcaughtexception
# This rule checks for rethrowing caught exceptions.
RethrowCaughtException:
active: true
# Documentation: https://detekt.dev/docs/rules/exceptions#printstacktrace
# This rule checks for return from finally blocks.
ReturnFromFinally:
active: true
# Documentation: https://detekt.dev/docs/rules/exceptions/#returnfromfinally
# This rule checks for swallowed exceptions.
SwallowedException:
active: false
# Documentation: https://detekt.dev/docs/rules/exceptions/#throwingexceptionfromfinally
# This rule checks for throwing exceptions from finally blocks.
ThrowingExceptionFromFinally:
active: true
# Documentation: https://detekt.dev/docs/rules/exceptions/#throwingexceptioninmain
# This rule checks for throwing exceptions in main.
ThrowingExceptionInMain:
active: true
# Documentation: https://detekt.dev/docs/rules/exceptions/#throwingexceptionswithoutmessageorcause
# This rule checks for throwing exceptions without message or cause.
ThrowingExceptionsWithoutMessageOrCause:
active: true
# Documentation: https://detekt.dev/docs/rules/exceptions/#throwingnewinstanceofsameexception
# This rule checks for throwing new instance of same exception.
ThrowingNewInstanceOfSameException:
active: true
# Documentation: https://detekt.dev/docs/rules/exceptions/#toogenericexceptioncaught
# This rule checks for too generic exception caught.
TooGenericExceptionCaught:
active: false
# Documentation: https://detekt.dev/docs/rules/exceptions/#toogenericexceptionthrown
# This rule checks for too generic exception thrown.
TooGenericExceptionThrown:
active: true
exceptionNames:
- Error
- Exception
- Throwable
- RuntimeException
performance:
active: true
# Documentation: https://detekt.dev/docs/rules/performance#arrayprimitive
# This rule checks for array primitive.
ArrayPrimitive:
active: true
# Documentation: https://detekt.dev/docs/rules/performance#foreachonrange
# This rule checks for for-each on range.
ForEachOnRange:
active: true
# Documentation: https://detekt.dev/docs/rules/performance#spreadoperator
# This rule checks for spread operator.
UnnecessaryTemporaryInstantiation:
active: true
# Documentation: https://detekt.dev/docs/rules/naming/
naming:
active: true
# This rule checks for class naming.
# Documentation: https://detekt.dev/docs/rules/naming#classnaming
ClassNaming:
active: true
# This rule checks for enum naming.
# Documentation: https://detekt.dev/docs/rules/naming#enumnaming
EnumNaming:
active: true
# This rule checks for function max length.
# Documentation: https://detekt.dev/docs/rules/naming#functionmaxlength
FunctionMaxLength:
active: false
maximumFunctionNameLength: 30
# This rule checks for function min length.
# Documentation: https://detekt.dev/docs/rules/naming#functionminlength
FunctionMinLength:
active: false
minimumFunctionNameLength: 3
# This rule checks for function naming.
# Documentation: https://detekt.dev/docs/rules/naming#functionnaming
FunctionNaming:
active: true
excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt'
# This rule checks for package naming.
# Documentation: https://detekt.dev/docs/rules/naming#packagenaming
PackageNaming:
active: true
packagePattern: '[a-z`]+(\.[a-z`][A-Za-z0-9]*)*'
# This rule checks for variable max length.
# Documentation: https://detekt.dev/docs/rules/naming#variablemaxlength
VariableMaxLength:
active: false
maximumVariableNameLength: 40
# This rule checks for variable min length.
# Documentation: https://detekt.dev/docs/rules/naming#variableminlength
VariableMinLength:
active: false
minimumVariableNameLength: 1
# This rule checks for variable naming.
# Documentation: https://detekt.dev/docs/rules/naming#variablenaming
VariableNaming:
active: true
# Documentation: https://detekt.dev/docs/rules/potential-bugs/
potential-bugs:
active: true
# Documentation: https://detekt.dev/docs/rules/potential-bugs#equalsalwaysreturnstrueorfalse
# This rule checks if equals always returns true or false.
EqualsAlwaysReturnsTrueOrFalse:
active: true
# Documentation: https://detekt.dev/docs/rules/potential-bugs#equalswithhashcodeexist
# This rule checks if equals and hashCode exist together.
EqualsWithHashCodeExist:
active: true
# Documentation: https://detekt.dev/docs/rules/potential-bugs#explicitgarbagecollectioncall
# This rule checks for explicit garbage collection calls.
ExplicitGarbageCollectionCall:
active: true
# Documentation: https://detekt.dev/docs/rules/potential-bugs#invalidrange
# This rule checks for invalid ranges.
InvalidRange:
active: true
# Documentation: https://detekt.dev/docs/rules/potential-bugs#iteratorhasnextcallsnextmethod
# This rule checks if hasNext is called before next in an iterator.
IteratorHasNextCallsNextMethod:
active: true
# Documentation: https://detekt.dev/docs/rules/potential-bugs#iteratornotthrowingnosuchelementexception
# This rule checks if an iterator throws NoSuchElementException.
IteratorNotThrowingNoSuchElementException:
active: true
# Documentation: https://detekt.dev/docs/rules/potential-bugs#unconditionaljumpstatementinloop
# This rule checks for unconditional jump statements in loops.
UnconditionalJumpStatementInLoop:
active: true
# Documentation: https://detekt.dev/docs/rules/potential-bugs#unreachablecode
# This rule checks for unreachable code.
UnreachableCode:
active: true
# Documentation: https://detekt.dev/docs/rules/potential-bugs#unsafecallonnullabletype
# This rule checks for unsafe calls on nullable types.
UnsafeCallOnNullableType:
active: true
# Documentation: https://detekt.dev/docs/rules/potential-bugs#unsafecast
# This rule checks for unsafe casts.
UnsafeCast:
active: true
# Documentation: https://detekt.dev/docs/rules/potential-bugs#uselesspostfixexpression
# This rule checks for useless postfix expressions.
UselessPostfixExpression:
active: true
style:
active: true
# This rule checks for loops with too many jump statements.
# Documentation: https://detekt.dev/docs/rules/style#loopwithtoomanyjumpstatements
LoopWithTooManyJumpStatements:
active: true
maxJumpCount: 1
# This rule checks for magic numbers.
# Documentation: https://detekt.dev/docs/rules/style#magicnumber
MagicNumber:
active: true
excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt'
ignoreHashCodeFunction: true
ignorePropertyDeclaration: true
ignoreLocalVariableDeclaration: true
ignoreConstantDeclaration: true
ignoreCompanionObjectPropertyDeclaration: true
ignoreAnnotation: true
ignoreNamedArgument: true
ignoreEnums: true
ignoreRanges: true
# This rule checks for mandatory braces in if statements.
# Documentation: https://detekt.dev/docs/rules/style#maxlinelength
MaxLineLength:
active: true
excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt'
maxLineLength: 120
excludePackageStatements: true
excludeImportStatements: true
excludeCommentStatements: false
# This rule checks if a value can be declared as const.
# Documentation: https://detekt.dev/docs/rules/style#maybeconst
MayBeConst:
active: true
# This rule checks for modifier order.
# Documentation: https://detekt.dev/docs/rules/style#modifierorder
ModifierOrder:
active: true
# This rule checks for visibility of nested classes.
# Documentation: https://detekt.dev/docs/rules/style#nestedclassesvisibility
NestedClassesVisibility:
active: false
# This rule checks for a new line at the end of a file.
# Documentation: https://detekt.dev/docs/rules/style#newlineatendoffile
NewLineAtEndOfFile:
active: true
# This rule checks if the abstract keyword is optional.
# Documentation: https://detekt.dev/docs/rules/style#optionalabstractkeyword
OptionalAbstractKeyword:
active: true
# This rule checks if to is preferred over pair syntax.
# Documentation: https://detekt.dev/docs/rules/style#protectedmemberinfinalclass
ProtectedMemberInFinalClass:
active: true
# This rule checks for safe casts.
# Documentation: https://detekt.dev/docs/rules/style#safecast
SafeCast:
active: true
# This rule checks for serialVersionUID in serializable classes.
# Documentation: https://detekt.dev/docs/rules/style#serialversionuidinserializableclass
SerialVersionUIDInSerializableClass:
active: true
# This rule checks for spacing between package and imports.
# Documentation: https://detekt.dev/docs/rules/style#spacingbetweenpackageandimports
SpacingBetweenPackageAndImports:
active: false
# This rule checks for the number of throws in a function.
# Documentation: https://detekt.dev/docs/rules/style#throwscount
ThrowsCount:
active: false
max: 2
# This rule checks for trailing whitespace.
# Documentation: https://detekt.dev/docs/rules/style#trailingwhitespace
TrailingWhitespace:
active: false
# This rule checks for unnecessary abstract classes.
# Documentation: https://detekt.dev/docs/rules/style#unnecessaryabstractclass
UnnecessaryAbstractClass:
active: true
ignoreAnnotated: 'dagger.Module'
# This rule checks for unnecessary annotation use site targets.
# Documentation: https://detekt.dev/docs/rules/style#unnecessaryapply
UnnecessaryApply:
active: false
# This rule checks for unnecessary inheritance.
# Documentation: https://detekt.dev/docs/rules/style#unnecessaryinheritance
UnnecessaryInheritance:
active: true
# This rule checks for unused imports.
# Documentation: https://detekt.dev/docs/rules/style#unusedimports
UnusedImports:
active: true
# This rule checks for unused private classes.
# Documentation: https://detekt.dev/docs/rules/style#unusedprivateclass
UnusedPrivateClass:
active: true
# This rule checks for unused private members.
# Documentation: https://detekt.dev/docs/rules/style#unusedprivatemember
UnusedPrivateMember:
active: true
allowedNames: '(_|ignored|expected|serialVersionUID)'
# This rule checks for array literals in annotations.
# Documentation: https://detekt.dev/docs/rules/style#usearrayliteralsinannotations
UseArrayLiteralsInAnnotations:
active: true
# This rule checks for utility classes with public constructors.
# Documentation: https://detekt.dev/docs/rules/style#utilityclasswithpublicconstructor
UtilityClassWithPublicConstructor:
active: true