Browse Source

Enable more detekt rules and remove unused extension.

pull/967/head
Benoit Marty 1 year ago committed by Benoit Marty
parent
commit
f7536a5450
  1. 4
      libraries/core/src/main/kotlin/io/element/android/libraries/core/extensions/BasicExtensions.kt
  2. 48
      tools/detekt/detekt.yml

4
libraries/core/src/main/kotlin/io/element/android/libraries/core/extensions/BasicExtensions.kt

@ -72,7 +72,3 @@ fun String.ellipsize(length: Int): String { @@ -72,7 +72,3 @@ fun String.ellipsize(length: Int): String {
return "${this.take(length)}"
}
inline fun <reified R> Any?.takeAs(): R? {
return takeIf { it is R } as R?
}

48
tools/detekt/detekt.yml

@ -8,6 +8,14 @@ style: @@ -8,6 +8,14 @@ style:
includeElvis: true
DataClassShouldBeImmutable:
active: true
EqualsNullCall:
active: true
EqualsOnSignatureLine:
active: true
ExplicitCollectionElementAccessMethod:
active: true
ExplicitItLambdaParameter:
active: true
MaxLineLength:
# Default is 120
maxLineLength: 160
@ -65,6 +73,34 @@ empty-blocks: @@ -65,6 +73,34 @@ empty-blocks:
potential-bugs:
ImplicitDefaultLocale:
active: true
CastNullableToNonNullableType:
active: true
CastToNullableType:
active: true
Deprecation:
active: true
DontDowncastCollectionTypes:
active: true
ElseCaseInsteadOfExhaustiveWhen:
active: true
ExitOutsideMain:
active: true
ImplicitUnitReturnType:
active: true
allowExplicitReturnType: false
MissingPackageDeclaration:
active: true
excludes: ['**/*.kts']
NullCheckOnMutableProperty:
active: true
NullableToStringCall:
active: true
PropertyUsedBeforeDeclaration:
active: true
UnconditionalJumpStatementInLoop:
active: true
UnnecessaryNotNullCheck:
active: true
exceptions:
TooGenericExceptionCaught:
@ -77,6 +113,8 @@ exceptions: @@ -77,6 +113,8 @@ exceptions:
active: true
InstanceOfCheckForException:
active: true
ObjectExtendsThrowable:
active: true
complexity:
TooManyFunctions:
@ -102,10 +140,20 @@ naming: @@ -102,10 +140,20 @@ naming:
FunctionNaming:
active: true
ignoreAnnotated: ['Composable']
LambdaParameterNaming:
active: true
NonBooleanPropertyPrefixedWithIs:
active: true
VariableMaxLength:
active: true
performance:
SpreadOperator:
active: false
CouldBeSequence:
active: true
UnnecessaryPartOfBinaryExpression:
active: true
# Note: all rules for `comments` are disabled by default, but I put them here to be aware of their existence
comments:

Loading…
Cancel
Save