detekt-config.yml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  1. build:
  2. maxIssues: 100
  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. allowedExceptionNameRegex: '_|(ignore|expected).*'
  175. ThrowingExceptionFromFinally:
  176. active: false
  177. ThrowingExceptionInMain:
  178. active: false
  179. ThrowingExceptionsWithoutMessageOrCause:
  180. active: false
  181. excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  182. exceptions:
  183. - IllegalArgumentException
  184. - IllegalStateException
  185. - IOException
  186. ThrowingNewInstanceOfSameException:
  187. active: false
  188. TooGenericExceptionCaught:
  189. active: true
  190. excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  191. exceptionNames:
  192. - ArrayIndexOutOfBoundsException
  193. - Error
  194. - Exception
  195. - IllegalMonitorStateException
  196. - NullPointerException
  197. - IndexOutOfBoundsException
  198. - RuntimeException
  199. - Throwable
  200. allowedExceptionNameRegex: '_|(ignore|expected).*'
  201. TooGenericExceptionThrown:
  202. active: true
  203. exceptionNames:
  204. - Error
  205. - Exception
  206. - Throwable
  207. - RuntimeException
  208. formatting:
  209. active: true
  210. android: false
  211. autoCorrect: true
  212. AnnotationOnSeparateLine:
  213. active: false
  214. autoCorrect: true
  215. ChainWrapping:
  216. active: true
  217. autoCorrect: true
  218. CommentSpacing:
  219. active: true
  220. autoCorrect: true
  221. EnumEntryNameCase:
  222. active: false
  223. autoCorrect: true
  224. Filename:
  225. active: true
  226. FinalNewline:
  227. active: true
  228. autoCorrect: true
  229. insertFinalNewLine: true
  230. ImportOrdering:
  231. active: false
  232. autoCorrect: true
  233. layout: 'idea'
  234. Indentation:
  235. active: false
  236. autoCorrect: true
  237. indentSize: 4
  238. continuationIndentSize: 4
  239. MaximumLineLength:
  240. active: true
  241. maxLineLength: 120
  242. ModifierOrdering:
  243. active: true
  244. autoCorrect: true
  245. MultiLineIfElse:
  246. active: true
  247. autoCorrect: true
  248. NoBlankLineBeforeRbrace:
  249. active: true
  250. autoCorrect: true
  251. NoConsecutiveBlankLines:
  252. active: true
  253. autoCorrect: true
  254. NoEmptyClassBody:
  255. active: true
  256. autoCorrect: true
  257. NoEmptyFirstLineInMethodBlock:
  258. active: false
  259. autoCorrect: true
  260. NoLineBreakAfterElse:
  261. active: true
  262. autoCorrect: true
  263. NoLineBreakBeforeAssignment:
  264. active: true
  265. autoCorrect: true
  266. NoMultipleSpaces:
  267. active: true
  268. autoCorrect: true
  269. NoSemicolons:
  270. active: true
  271. autoCorrect: true
  272. NoTrailingSpaces:
  273. active: true
  274. autoCorrect: true
  275. NoUnitReturn:
  276. active: true
  277. autoCorrect: true
  278. NoUnusedImports:
  279. active: true
  280. autoCorrect: true
  281. NoWildcardImports:
  282. active: true
  283. PackageName:
  284. active: true
  285. autoCorrect: true
  286. ParameterListWrapping:
  287. active: true
  288. autoCorrect: true
  289. indentSize: 4
  290. SpacingAroundColon:
  291. active: true
  292. autoCorrect: true
  293. SpacingAroundComma:
  294. active: true
  295. autoCorrect: true
  296. SpacingAroundCurly:
  297. active: true
  298. autoCorrect: true
  299. SpacingAroundDot:
  300. active: true
  301. autoCorrect: true
  302. SpacingAroundDoubleColon:
  303. active: false
  304. autoCorrect: true
  305. SpacingAroundKeyword:
  306. active: true
  307. autoCorrect: true
  308. SpacingAroundOperators:
  309. active: true
  310. autoCorrect: true
  311. SpacingAroundParens:
  312. active: true
  313. autoCorrect: true
  314. SpacingAroundRangeOperator:
  315. active: true
  316. autoCorrect: true
  317. SpacingBetweenDeclarationsWithAnnotations:
  318. active: false
  319. autoCorrect: true
  320. SpacingBetweenDeclarationsWithComments:
  321. active: false
  322. autoCorrect: true
  323. StringTemplate:
  324. active: true
  325. autoCorrect: true
  326. naming:
  327. active: true
  328. ClassNaming:
  329. active: true
  330. excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  331. classPattern: '[A-Z][a-zA-Z0-9]*'
  332. ConstructorParameterNaming:
  333. active: true
  334. excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  335. parameterPattern: '[a-z][A-Za-z0-9]*'
  336. privateParameterPattern: '[a-z][A-Za-z0-9]*'
  337. excludeClassPattern: '$^'
  338. ignoreOverridden: true
  339. EnumNaming:
  340. active: true
  341. excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  342. enumEntryPattern: '[A-Z][_a-zA-Z0-9]*'
  343. ForbiddenClassName:
  344. active: false
  345. excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  346. forbiddenName: []
  347. FunctionMaxLength:
  348. active: false
  349. excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  350. maximumFunctionNameLength: 30
  351. FunctionMinLength:
  352. active: false
  353. excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  354. minimumFunctionNameLength: 3
  355. FunctionNaming:
  356. active: true
  357. excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  358. functionPattern: '([a-z][a-zA-Z0-9]*)|(`.*`)'
  359. excludeClassPattern: '$^'
  360. ignoreOverridden: true
  361. ignoreAnnotated: ['Composable']
  362. FunctionParameterNaming:
  363. active: true
  364. excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  365. parameterPattern: '[a-z][A-Za-z0-9]*'
  366. excludeClassPattern: '$^'
  367. ignoreOverridden: true
  368. InvalidPackageDeclaration:
  369. active: false
  370. rootPackage: ''
  371. MatchingDeclarationName:
  372. active: true
  373. mustBeFirst: true
  374. MemberNameEqualsClassName:
  375. active: true
  376. ignoreOverridden: true
  377. ObjectPropertyNaming:
  378. active: true
  379. excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  380. constantPattern: '[A-Za-z][_A-Za-z0-9]*'
  381. propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
  382. privatePropertyPattern: '(_)?[A-Za-z][_A-Za-z0-9]*'
  383. PackageNaming:
  384. active: true
  385. excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  386. packagePattern: '[a-z]+(\.[a-z][A-Za-z0-9]*)*'
  387. TopLevelPropertyNaming:
  388. active: true
  389. excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  390. constantPattern: '[A-Z][_A-Z0-9]*'
  391. propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
  392. privatePropertyPattern: '_?[A-Za-z][_A-Za-z0-9]*'
  393. VariableMaxLength:
  394. active: false
  395. excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  396. maximumVariableNameLength: 64
  397. VariableMinLength:
  398. active: false
  399. excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  400. minimumVariableNameLength: 1
  401. VariableNaming:
  402. active: true
  403. excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  404. variablePattern: '[a-z][A-Za-z0-9]*'
  405. privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*'
  406. excludeClassPattern: '$^'
  407. ignoreOverridden: true
  408. performance:
  409. active: true
  410. ArrayPrimitive:
  411. active: true
  412. ForEachOnRange:
  413. active: true
  414. excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  415. SpreadOperator:
  416. active: true
  417. excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  418. UnnecessaryTemporaryInstantiation:
  419. active: true
  420. potential-bugs:
  421. active: true
  422. Deprecation:
  423. active: false
  424. DuplicateCaseInWhenExpression:
  425. active: true
  426. EqualsAlwaysReturnsTrueOrFalse:
  427. active: true
  428. EqualsWithHashCodeExist:
  429. active: true
  430. ExplicitGarbageCollectionCall:
  431. active: true
  432. HasPlatformType:
  433. active: false
  434. IgnoredReturnValue:
  435. active: false
  436. restrictToAnnotatedMethods: true
  437. returnValueAnnotations: ['*.CheckReturnValue', '*.CheckResult']
  438. ImplicitDefaultLocale:
  439. active: false
  440. ImplicitUnitReturnType:
  441. active: false
  442. allowExplicitReturnType: true
  443. InvalidRange:
  444. active: true
  445. IteratorHasNextCallsNextMethod:
  446. active: true
  447. IteratorNotThrowingNoSuchElementException:
  448. active: true
  449. LateinitUsage:
  450. active: false
  451. excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  452. excludeAnnotatedProperties: []
  453. ignoreOnClassesPattern: ''
  454. MapGetWithNotNullAssertionOperator:
  455. active: false
  456. MissingWhenCase:
  457. active: true
  458. RedundantElseInWhen:
  459. active: true
  460. UnconditionalJumpStatementInLoop:
  461. active: false
  462. UnnecessaryNotNullOperator:
  463. active: false
  464. UnnecessarySafeCall:
  465. active: false
  466. UnreachableCode:
  467. active: true
  468. UnsafeCallOnNullableType:
  469. active: true
  470. UnsafeCast:
  471. active: false
  472. UselessPostfixExpression:
  473. active: false
  474. WrongEqualsTypeParameter:
  475. active: true
  476. style:
  477. active: true
  478. CollapsibleIfStatements:
  479. active: false
  480. DataClassContainsFunctions:
  481. active: false
  482. conversionFunctionPrefix: 'to'
  483. DataClassShouldBeImmutable:
  484. active: false
  485. EqualsNullCall:
  486. active: true
  487. EqualsOnSignatureLine:
  488. active: false
  489. ExplicitCollectionElementAccessMethod:
  490. active: false
  491. ExplicitItLambdaParameter:
  492. active: false
  493. ExpressionBodySyntax:
  494. active: false
  495. includeLineWrapping: false
  496. ForbiddenComment:
  497. active: true
  498. values: ['TODO:', 'FIXME:', 'STOPSHIP:']
  499. allowedPatterns: ''
  500. ForbiddenImport:
  501. active: false
  502. imports: []
  503. forbiddenPatterns: ''
  504. ForbiddenMethodCall:
  505. active: false
  506. methods: ['kotlin.io.println', 'kotlin.io.print']
  507. ForbiddenPublicDataClass:
  508. active: false
  509. ignorePackages: ['*.internal', '*.internal.*']
  510. ForbiddenVoid:
  511. active: false
  512. ignoreOverridden: false
  513. ignoreUsageInGenerics: false
  514. FunctionOnlyReturningConstant:
  515. active: true
  516. ignoreOverridableFunction: true
  517. excludedFunctions: 'describeContents'
  518. excludeAnnotatedFunction: ['dagger.Provides']
  519. LibraryCodeMustSpecifyReturnType:
  520. active: true
  521. LoopWithTooManyJumpStatements:
  522. active: true
  523. maxJumpCount: 1
  524. MagicNumber:
  525. active: true
  526. excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  527. ignoreNumbers: ['-1', '0', '1', '2']
  528. ignoreHashCodeFunction: true
  529. ignorePropertyDeclaration: false
  530. ignoreLocalVariableDeclaration: false
  531. ignoreConstantDeclaration: true
  532. ignoreCompanionObjectPropertyDeclaration: true
  533. ignoreAnnotation: false
  534. ignoreNamedArgument: true
  535. ignoreEnums: false
  536. ignoreRanges: false
  537. MandatoryBracesIfStatements:
  538. active: false
  539. MandatoryBracesLoops:
  540. active: false
  541. MaxLineLength:
  542. active: true
  543. maxLineLength: 120
  544. excludePackageStatements: true
  545. excludeImportStatements: true
  546. excludeCommentStatements: false
  547. MayBeConst:
  548. active: true
  549. ModifierOrder:
  550. active: true
  551. NestedClassesVisibility:
  552. active: false
  553. NewLineAtEndOfFile:
  554. active: true
  555. NoTabs:
  556. active: false
  557. OptionalAbstractKeyword:
  558. active: true
  559. OptionalUnit:
  560. active: false
  561. OptionalWhenBraces:
  562. active: false
  563. PreferToOverPairSyntax:
  564. active: false
  565. ProtectedMemberInFinalClass:
  566. active: true
  567. RedundantExplicitType:
  568. active: false
  569. RedundantVisibilityModifierRule:
  570. active: false
  571. ReturnCount:
  572. active: true
  573. max: 2
  574. excludedFunctions: 'equals'
  575. excludeLabeled: false
  576. excludeReturnFromLambda: true
  577. excludeGuardClauses: false
  578. SafeCast:
  579. active: true
  580. SerialVersionUIDInSerializableClass:
  581. active: false
  582. SpacingBetweenPackageAndImports:
  583. active: false
  584. ThrowsCount:
  585. active: true
  586. max: 2
  587. TrailingWhitespace:
  588. active: false
  589. UnderscoresInNumericLiterals:
  590. active: false
  591. acceptableDecimalLength: 5
  592. UnnecessaryAbstractClass:
  593. active: true
  594. excludeAnnotatedClasses: ['dagger.Module']
  595. UnnecessaryAnnotationUseSiteTarget:
  596. active: false
  597. UnnecessaryApply:
  598. active: false
  599. UnnecessaryInheritance:
  600. active: true
  601. UnnecessaryLet:
  602. active: false
  603. UnnecessaryParentheses:
  604. active: false
  605. UntilInsteadOfRangeTo:
  606. active: false
  607. UnusedImports:
  608. active: false
  609. UnusedPrivateClass:
  610. active: true
  611. UnusedPrivateMember:
  612. active: false
  613. allowedNames: '(_|ignored|expected|serialVersionUID)'
  614. UseArrayLiteralsInAnnotations:
  615. active: false
  616. UseCheckOrError:
  617. active: false
  618. UseDataClass:
  619. active: false
  620. excludeAnnotatedClasses: []
  621. allowVars: false
  622. UseIfInsteadOfWhen:
  623. active: false
  624. UseRequire:
  625. active: false
  626. UselessCallOnNotNull:
  627. active: true
  628. UtilityClassWithPublicConstructor:
  629. active: true
  630. VarCouldBeVal:
  631. active: false
  632. WildcardImport:
  633. active: true
  634. excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  635. excludeImports: ['java.util.*', 'kotlinx.android.synthetic.*']