detekt.yml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. autoCorrect: true
  2. test-pattern: # Configure exclusions for test sources
  3. active: true
  4. patterns: # Test file regexes
  5. - '.*/test/.*'
  6. - '.*/androidTest/.*'
  7. - '.*Test.kt'
  8. - '.*Spec.kt'
  9. - '.*Spek.kt'
  10. exclude-rule-sets:
  11. - 'comments'
  12. exclude-rules:
  13. - 'NamingRules'
  14. - 'WildcardImport'
  15. - 'MagicNumber'
  16. - 'MaxLineLength'
  17. - 'LateinitUsage'
  18. - 'StringLiteralDuplication'
  19. - 'SpreadOperator'
  20. - 'TooManyFunctions'
  21. - 'ForEachOnRange'
  22. - 'FunctionMaxLength'
  23. - 'TooGenericExceptionCaught'
  24. - 'InstanceOfCheckForException'
  25. build:
  26. maxIssues: 10
  27. weights:
  28. # complexity: 2
  29. # LongParameterList: 1
  30. # style: 1
  31. # comments: 1
  32. processors:
  33. active: true
  34. exclude:
  35. # - 'FunctionCountProcessor'
  36. # - 'PropertyCountProcessor'
  37. # - 'ClassCountProcessor'
  38. # - 'PackageCountProcessor'
  39. # - 'KtFileCountProcessor'
  40. console-reports:
  41. active: true
  42. exclude:
  43. # - 'ProjectStatisticsReport'
  44. # - 'ComplexityReport'
  45. # - 'NotificationReport'
  46. # - 'FindingsReport'
  47. # - 'BuildFailureReport'
  48. comments:
  49. active: true
  50. CommentOverPrivateFunction:
  51. active: false
  52. CommentOverPrivateProperty:
  53. active: false
  54. EndOfSentenceFormat:
  55. active: false
  56. endOfSentenceFormat: ([.?!][ \t\n\r\f<])|([.?!]$)
  57. UndocumentedPublicClass:
  58. active: false
  59. searchInNestedClass: true
  60. searchInInnerClass: true
  61. searchInInnerObject: true
  62. searchInInnerInterface: true
  63. UndocumentedPublicFunction:
  64. active: false
  65. complexity:
  66. active: true
  67. ComplexCondition:
  68. active: true
  69. threshold: 4
  70. ComplexInterface:
  71. active: false
  72. threshold: 10
  73. includeStaticDeclarations: false
  74. ComplexMethod:
  75. active: true
  76. threshold: 10
  77. ignoreSingleWhenExpression: false
  78. ignoreSimpleWhenEntries: false
  79. LabeledExpression:
  80. active: false
  81. ignoredLabels: ""
  82. LargeClass:
  83. active: true
  84. threshold: 600
  85. LongMethod:
  86. active: true
  87. threshold: 60
  88. LongParameterList:
  89. active: true
  90. threshold: 6
  91. ignoreDefaultParameters: false
  92. MethodOverloading:
  93. active: false
  94. threshold: 6
  95. NestedBlockDepth:
  96. active: true
  97. threshold: 4
  98. StringLiteralDuplication:
  99. active: false
  100. threshold: 3
  101. ignoreAnnotation: true
  102. excludeStringsWithLessThan5Characters: true
  103. ignoreStringsRegex: '$^'
  104. TooManyFunctions:
  105. active: true
  106. thresholdInFiles: 11
  107. thresholdInClasses: 11
  108. thresholdInInterfaces: 11
  109. thresholdInObjects: 11
  110. thresholdInEnums: 11
  111. ignoreDeprecated: false
  112. ignorePrivate: false
  113. ignoreOverridden: false
  114. empty-blocks:
  115. active: true
  116. EmptyCatchBlock:
  117. active: true
  118. allowedExceptionNameRegex: "^(_|(ignore|expected).*)"
  119. EmptyClassBlock:
  120. active: true
  121. EmptyDefaultConstructor:
  122. active: true
  123. EmptyDoWhileBlock:
  124. active: true
  125. EmptyElseBlock:
  126. active: true
  127. EmptyFinallyBlock:
  128. active: true
  129. EmptyForBlock:
  130. active: true
  131. EmptyFunctionBlock:
  132. active: true
  133. ignoreOverriddenFunctions: false
  134. EmptyIfBlock:
  135. active: true
  136. EmptyInitBlock:
  137. active: true
  138. EmptyKtFile:
  139. active: true
  140. EmptySecondaryConstructor:
  141. active: true
  142. EmptyWhenBlock:
  143. active: true
  144. EmptyWhileBlock:
  145. active: true
  146. exceptions:
  147. active: true
  148. ExceptionRaisedInUnexpectedLocation:
  149. active: false
  150. methodNames: 'toString,hashCode,equals,finalize'
  151. InstanceOfCheckForException:
  152. active: false
  153. NotImplementedDeclaration:
  154. active: false
  155. PrintStackTrace:
  156. active: false
  157. RethrowCaughtException:
  158. active: false
  159. ReturnFromFinally:
  160. active: false
  161. SwallowedException:
  162. active: false
  163. ignoredExceptionTypes: 'InterruptedException,NumberFormatException,ParseException,MalformedURLException'
  164. ThrowingExceptionFromFinally:
  165. active: false
  166. ThrowingExceptionInMain:
  167. active: false
  168. ThrowingExceptionsWithoutMessageOrCause:
  169. active: false
  170. exceptions: 'IllegalArgumentException,IllegalStateException,IOException'
  171. ThrowingNewInstanceOfSameException:
  172. active: false
  173. TooGenericExceptionCaught:
  174. active: true
  175. exceptionNames:
  176. - ArrayIndexOutOfBoundsException
  177. - Error
  178. - Exception
  179. - IllegalMonitorStateException
  180. - NullPointerException
  181. - IndexOutOfBoundsException
  182. - RuntimeException
  183. - Throwable
  184. allowedExceptionNameRegex: "^(_|(ignore|expected).*)"
  185. TooGenericExceptionThrown:
  186. active: true
  187. exceptionNames:
  188. - Error
  189. - Exception
  190. - Throwable
  191. - RuntimeException
  192. formatting:
  193. active: true
  194. android: false
  195. autoCorrect: true
  196. ChainWrapping:
  197. active: true
  198. autoCorrect: true
  199. CommentSpacing:
  200. active: true
  201. autoCorrect: true
  202. Filename:
  203. active: true
  204. FinalNewline:
  205. active: true
  206. autoCorrect: true
  207. ImportOrdering:
  208. active: false
  209. Indentation:
  210. active: true
  211. autoCorrect: true
  212. indentSize: 4
  213. continuationIndentSize: 4
  214. MaximumLineLength:
  215. active: true
  216. maxLineLength: 120
  217. ModifierOrdering:
  218. active: true
  219. autoCorrect: true
  220. NoBlankLineBeforeRbrace:
  221. active: true
  222. autoCorrect: true
  223. NoConsecutiveBlankLines:
  224. active: true
  225. autoCorrect: true
  226. NoEmptyClassBody:
  227. active: true
  228. autoCorrect: true
  229. NoItParamInMultilineLambda:
  230. active: false
  231. NoLineBreakAfterElse:
  232. active: true
  233. autoCorrect: true
  234. NoLineBreakBeforeAssignment:
  235. active: true
  236. autoCorrect: true
  237. NoMultipleSpaces:
  238. active: true
  239. autoCorrect: true
  240. NoSemicolons:
  241. active: true
  242. autoCorrect: true
  243. NoTrailingSpaces:
  244. active: true
  245. autoCorrect: true
  246. NoUnitReturn:
  247. active: true
  248. autoCorrect: true
  249. NoUnusedImports:
  250. active: true
  251. autoCorrect: true
  252. NoWildcardImports:
  253. active: true
  254. autoCorrect: true
  255. PackageName:
  256. active: true
  257. autoCorrect: true
  258. ParameterListWrapping:
  259. active: true
  260. autoCorrect: true
  261. indentSize: 4
  262. SpacingAroundColon:
  263. active: true
  264. autoCorrect: true
  265. SpacingAroundComma:
  266. active: true
  267. autoCorrect: true
  268. SpacingAroundCurly:
  269. active: true
  270. autoCorrect: true
  271. SpacingAroundKeyword:
  272. active: true
  273. autoCorrect: true
  274. SpacingAroundOperators:
  275. active: true
  276. autoCorrect: true
  277. SpacingAroundParens:
  278. active: true
  279. autoCorrect: true
  280. SpacingAroundRangeOperator:
  281. active: true
  282. autoCorrect: true
  283. StringTemplate:
  284. active: true
  285. autoCorrect: true
  286. naming:
  287. active: true
  288. ClassNaming:
  289. active: true
  290. classPattern: '[A-Z$][a-zA-Z0-9$]*'
  291. ConstructorParameterNaming:
  292. active: true
  293. parameterPattern: '[a-z][A-Za-z0-9]*'
  294. privateParameterPattern: '[a-z][A-Za-z0-9]*'
  295. excludeClassPattern: '$^'
  296. EnumNaming:
  297. active: true
  298. enumEntryPattern: '^[A-Z][_a-zA-Z0-9]*'
  299. ForbiddenClassName:
  300. active: false
  301. forbiddenName: ''
  302. FunctionMaxLength:
  303. active: false
  304. maximumFunctionNameLength: 30
  305. FunctionMinLength:
  306. active: false
  307. minimumFunctionNameLength: 3
  308. FunctionNaming:
  309. active: true
  310. functionPattern: '^([a-z$][a-zA-Z$0-9]*)|(`.*`)$'
  311. excludeClassPattern: '$^'
  312. ignoreOverridden: true
  313. FunctionParameterNaming:
  314. active: true
  315. parameterPattern: '[a-z][A-Za-z0-9]*'
  316. excludeClassPattern: '$^'
  317. ignoreOverriddenFunctions: true
  318. MatchingDeclarationName:
  319. active: true
  320. MemberNameEqualsClassName:
  321. active: false
  322. ignoreOverriddenFunction: true
  323. ObjectPropertyNaming:
  324. active: true
  325. constantPattern: '[A-Za-z][_A-Za-z0-9]*'
  326. propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
  327. privatePropertyPattern: '(_)?[A-Za-z][_A-Za-z0-9]*'
  328. PackageNaming:
  329. active: true
  330. packagePattern: '^[a-z]+(\.[a-z][A-Za-z0-9]*)*$'
  331. TopLevelPropertyNaming:
  332. active: true
  333. constantPattern: '[A-Z][_A-Z0-9]*'
  334. propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
  335. privatePropertyPattern: '(_)?[A-Za-z][A-Za-z0-9]*'
  336. VariableMaxLength:
  337. active: false
  338. maximumVariableNameLength: 64
  339. VariableMinLength:
  340. active: false
  341. minimumVariableNameLength: 1
  342. VariableNaming:
  343. active: true
  344. variablePattern: '[a-z][A-Za-z0-9]*'
  345. privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*'
  346. excludeClassPattern: '$^'
  347. ignoreOverridden: true
  348. performance:
  349. active: true
  350. ArrayPrimitive:
  351. active: false
  352. ForEachOnRange:
  353. active: true
  354. SpreadOperator:
  355. active: true
  356. UnnecessaryTemporaryInstantiation:
  357. active: true
  358. potential-bugs:
  359. active: true
  360. DuplicateCaseInWhenExpression:
  361. active: true
  362. EqualsAlwaysReturnsTrueOrFalse:
  363. active: false
  364. EqualsWithHashCodeExist:
  365. active: true
  366. ExplicitGarbageCollectionCall:
  367. active: true
  368. InvalidRange:
  369. active: false
  370. IteratorHasNextCallsNextMethod:
  371. active: false
  372. IteratorNotThrowingNoSuchElementException:
  373. active: false
  374. LateinitUsage:
  375. active: false
  376. excludeAnnotatedProperties: ""
  377. ignoreOnClassesPattern: ""
  378. UnconditionalJumpStatementInLoop:
  379. active: false
  380. UnreachableCode:
  381. active: true
  382. UnsafeCallOnNullableType:
  383. active: false
  384. UnsafeCast:
  385. active: false
  386. UselessPostfixExpression:
  387. active: false
  388. WrongEqualsTypeParameter:
  389. active: false
  390. style:
  391. active: true
  392. CollapsibleIfStatements:
  393. active: false
  394. DataClassContainsFunctions:
  395. active: false
  396. conversionFunctionPrefix: 'to'
  397. EqualsNullCall:
  398. active: false
  399. EqualsOnSignatureLine:
  400. active: false
  401. ExplicitItLambdaParameter:
  402. active: false
  403. ExpressionBodySyntax:
  404. active: false
  405. includeLineWrapping: false
  406. ForbiddenComment:
  407. active: true
  408. values: 'TODO:,FIXME:,STOPSHIP:'
  409. ForbiddenImport:
  410. active: false
  411. imports: ''
  412. ForbiddenVoid:
  413. active: false
  414. FunctionOnlyReturningConstant:
  415. active: false
  416. ignoreOverridableFunction: true
  417. excludedFunctions: 'describeContents'
  418. LoopWithTooManyJumpStatements:
  419. active: false
  420. maxJumpCount: 1
  421. MagicNumber:
  422. active: true
  423. ignoreNumbers: '-1,0,1,2'
  424. ignoreHashCodeFunction: true
  425. ignorePropertyDeclaration: false
  426. ignoreConstantDeclaration: true
  427. ignoreCompanionObjectPropertyDeclaration: true
  428. ignoreAnnotation: false
  429. ignoreNamedArgument: true
  430. ignoreEnums: false
  431. MandatoryBracesIfStatements:
  432. active: false
  433. MaxLineLength:
  434. active: true
  435. maxLineLength: 120
  436. excludePackageStatements: true
  437. excludeImportStatements: true
  438. excludeCommentStatements: false
  439. MayBeConst:
  440. active: false
  441. ModifierOrder:
  442. active: true
  443. NestedClassesVisibility:
  444. active: false
  445. NewLineAtEndOfFile:
  446. active: true
  447. NoTabs:
  448. active: false
  449. OptionalAbstractKeyword:
  450. active: true
  451. OptionalUnit:
  452. active: false
  453. OptionalWhenBraces:
  454. active: false
  455. PreferToOverPairSyntax:
  456. active: false
  457. ProtectedMemberInFinalClass:
  458. active: false
  459. RedundantVisibilityModifierRule:
  460. active: false
  461. ReturnCount:
  462. active: true
  463. max: 2
  464. excludedFunctions: "equals"
  465. excludeLabeled: false
  466. excludeReturnFromLambda: true
  467. SafeCast:
  468. active: true
  469. SerialVersionUIDInSerializableClass:
  470. active: false
  471. SpacingBetweenPackageAndImports:
  472. active: false
  473. ThrowsCount:
  474. active: true
  475. max: 2
  476. TrailingWhitespace:
  477. active: false
  478. UnderscoresInNumericLiterals:
  479. active: false
  480. acceptableDecimalLength: 5
  481. UnnecessaryAbstractClass:
  482. active: false
  483. excludeAnnotatedClasses: "dagger.Module"
  484. UnnecessaryApply:
  485. active: false
  486. UnnecessaryInheritance:
  487. active: false
  488. UnnecessaryLet:
  489. active: false
  490. UnnecessaryParentheses:
  491. active: false
  492. UntilInsteadOfRangeTo:
  493. active: false
  494. UnusedImports:
  495. active: false
  496. UnusedPrivateClass:
  497. active: false
  498. UnusedPrivateMember:
  499. active: false
  500. allowedNames: "(_|ignored|expected|serialVersionUID)"
  501. UseDataClass:
  502. active: false
  503. excludeAnnotatedClasses: ""
  504. UtilityClassWithPublicConstructor:
  505. active: false
  506. VarCouldBeVal:
  507. active: false
  508. WildcardImport:
  509. active: true
  510. excludeImports: 'java.util.*,kotlinx.android.synthetic.*'