forked from detekt/detekt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
106 lines (94 loc) · 2.99 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask
plugins {
id("releasing")
alias(libs.plugins.detekt)
alias(libs.plugins.gradleVersionz)
alias(libs.plugins.sonarqube)
}
allprojects {
group = "io.gitlab.arturbosch.detekt"
version = Versions.currentOrSnapshot()
apply(plugin = "io.gitlab.arturbosch.detekt")
detekt {
source = objects.fileCollection().from(
io.gitlab.arturbosch.detekt.extensions.DetektExtension.DEFAULT_SRC_DIR_JAVA,
"src/test/java",
io.gitlab.arturbosch.detekt.extensions.DetektExtension.DEFAULT_SRC_DIR_KOTLIN,
"src/test/kotlin"
)
buildUponDefaultConfig = true
baseline = file("$rootDir/config/detekt/baseline.xml")
reports {
xml.enabled = true
html.enabled = true
txt.enabled = true
sarif.enabled = true
}
}
dependencies {
detekt(project(":detekt-cli"))
detektPlugins(project(":custom-checks"))
detektPlugins(project(":detekt-formatting"))
}
tasks.withType<Detekt>().configureEach {
jvmTarget = "1.8"
}
}
val analysisDir = file(projectDir)
val baselineFile = file("$rootDir/config/detekt/baseline.xml")
val configFile = file("$rootDir/config/detekt/detekt.yml")
val statisticsConfigFile = file("$rootDir/config/detekt/statistics.yml")
val kotlinFiles = "**/*.kt"
val kotlinScriptFiles = "**/*.kts"
val resourceFiles = "**/resources/**"
val buildFiles = "**/build/**"
val detektFormat by tasks.registering(Detekt::class) {
description = "Formats whole project."
parallel = true
disableDefaultRuleSets = true
buildUponDefaultConfig = true
autoCorrect = true
setSource(analysisDir)
config.setFrom(listOf(statisticsConfigFile, configFile))
include(kotlinFiles)
include(kotlinScriptFiles)
exclude(resourceFiles)
exclude(buildFiles)
baseline.set(baselineFile)
reports {
xml.enabled = false
html.enabled = false
txt.enabled = false
}
}
val detektAll by tasks.registering(Detekt::class) {
description = "Runs the whole project at once."
parallel = true
buildUponDefaultConfig = true
setSource(analysisDir)
config.setFrom(listOf(statisticsConfigFile, configFile))
include(kotlinFiles)
include(kotlinScriptFiles)
exclude(resourceFiles)
exclude(buildFiles)
baseline.set(baselineFile)
reports {
xml.enabled = false
html.enabled = false
txt.enabled = false
}
}
val detektProjectBaseline by tasks.registering(DetektCreateBaselineTask::class) {
description = "Overrides current baseline."
buildUponDefaultConfig.set(true)
ignoreFailures.set(true)
parallel.set(true)
setSource(analysisDir)
config.setFrom(listOf(statisticsConfigFile, configFile))
include(kotlinFiles)
include(kotlinScriptFiles)
exclude(resourceFiles)
exclude(buildFiles)
baseline.set(baselineFile)
}