detekt.yml 11 KB

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