Skip to content

Commit 698953e

Browse files
committed
chore(build): integrate Detekt for static code analysis
- Add Detekt configuration and plugin to `build.gradle.kts` - Update `codeql.yml` to include Detekt in the CI workflow - Define Detekt settings in a new `detekt.yml` file
1 parent 658b370 commit 698953e

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

.github/workflows/codeql.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ jobs:
7171
:kotlin-sdk:compileKotlinJvm \
7272
:integration-test:compileKotlinJvm \
7373
:conformance-test:testClasses \
74+
detekt \
7475
-Pkotlin.incremental=false \
7576
--no-daemon --stacktrace --rerun-tasks
7677

build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
id("mcp.dokka")
3+
alias(libs.plugins.detekt)
34
alias(libs.plugins.ktlint)
45
alias(libs.plugins.kover)
56
}
@@ -18,6 +19,12 @@ dependencies {
1819
subprojects {
1920
apply(plugin = "org.jlleitschuh.gradle.ktlint")
2021
apply(plugin = "org.jetbrains.kotlinx.kover")
22+
apply(plugin = "dev.detekt")
23+
24+
detekt {
25+
config = files("$rootDir/detekt.yml")
26+
buildUponDefaultConfig = true
27+
}
2128
}
2229

2330
dokka {

detekt.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
config:
2+
validation: true
3+
warningsAsErrors: true

gradle/libs.versions.toml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
[versions]
22
# plugins version
3-
kotlin = "2.2.21"
4-
dokka = "2.1.0"
53
atomicfu = "0.29.0"
6-
ktlint = "14.0.1"
4+
binaryCompatibilityValidatorPlugin = "0.18.1"
5+
detekt = "2.0.0-alpha.1"
6+
dokka = "2.1.0"
7+
kotlin = "2.2.21"
78
kover = "0.9.4"
8-
netty = "4.2.9.Final"
9+
ktlint = "14.0.1"
910
mavenPublish = "0.35.0"
10-
binaryCompatibilityValidatorPlugin = "0.18.1"
11+
netty = "4.2.9.Final"
1112
openapi-generator = "7.18.0"
1213

1314
# libraries version
@@ -69,6 +70,7 @@ ktor-client-cio = { group = "io.ktor", name = "ktor-client-cio", version.ref = "
6970
ktor-server-cio = { group = "io.ktor", name = "ktor-server-cio", version.ref = "ktor" }
7071

7172
[plugins]
73+
detekt = { id = "dev.detekt", version.ref = "detekt" }
7274
kotlinx-binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binaryCompatibilityValidatorPlugin" }
7375
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
7476
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" }

0 commit comments

Comments
 (0)