detekt.yml 12 KB

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