-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
55 lines (49 loc) · 1.71 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
plugins {
alias(libs.plugins.androidApplication).apply(false)
alias(libs.plugins.androidLibrary).apply(false)
alias(libs.plugins.kotlinAndroid).apply(false)
alias(libs.plugins.kotlinMultiplatform).apply(false)
alias(libs.plugins.ktlint)
alias(libs.plugins.detekt)
}
subprojects {
apply(plugin = "org.jlleitschuh.gradle.ktlint")
apply(plugin = "io.gitlab.arturbosch.detekt")
ktlint {
val ktlintFiles = project.findProperty("ktlintFiles") as? String
if (ktlintFiles != null) {
filter {
include(ktlintFiles.split("\n"))
}
}
reporters {
reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.PLAIN)
}
}
detekt {
toolVersion = "1.23.1"
config = files("$rootDir/detekt-config.yml")
buildUponDefaultConfig = true
val detektFiles = project.findProperty("detektFiles") as? String
if (detektFiles != null) {
source = files(detektFiles.split(","))
} else {
// Default source
source = files("src/main/java", "src/main/kotlin")
}
reports {
xml.required.set(true)
xml.outputLocation.set(file("build/reports/detekt/detekt.xml"))
sarif.required.set(true)
sarif.outputLocation.set(file("build/reports/detekt/detekt.sarif"))
}
}
tasks.withType<io.gitlab.arturbosch.detekt.Detekt>().configureEach {
exclude { fileTreeElement ->
val path = fileTreeElement.file.absolutePath
path.contains("/build/") ||
path.endsWith("build.gradle.kts") ||
path.endsWith("settings.gradle.kts")
}
}
}