detekt.yml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. # SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors
  2. # SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
  3. build:
  4. maxIssues: 2
  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: 7
  71. constructorThreshold: 6
  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: [toString,hashCode,equals,finalize]
  132. InstanceOfCheckForException:
  133. active: false
  134. NotImplementedDeclaration:
  135. active: false
  136. PrintStackTrace:
  137. active: false
  138. RethrowCaughtException:
  139. active: false
  140. ReturnFromFinally:
  141. active: false
  142. SwallowedException:
  143. active: false
  144. ignoredExceptionTypes: [InterruptedException,NumberFormatException,ParseException,MalformedURLException]
  145. ThrowingExceptionFromFinally:
  146. active: false
  147. ThrowingExceptionInMain:
  148. active: false
  149. ThrowingExceptionsWithoutMessageOrCause:
  150. active: false
  151. exceptions: [IllegalArgumentException,IllegalStateException,IOException]
  152. ThrowingNewInstanceOfSameException:
  153. active: false
  154. TooGenericExceptionCaught:
  155. active: true
  156. exceptionNames:
  157. - ArrayIndexOutOfBoundsException
  158. - Error
  159. - Exception
  160. - IllegalMonitorStateException
  161. - NullPointerException
  162. - IndexOutOfBoundsException
  163. - RuntimeException
  164. - Throwable
  165. allowedExceptionNameRegex: "^(_|(ignore|expected).*)"
  166. TooGenericExceptionThrown:
  167. active: true
  168. exceptionNames:
  169. - Error
  170. - Exception
  171. - Throwable
  172. - RuntimeException
  173. naming:
  174. active: true
  175. ClassNaming:
  176. active: true
  177. classPattern: '[A-Z$][a-zA-Z0-9$]*'
  178. ConstructorParameterNaming:
  179. active: true
  180. parameterPattern: '[a-z][A-Za-z0-9]*'
  181. privateParameterPattern: '[a-z][A-Za-z0-9]*'
  182. excludeClassPattern: '$^'
  183. EnumNaming:
  184. active: true
  185. enumEntryPattern: '^[A-Z][_a-zA-Z0-9]*'
  186. ForbiddenClassName:
  187. active: false
  188. forbiddenName: []
  189. FunctionMaxLength:
  190. active: false
  191. maximumFunctionNameLength: 30
  192. FunctionMinLength:
  193. active: false
  194. minimumFunctionNameLength: 3
  195. FunctionNaming:
  196. active: true
  197. functionPattern: '^([a-z$A-Z][a-zA-Z$0-9]*)|(`.*`)$'
  198. excludeClassPattern: '$^'
  199. ignoreOverridden: true
  200. excludes:
  201. - "**/*Test.kt"
  202. - "**/*IT.kt"
  203. FunctionParameterNaming:
  204. active: true
  205. parameterPattern: '[a-z][A-Za-z0-9]*'
  206. excludeClassPattern: '$^'
  207. ignoreOverridden: true
  208. MatchingDeclarationName:
  209. active: true
  210. MemberNameEqualsClassName:
  211. active: false
  212. ignoreOverridden: true
  213. ObjectPropertyNaming:
  214. active: true
  215. constantPattern: '[A-Za-z][_A-Za-z0-9]*'
  216. propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
  217. privatePropertyPattern: '(_)?[A-Za-z][_A-Za-z0-9]*'
  218. PackageNaming:
  219. active: true
  220. packagePattern: '^[a-z]+(\.[a-z][A-Za-z0-9]*)*$'
  221. TopLevelPropertyNaming:
  222. active: true
  223. constantPattern: '[A-Z][_A-Z0-9]*'
  224. propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
  225. privatePropertyPattern: '(_)?[A-Za-z][A-Za-z0-9]*'
  226. VariableMaxLength:
  227. active: false
  228. maximumVariableNameLength: 64
  229. VariableMinLength:
  230. active: false
  231. minimumVariableNameLength: 1
  232. VariableNaming:
  233. active: true
  234. variablePattern: '[a-z][A-Za-z0-9]*'
  235. privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*'
  236. excludeClassPattern: '$^'
  237. ignoreOverridden: true
  238. performance:
  239. active: true
  240. ArrayPrimitive:
  241. active: false
  242. ForEachOnRange:
  243. active: true
  244. SpreadOperator:
  245. active: true
  246. UnnecessaryTemporaryInstantiation:
  247. active: true
  248. potential-bugs:
  249. active: true
  250. DuplicateCaseInWhenExpression:
  251. active: true
  252. EqualsAlwaysReturnsTrueOrFalse:
  253. active: false
  254. EqualsWithHashCodeExist:
  255. active: true
  256. ExplicitGarbageCollectionCall:
  257. active: true
  258. InvalidRange:
  259. active: false
  260. IteratorHasNextCallsNextMethod:
  261. active: false
  262. IteratorNotThrowingNoSuchElementException:
  263. active: false
  264. LateinitUsage:
  265. active: false
  266. ignoreAnnotated: []
  267. ignoreOnClassesPattern: ""
  268. UnconditionalJumpStatementInLoop:
  269. active: false
  270. UnreachableCode:
  271. active: true
  272. UnsafeCallOnNullableType:
  273. active: false
  274. UnsafeCast:
  275. active: false
  276. UselessPostfixExpression:
  277. active: false
  278. WrongEqualsTypeParameter:
  279. active: false
  280. style:
  281. active: true
  282. CollapsibleIfStatements:
  283. active: false
  284. DataClassContainsFunctions:
  285. active: false
  286. conversionFunctionPrefix: [to]
  287. EqualsNullCall:
  288. active: false
  289. EqualsOnSignatureLine:
  290. active: false
  291. ExplicitItLambdaParameter:
  292. active: false
  293. ExpressionBodySyntax:
  294. active: false
  295. includeLineWrapping: false
  296. ForbiddenComment:
  297. active: true
  298. values: 'TODO:,FIXME:,STOPSHIP:'
  299. ForbiddenImport:
  300. active: false
  301. imports: []
  302. ForbiddenVoid:
  303. active: false
  304. FunctionOnlyReturningConstant:
  305. active: false
  306. ignoreOverridableFunction: true
  307. excludedFunctions: [describeContents]
  308. LoopWithTooManyJumpStatements:
  309. active: false
  310. maxJumpCount: 1
  311. MagicNumber:
  312. active: true
  313. ignoreNumbers: ["-1","0","1","2"]
  314. ignoreHashCodeFunction: true
  315. ignorePropertyDeclaration: false
  316. ignoreConstantDeclaration: true
  317. ignoreCompanionObjectPropertyDeclaration: true
  318. ignoreAnnotation: false
  319. ignoreNamedArgument: true
  320. ignoreEnums: false
  321. excludes:
  322. - "**/*Test.kt"
  323. - "**/*IT.kt"
  324. MandatoryBracesIfStatements:
  325. active: false
  326. MaxLineLength:
  327. active: true
  328. maxLineLength: 120
  329. excludePackageStatements: true
  330. excludeImportStatements: true
  331. excludeCommentStatements: false
  332. MayBeConst:
  333. active: false
  334. ModifierOrder:
  335. active: true
  336. NestedClassesVisibility:
  337. active: false
  338. NewLineAtEndOfFile:
  339. active: true
  340. NoTabs:
  341. active: false
  342. OptionalAbstractKeyword:
  343. active: true
  344. OptionalUnit:
  345. active: false
  346. OptionalWhenBraces:
  347. active: false
  348. PreferToOverPairSyntax:
  349. active: false
  350. ProtectedMemberInFinalClass:
  351. active: false
  352. RedundantVisibilityModifierRule:
  353. active: false
  354. ReturnCount:
  355. active: true
  356. max: 2
  357. excludedFunctions: [equals]
  358. excludeLabeled: false
  359. excludeReturnFromLambda: true
  360. SafeCast:
  361. active: true
  362. SerialVersionUIDInSerializableClass:
  363. active: false
  364. SpacingBetweenPackageAndImports:
  365. active: false
  366. ThrowsCount:
  367. active: true
  368. max: 2
  369. TrailingWhitespace:
  370. active: false
  371. UnderscoresInNumericLiterals:
  372. active: false
  373. acceptableLength: 5
  374. UnnecessaryAbstractClass:
  375. active: false
  376. ignoreAnnotated:
  377. - "dagger.Module"
  378. UnnecessaryApply:
  379. active: false
  380. UnnecessaryInheritance:
  381. active: false
  382. UnnecessaryLet:
  383. active: false
  384. UnnecessaryParentheses:
  385. active: false
  386. UntilInsteadOfRangeTo:
  387. active: false
  388. UnusedImports:
  389. active: false
  390. UnusedPrivateClass:
  391. active: false
  392. UnusedPrivateMember:
  393. active: false
  394. allowedNames: "(_|ignored|expected|serialVersionUID)"
  395. UseDataClass:
  396. active: false
  397. ignoreAnnotated: []
  398. UtilityClassWithPublicConstructor:
  399. active: false
  400. VarCouldBeVal:
  401. active: false
  402. WildcardImport:
  403. active: true
  404. excludeImports: [java.util.*,kotlinx.android.synthetic.*]