Skip to content

Commit

Permalink
chore: Configure detekt Gradle task to show its result in the termina…
Browse files Browse the repository at this point in the history
…l/IDE directly instead of generating an XML report
  • Loading branch information
joc-a committed Feb 12, 2024
1 parent b909d07 commit e459491
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 26 deletions.
20 changes: 5 additions & 15 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.report.ReportMergeTask
import org.jetbrains.exposed.gradle.*
import org.jetbrains.exposed.gradle.configureDetekt
import org.jetbrains.exposed.gradle.configurePublishing
import org.jetbrains.exposed.gradle.testDb

plugins {
kotlin("jvm") apply true
Expand All @@ -15,8 +15,6 @@ repositories {
}

allprojects {
configureDetekt()

if (this.name != "exposed-tests" && this.name != "exposed-bom" && this != rootProject) {
configurePublishing()
}
Expand All @@ -26,20 +24,12 @@ apiValidation {
ignoredProjects.addAll(listOf("exposed-tests", "exposed-bom"))
}

val reportMerge by tasks.registering(ReportMergeTask::class) {
output.set(rootProject.buildDir.resolve("reports/detekt/exposed.xml"))
}

subprojects {
configureDetekt()

dependencies {
detektPlugins(rootProject.libs.detekt.formatting)
}
tasks.withType<Detekt>().configureEach detekt@{
finalizedBy(reportMerge)
reportMerge.configure {
input.from(this@detekt.xmlReportFile)
}
}
}

subprojects {
Expand Down
10 changes: 0 additions & 10 deletions buildSrc/src/main/kotlin/org/jetbrains/exposed/gradle/Detekt.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package org.jetbrains.exposed.gradle

import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.DetektPlugin
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import org.gradle.api.Project
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.withType

fun Project.configureDetekt() {
apply<DetektPlugin>()
Expand All @@ -17,12 +15,4 @@ fun Project.configureDetekt() {
parallel = true
config.setFrom("$rootDir/detekt/detekt-config.yml")
}
tasks.withType<Detekt>().configureEach {
reports {
xml.required.set(true)
html.required.set(false)
txt.required.set(false)
sarif.required.set(false)
}
}
}
2 changes: 1 addition & 1 deletion detekt/detekt-config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# https://github.com/detekt/detekt/blob/main/detekt-core/src/main/resources/default-detekt-config.yml

build:
maxIssues: 52
maxIssues: 0

formatting:
ArgumentListWrapping:
Expand Down

0 comments on commit e459491

Please sign in to comment.