Skip to content

Commit

Permalink
#4 [setup] Setup detekt most evil rules
Browse files Browse the repository at this point in the history
  • Loading branch information
vityaman committed Mar 17, 2024
1 parent aaff7f9 commit 973ef9d
Show file tree
Hide file tree
Showing 4 changed files with 233 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[*.{kt,kts}]
ktlint_code_style = intellij_idea
226 changes: 226 additions & 0 deletions config/detekt.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,229 @@
config:
validation: true
warningsAsErrors: true

comments:
CommentOverPrivateFunction:
active: true
CommentOverPrivateProperty:
active: true
DeprecatedBlockTag:
active: true
EndOfSentenceFormat:
active: true
KDocReferencesNonPublicProperty:
active: true
OutdatedDocumentation:
active: true

complexity:
CognitiveComplexMethod:
active: true
threshold: 12
ComplexInterface:
active: true
threshold: 8
CyclomaticComplexMethod:
active: true
threshold: 12
LabeledExpression:
active: true
LargeClass:
active: true
threshold: 400
LongMethod:
active: true
threshold: 30
LongParameterList:
active: true
functionThreshold: 3
constructorThreshold: 4
MethodOverloading:
active: true
NamedArguments:
active: true
threshold: 2
ignoreArgumentsMatchingNames: true
NestedScopeFunctions:
active: true
StringLiteralDuplication:
active: true
TooManyFunctions:
active: true
thresholdInFiles: 8
thresholdInClasses: 8
thresholdInInterfaces: 8
thresholdInObjects: 8
thresholdInEnums: 8

coroutines:
GlobalCoroutineUsage:
active: true
SuspendFunSwallowedCancellation:
active: true
SuspendFunWithCoroutineScopeReceiver:
active: true

exceptions:
ObjectExtendsThrowable:
active: true

naming:
BooleanPropertyNaming:
active: true
FunctionMinLength:
active: true
minimumFunctionNameLength: 3
FunctionMaxLength:
active: true
maximumFunctionNameLength: 30
LambdaParameterNaming:
active: true
NonBooleanPropertyPrefixedWithIs:
active: true
VariableMinLength:
active: true
minimumVariableNameLength: 1
VariableMaxLength:
active: true
maximumVariableNameLength: 20

performance:
CouldBeSequence:
active: true
threshold: 2
UnnecessaryPartOfBinaryExpression:
active: true

potential-bugs:
CastNullableToNonNullableType:
active: true
CastToNullableType:
active: true
Deprecation:
active: true
DontDowncastCollectionTypes:
active: true
ElseCaseInsteadOfExhaustiveWhen:
active: true
ExitOutsideMain:
active: true
ImplicitUnitReturnType:
active: true
LateinitUsage:
active: true
MissingPackageDeclaration:
active: true
NullCheckOnMutableProperty:
active: true
NullableToStringCall:
active: true
PropertyUsedBeforeDeclaration:
active: true
UnconditionalJumpStatementInLoop:
active: true
UnnecessaryNotNullCheck:
active: true

style:
AlsoCouldBeApply:
active: true
BracesOnIfStatements:
active: true
singleLine: always
multiLine: always
BracesOnWhenStatements:
active: true
singleLine: never
multiLine: always
CanBeNonNullable:
active: true
CascadingCallWrapping:
active: true
ClassOrdering:
active: true
CollapsibleIfStatements:
active: true
DataClassContainsFunctions:
active: true
DataClassShouldBeImmutable:
active: true
DoubleNegativeLambda:
active: true
EqualsOnSignatureLine:
active: true
ExplicitCollectionElementAccessMethod:
active: true
ExpressionBodySyntax:
active: true
includeLineWrapping: true
ForbiddenAnnotation:
active: true
ForbiddenImport:
active: true
ForbiddenMethodCall:
active: true
ForbiddenSuppress:
active: true
MandatoryBracesLoops:
active: true
MaxChainedCallsOnSameLine:
active: true
maxChainedCalls: 3
MaxLineLength:
active: true
maxLineLength: 80
MultilineLambdaItParameter:
active: true
MultilineRawStringIndentation:
active: true
NoTabs:
active: true
NullableBooleanCheck:
active: true
OptionalUnit:
active: true
PreferToOverPairSyntax:
active: true
RedundantExplicitType:
active: true
RedundantVisibilityModifierRule:
active: true
SpacingBetweenPackageAndImports:
active: true
StringShouldBeRawString:
active: true
TrailingWhitespace:
active: true
TrimMultilineRawString:
active: true
UnderscoresInNumericLiterals:
active: true
UnnecessaryAnnotationUseSiteTarget:
active: true
UnnecessaryBackticks:
active: true
UnnecessaryBracesAroundTrailingLambda:
active: true
UnnecessaryInnerClass:
active: true
UnnecessaryLet:
active: true
UnnecessaryParentheses:
active: true
UntilInsteadOfRangeTo:
active: true
UnusedImports:
active: true
UseDataClass:
active: true
UseEmptyCounterpart:
active: true
UseIfEmptyOrIfBlank:
active: true
UseIfInsteadOfWhen:
active: true
UseLet:
active: true
UseSumOfInsteadOfFlatMapSize:
active: true
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import ru.itmo.lms.gateway.api.http.apis.MonitoringApi

@RestController
class MonitoringHttpApi : MonitoringApi {
override suspend fun monitoringPingGet(): ResponseEntity<String> {
return ResponseEntity.ok("pong")
}
override suspend fun monitoringPingGet(): ResponseEntity<String> =
ResponseEntity.ok("pong")
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ import org.springframework.boot.test.context.SpringBootTest
@SpringBootTest
class GatewayApplicationTests {
@Test
fun contextLoads() = Unit
fun contextLoads() {
// Do nothing
}
}

0 comments on commit 973ef9d

Please sign in to comment.