-
Notifications
You must be signed in to change notification settings - Fork 217
/
Copy pathbuild.gradle.kts
56 lines (49 loc) · 1.64 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask
plugins {
kotlin("jvm")
`maven-publish`
id("io.gitlab.arturbosch.detekt") version "1.22.0"
}
repositories {
mavenCentral()
}
detekt {
allRules = false // activate all available (even unstable) rules.
buildUponDefaultConfig = true // preconfigure defaults
parallel = true
config = files("$rootDir/detekt.yml")
baseline = file("$rootDir/detekt_baseline.xml")
source = files(projectDir)
}
// Registers a baseline for Detekt.
//
// The way it works is that you set create "baseline" for Detekt
// by running this task. It will then creatae a detekt-baseline.xml which
// contains a list of current issues found within the project.
// Then every time you run the "detekt" task it will only report errors
// that are not in the baseline config.
//
// We should routinely run this task and commit the baseline file as we
// fix detekt issues so that we can prevent regressions.
tasks.register<DetektCreateBaselineTask>("createDetektBaseline") {
description = "Overrides current baseline."
buildUponDefaultConfig.set(true)
ignoreFailures.set(true)
parallel.set(true)
setSource(files(projectDir))
config.setFrom(files("$rootDir/detekt.yml"))
baseline.set(file("$rootDir/detekt_baseline.xml"))
include("**/*.kt")
include("**/*.kts")
exclude("**/build/**")
}
tasks.withType<Detekt>().configureEach {
jvmTarget = JavaVersion.VERSION_11.toString()
exclude("**/build/**")
reports {
html.required.set(true)
md.required.set(true)
}
}
tasks.check.get().dependsOn(tasks.detekt)