-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
71 lines (63 loc) · 2.55 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
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.report.ReportMergeTask
plugins {
// this is necessary to avoid the plugins to be loaded multiple times
// in each subproject's classloader
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.jetbrainsCompose) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.kotlinJvm) apply false
alias(libs.plugins.kotlinMultiplatform) apply false
id("io.gitlab.arturbosch.detekt").version("1.23.1")
}
val detektReportMergeSarif by tasks.registering(ReportMergeTask::class) {
output = layout.buildDirectory.file("reports/detekt/merge.sarif")
}
subprojects {
apply(plugin = "io.gitlab.arturbosch.detekt")
detekt {
// The directories where detekt looks for source files.
// Defaults to `files("src/main/java", "src/test/java", "src/main/kotlin", "src/test/kotlin")`.
source.setFrom(
"src/main/java",
"src/main/kotlin",
"src/commonMain/kotlin",
"src/desktopMain/kotlin",
"src/iosMain/kotlin",
"src/wasmJsMain/kotlin",
"src/androidMain/kotlin"
)
// Builds the AST in parallel. Rules are always executed in parallel.
// Can lead to speedups in larger projects. `false` by default.
parallel = true
autoCorrect = true
// Android: Don't create tasks for the specified build types (e.g. "release")
ignoredBuildTypes = listOf("release")
// Specify the base path for file paths in the formatted reports.
// If not set, all file paths reported will be absolute file path.
basePath = projectDir.absolutePath
}
dependencies {
val detektVersion = "1.23.1"
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:$detektVersion")
detektPlugins("io.gitlab.arturbosch.detekt:detekt-rules-libraries:$detektVersion")
detektPlugins("io.gitlab.arturbosch.detekt:detekt-rules-ruleauthors:$detektVersion")
}
tasks.withType<Detekt>().configureEach {
reports {
xml.required = true
html.required = true
txt.required = true
sarif.required = true
md.required = true
}
autoCorrect = true
basePath = rootDir.absolutePath
finalizedBy(detektReportMergeSarif)
}
detektReportMergeSarif {
input.from(
tasks.withType<Detekt>().map { it.sarifReportFile })
}
}