diff --git a/build.gradle.kts b/build.gradle.kts index 3bc19e7c..5cdda4d7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,6 +9,7 @@ plugins { kotlin("jvm") version "1.8.21" id("io.ktor.plugin") version "2.3.0" id("org.graalvm.buildtools.native") version "0.9.21" + id("io.gitlab.arturbosch.detekt") version "1.22.0" // id("org.jetbrains.kotlin.plugin.serialization") version "1.8.10" } @@ -88,6 +89,7 @@ dependencies { testImplementation("org.slf4j:slf4j-simple:2.0.7") + detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.22.0") } jib { @@ -129,3 +131,10 @@ graalvmNative { } } } + +detekt { + parallel = true + config = files("detekt.yml") + buildUponDefaultConfig = true + basePath = rootDir.absolutePath +} diff --git a/detekt.yml b/detekt.yml new file mode 100644 index 00000000..faeab0d6 --- /dev/null +++ b/detekt.yml @@ -0,0 +1,99 @@ +style: + ClassOrdering: + active: true + + MandatoryBracesIfStatements: + active: true + + MandatoryBracesLoops: + active: true + + MultilineLambdaItParameter: + active: true + + UseEmptyCounterpart: + active: true + +complexity: + CognitiveComplexMethod: + active: true + + ComplexCondition: + active: true + + ComplexInterface: + active: true + + LabeledExpression: + active: true + + NamedArguments: + active: true + + NestedBlockDepth: + active: true + + NestedScopeFunctions: + active: true + + ReplaceSafeCallChainWithRun: + active: true + + StringLiteralDuplication: + active: true + +exceptions: + ExceptionRaisedInUnexpectedLocation: + active: true + + NotImplementedDeclaration: + active: true + + ObjectExtendsThrowable: + active: true + + ThrowingExceptionInMain: + active: true + + ThrowingExceptionsWithoutMessageOrCause: + active: true + + ThrowingNewInstanceOfSameException: + active: true + + TooGenericExceptionCaught: + active: true + + TooGenericExceptionThrown: + active: true + +formatting: + Indentation: + indentSize: 4 + +naming: + FunctionMaxLength: + active: true + + FunctionMinLength: + active: true + + LambdaParameterNaming: + active: true + +performance: + UnnecessaryPartOfBinaryExpression: + active: true + + UnnecessaryTemporaryInstantiation: + active: true + +potential-bugs: + CastToNullableType: + active: true + + DontDowncastCollectionTypes: + active: true + + ElseCaseInsteadOfExhaustiveWhen: + active: true