Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Configure detekt Gradle task to show its result in the terminal/IDE directly instead of generating an XML report #1989

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading