summaryrefslogtreecommitdiffhomepage
path: root/android
diff options
context:
space:
mode:
authorDavid Göransson <david.goransson90@gmail.com>2024-02-02 16:30:33 +0100
committerAlbin <albin@mullvad.net>2024-02-05 17:51:37 +0100
commit77aaaf2110897c39f5c845832bbb12e8c2d0b7e7 (patch)
tree87c809e51439d4f280531ead7d0a26bb00c7f7a1 /android
parent64c6aed281b0944764823dd3b8006f8c02e14edb (diff)
downloadmullvadvpn-77aaaf2110897c39f5c845832bbb12e8c2d0b7e7.tar.xz
mullvadvpn-77aaaf2110897c39f5c845832bbb12e8c2d0b7e7.zip
Apply custom compose, report and other detekt rules
Diffstat (limited to 'android')
-rw-r--r--android/config/detekt.yml200
1 files changed, 163 insertions, 37 deletions
diff --git a/android/config/detekt.yml b/android/config/detekt.yml
index 7615608ce3..d6444acd7f 100644
--- a/android/config/detekt.yml
+++ b/android/config/detekt.yml
@@ -34,21 +34,21 @@ processors:
console-reports:
active: true
exclude:
- - 'ProjectStatisticsReport'
- - 'ComplexityReport'
- - 'NotificationReport'
- - 'FindingsReport'
- - 'FileBasedFindingsReport'
+ - 'ProjectStatisticsReport'
+ - 'ComplexityReport'
+ - 'NotificationReport'
+ - 'FindingsReport'
+ - 'FileBasedFindingsReport'
# - 'LiteFindingsReport'
output-reports:
active: true
exclude:
- # - 'TxtOutputReport'
- # - 'XmlOutputReport'
- # - 'HtmlOutputReport'
- # - 'MdOutputReport'
- # - 'SarifOutputReport'
+ - 'TxtOutputReport'
+ - 'XmlOutputReport'
+ - 'MdOutputReport'
+ - 'SarifOutputReport'
+ - 'sarif'
comments:
active: true
@@ -67,7 +67,15 @@ comments:
endOfSentenceFormat: '([.?!][ \t\n\r\f<])|([.?!:]$)'
KDocReferencesNonPublicProperty:
active: false
- excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
+ excludes:
+ - '**/test/**'
+ - '**/androidTest/**'
+ - '**/commonTest/**'
+ - '**/jvmTest/**'
+ - '**/androidUnitTest/**'
+ - '**/androidInstrumentedTest/**'
+ - '**/jsTest/**'
+ - '**/iosTest/**'
OutdatedDocumentation:
active: false
matchTypeParameters: true
@@ -75,7 +83,15 @@ comments:
allowParamOnConstructorProperties: false
UndocumentedPublicClass:
active: false
- excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
+ excludes:
+ - '**/test/**'
+ - '**/androidTest/**'
+ - '**/commonTest/**'
+ - '**/jvmTest/**'
+ - '**/androidUnitTest/**'
+ - '**/androidInstrumentedTest/**'
+ - '**/jsTest/**'
+ - '**/iosTest/**'
searchInNestedClass: true
searchInInnerClass: true
searchInInnerObject: true
@@ -83,11 +99,27 @@ comments:
searchInProtectedClass: false
UndocumentedPublicFunction:
active: false
- excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
+ excludes:
+ - '**/test/**'
+ - '**/androidTest/**'
+ - '**/commonTest/**'
+ - '**/jvmTest/**'
+ - '**/androidUnitTest/**'
+ - '**/androidInstrumentedTest/**'
+ - '**/jsTest/**'
+ - '**/iosTest/**'
searchProtectedFunction: false
UndocumentedPublicProperty:
active: false
- excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
+ excludes:
+ - '**/test/**'
+ - '**/androidTest/**'
+ - '**/commonTest/**'
+ - '**/jvmTest/**'
+ - '**/androidUnitTest/**'
+ - '**/androidInstrumentedTest/**'
+ - '**/jsTest/**'
+ - '**/iosTest/**'
searchProtectedProperty: false
complexity:
@@ -128,12 +160,12 @@ complexity:
threshold: 600
LongMethod:
active: true
- threshold: 60
+ threshold: 80
LongParameterList:
active: true
- functionThreshold: 6
- constructorThreshold: 7
- ignoreDefaultParameters: false
+ functionThreshold: 15
+ constructorThreshold: 10
+ ignoreDefaultParameters: true
ignoreDataClasses: true
ignoreAnnotatedParameter: []
MethodOverloading:
@@ -159,19 +191,36 @@ complexity:
active: false
StringLiteralDuplication:
active: false
- excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
+ excludes:
+ - '**/test/**'
+ - '**/androidTest/**'
+ - '**/commonTest/**'
+ - '**/jvmTest/**'
+ - '**/androidUnitTest/**'
+ - '**/androidInstrumentedTest/**'
+ - '**/jsTest/**'
+ - '**/iosTest/**'
threshold: 3
ignoreAnnotation: true
excludeStringsWithLessThan5Characters: true
ignoreStringsRegex: '$^'
TooManyFunctions:
+ # Configuration maybe should change when this has been merged: https://github.com/detekt/detekt/issues/6516
active: true
- excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
- thresholdInFiles: 11
- thresholdInClasses: 11
- thresholdInInterfaces: 11
- thresholdInObjects: 11
- thresholdInEnums: 11
+ excludes:
+ - '**/test/**'
+ - '**/androidTest/**'
+ - '**/commonTest/**'
+ - '**/jvmTest/**'
+ - '**/androidUnitTest/**'
+ - '**/androidInstrumentedTest/**'
+ - '**/jsTest/**'
+ - '**/iosTest/**'
+ thresholdInFiles: 30
+ thresholdInClasses: 14
+ thresholdInInterfaces: 14
+ thresholdInObjects: 14
+ thresholdInEnums: 14
ignoreDeprecated: false
ignorePrivate: false
ignoreOverridden: false
@@ -243,7 +292,15 @@ exceptions:
- 'toString'
InstanceOfCheckForException:
active: true
- excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
+ excludes:
+ - '**/test/**'
+ - '**/androidTest/**'
+ - '**/commonTest/**'
+ - '**/jvmTest/**'
+ - '**/androidUnitTest/**'
+ - '**/androidInstrumentedTest/**'
+ - '**/jsTest/**'
+ - '**/iosTest/**'
NotImplementedDeclaration:
active: false
ObjectExtendsThrowable:
@@ -256,7 +313,7 @@ exceptions:
active: true
ignoreLabeled: false
SwallowedException:
- active: true
+ active: false
ignoredExceptionTypes:
- 'InterruptedException'
- 'MalformedURLException'
@@ -269,7 +326,15 @@ exceptions:
active: false
ThrowingExceptionsWithoutMessageOrCause:
active: true
- excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
+ excludes:
+ - '**/test/**'
+ - '**/androidTest/**'
+ - '**/commonTest/**'
+ - '**/jvmTest/**'
+ - '**/androidUnitTest/**'
+ - '**/androidInstrumentedTest/**'
+ - '**/jsTest/**'
+ - '**/iosTest/**'
exceptions:
- 'ArrayIndexOutOfBoundsException'
- 'Exception'
@@ -284,7 +349,15 @@ exceptions:
active: true
TooGenericExceptionCaught:
active: true
- excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
+ excludes:
+ - '**/test/**'
+ - '**/androidTest/**'
+ - '**/commonTest/**'
+ - '**/jvmTest/**'
+ - '**/androidUnitTest/**'
+ - '**/androidInstrumentedTest/**'
+ - '**/jsTest/**'
+ - '**/iosTest/**'
exceptionNames:
- 'ArrayIndexOutOfBoundsException'
- 'Error'
@@ -330,9 +403,18 @@ naming:
minimumFunctionNameLength: 3
FunctionNaming:
active: true
- excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
+ excludes:
+ - '**/test/**'
+ - '**/androidTest/**'
+ - '**/commonTest/**'
+ - '**/jvmTest/**'
+ - '**/androidUnitTest/**'
+ - '**/androidInstrumentedTest/**'
+ - '**/jsTest/**'
+ - '**/iosTest/**'
functionPattern: '[a-z][a-zA-Z0-9]*'
excludeClassPattern: '$^'
+ ignoreAnnotated: ['Composable']
FunctionParameterNaming:
active: true
parameterPattern: '[a-z][A-Za-z0-9]*'
@@ -364,7 +446,7 @@ naming:
packagePattern: '[a-z]+(\.[a-z][A-Za-z0-9]*)*'
TopLevelPropertyNaming:
active: true
- constantPattern: '[A-Z][_A-Z0-9]*'
+ constantPattern: '[A-Z][_A-Za-z0-9]*'
propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
privatePropertyPattern: '_?[A-Za-z][_A-Za-z0-9]*'
VariableMaxLength:
@@ -388,10 +470,26 @@ performance:
threshold: 3
ForEachOnRange:
active: true
- excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
+ excludes:
+ - '**/test/**'
+ - '**/androidTest/**'
+ - '**/commonTest/**'
+ - '**/jvmTest/**'
+ - '**/androidUnitTest/**'
+ - '**/androidInstrumentedTest/**'
+ - '**/jsTest/**'
+ - '**/iosTest/**'
SpreadOperator:
active: true
- excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
+ excludes:
+ - '**/test/**'
+ - '**/androidTest/**'
+ - '**/commonTest/**'
+ - '**/jvmTest/**'
+ - '**/androidUnitTest/**'
+ - '**/androidInstrumentedTest/**'
+ - '**/jsTest/**'
+ - '**/iosTest/**'
UnnecessaryPartOfBinaryExpression:
active: false
UnnecessaryTemporaryInstantiation:
@@ -464,7 +562,15 @@ potential-bugs:
active: true
LateinitUsage:
active: false
- excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
+ excludes:
+ - '**/test/**'
+ - '**/androidTest/**'
+ - '**/commonTest/**'
+ - '**/jvmTest/**'
+ - '**/androidUnitTest/**'
+ - '**/androidInstrumentedTest/**'
+ - '**/jsTest/**'
+ - '**/iosTest/**'
ignoreOnClassesPattern: ''
MapGetWithNotNullAssertionOperator:
active: true
@@ -491,7 +597,15 @@ potential-bugs:
active: true
UnsafeCallOnNullableType:
active: true
- excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
+ excludes:
+ - '**/test/**'
+ - '**/androidTest/**'
+ - '**/commonTest/**'
+ - '**/jvmTest/**'
+ - '**/androidUnitTest/**'
+ - '**/androidInstrumentedTest/**'
+ - '**/jsTest/**'
+ - '**/iosTest/**'
UnsafeCast:
active: true
UnusedUnaryOperator:
@@ -532,6 +646,7 @@ style:
DestructuringDeclarationWithTooManyEntries:
active: true
maxDestructuringEntries: 3
+ ignoreAnnotated: ['Composable']
DoubleNegativeLambda:
active: false
negativeFunctions:
@@ -608,14 +723,23 @@ style:
maxJumpCount: 1
MagicNumber:
active: true
- excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**', '**/*.kts']
+ excludes:
+ - '**/test/**'
+ - '**/androidTest/**'
+ - '**/commonTest/**'
+ - '**/jvmTest/**'
+ - '**/androidUnitTest/**'
+ - '**/androidInstrumentedTest/**'
+ - '**/jsTest/**'
+ - '**/iosTest/**'
+ - '**/*.kts'
ignoreNumbers:
- '-1'
- '0'
- '1'
- '2'
ignoreHashCodeFunction: true
- ignorePropertyDeclaration: false
+ ignorePropertyDeclaration: true
ignoreLocalVariableDeclaration: false
ignoreConstantDeclaration: true
ignoreCompanionObjectPropertyDeclaration: true
@@ -624,6 +748,7 @@ style:
ignoreEnums: false
ignoreRanges: false
ignoreExtensionFunctions: true
+ ignoreAnnotated: ['Preview']
MandatoryBracesLoops:
active: false
MaxChainedCallsOnSameLine:
@@ -738,6 +863,7 @@ style:
UnusedPrivateMember:
active: true
allowedNames: ''
+ ignoreAnnotated: ['Preview']
UnusedPrivateProperty:
active: true
allowedNames: '_|ignored|expected|serialVersionUID'