detekt-config.yml 17 KB

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