refactor: explicit locked detekt config (#729)

Migrate detekt to a convention plugin in `buildSrc`, switch the project
to a fully explicit YAML config (`buildUponDefaultConfig = false`), fix
the real findings that this stricter setup revealed, and remove
`@Suppress` annotations that became unnecessary after the rule changes.

## Motivation and Context
- Explicit visibility into the rule set
- Lock against detekt version upgrades

## Breaking Changes
None

## Types of changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [x] Documentation update

## Checklist
- [x] I have read the [MCP
Documentation](https://modelcontextprotocol.io)
- [x] My code follows the repository's style guidelines
- [x] New and existing tests pass locally
- [x] I have added appropriate error handling
- [x] I have added or updated documentation as needed
This commit is contained in:
Pavel Gorgulov 2026-04-29 12:31:49 +02:00 • committed by GitHub
commit 64804a05c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 1106 additions and 507 deletions

View file

@ -0,0 +1,23 @@
import dev.detekt.gradle.Detekt
import dev.detekt.gradle.extensions.FailOnSeverity
plugins {
id("dev.detekt")
}
detekt {
config = files("$rootDir/config/detekt/detekt.yml")
buildUponDefaultConfig = false
parallel = true
failOnSeverity = FailOnSeverity.Error
}
tasks.withType<Detekt>().configureEach {
exclude("**/generated/**", "**/generated-sources/**", "**/build/**")
}
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
tasks.named("detekt").configure {
dependsOn("detektMainJvm")
}
}

View file

@ -57,12 +57,3 @@ kotlin {
explicitApi = ExplicitApiMode.Strict
jvmToolchain(21)
}
tasks.named("detekt").configure {
dependsOn(
"detektMainJvm",
"detektCommonMainSourceSet",
"detektTestJvm",
"detektCommonTestSourceSet",
)
}