Skip to content

Commit

Permalink
Wire up Detekt
Browse files Browse the repository at this point in the history
  • Loading branch information
ephemient committed Dec 3, 2024
1 parent e9324fd commit 1bcd8fd
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
11 changes: 10 additions & 1 deletion kt/aoc2024-exe/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ kotlin {
it.binaries.executable {
entryPoint("com.github.ephemient.aoc2024.exe.main")
}
}
},
).onEach {
it.compilations {
create("bench") {
Expand Down Expand Up @@ -66,6 +66,15 @@ kotlin {
}
}
}

val detektTaskNames = targets.flatMap { target ->
target.compilations.map { compilation ->
"detekt${target.targetName.capitalize()}${compilation.compilationName.capitalize()}"
}
}
tasks.check {
dependsOn(detektTaskNames)
}
}

dependencies {
Expand Down
9 changes: 9 additions & 0 deletions kt/aoc2024-lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ kotlin {
}
}
}

val detektTaskNames = targets.flatMap { target ->
target.compilations.map { compilation ->
"detekt${target.targetName.capitalize()}${compilation.compilationName.capitalize()}"
}
}
tasks.check {
dependsOn(detektTaskNames)
}
}

val jvmTestCompilation = kotlin.jvm().compilations.getByName("test")
Expand Down
10 changes: 9 additions & 1 deletion kt/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
plugins {
base
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.kotlin.plugin.allopen) apply false
alias(libs.plugins.detekt)
alias(libs.plugins.kotlinx.benchmark) apply false
}

group = "com.github.ephemient.aoc2024"
dependencies {
detektPlugins(libs.bundles.detekt.plugins)
}

detekt {
source.from(allprojects.map { it.buildFile })
}
3 changes: 3 additions & 0 deletions kt/config/detekt/detekt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
style:
MagicNumber:
active: false

0 comments on commit 1bcd8fd

Please sign in to comment.