-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
89 lines (81 loc) · 2.93 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
89 lines (81 loc) · 2.93 KB
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
plugins {
alias(libs.plugins.android.kotlin.multiplatform.library) apply false
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.composeMultiplatform) apply false
alias(libs.plugins.composeCompiler) apply false
alias(libs.plugins.vanniktech.mavenPublish) apply false
alias(libs.plugins.detekt)
alias(libs.plugins.spotless)
}
// Detekt configuration for the entire project
detekt {
buildUponDefaultConfig = true
allRules = false
config.setFrom("$rootDir/config/detekt/detekt.yml")
baseline = file("$rootDir/config/detekt/baseline.xml")
parallel = true
}
dependencies {
detektPlugins(libs.detekt.formatting)
}
tasks.withType<io.gitlab.arturbosch.detekt.Detekt>().configureEach {
reports {
html.required.set(true)
xml.required.set(true)
txt.required.set(false)
sarif.required.set(false)
}
jvmTarget = "11"
}
// Spotless configuration for code formatting
spotless {
kotlin {
target("**/*.kt")
// `sample/` is a loose reference snippet (not a compiled module) — wildcard imports keep it
// readable as documentation; it is not production source, so it is excluded from lint.
targetExclude("**/build/**/*.kt", "**/.gradle/**/*.kt", "sample/**/*.kt")
ktlint(libs.versions.ktlint.get())
.editorConfigOverride(
mapOf(
"android" to "true",
"indent_size" to "4",
"continuation_indent_size" to "4",
"max_line_length" to "120",
"ktlint_function_naming_ignore_when_annotated_with" to "Composable",
"ktlint_standard_function-naming" to "disabled",
"ktlint_standard_package-name" to "disabled",
),
)
trimTrailingWhitespace()
indentWithSpaces(4)
endWithNewline()
}
kotlinGradle {
target("**/*.gradle.kts")
targetExclude("**/build/**/*.gradle.kts")
ktlint(libs.versions.ktlint.get())
trimTrailingWhitespace()
indentWithSpaces(4)
endWithNewline()
}
format("misc") {
target("**/*.md", "**/.gitignore", "**/*.yaml", "**/*.yml")
// Never lint generated / vendored trees — node_modules + JS dist contain
// markdown/yaml we don't own (and dangling symlinks that break the scan).
targetExclude("**/build/**", "**/.gradle/**", "**/node_modules/**", "**/dist/**")
trimTrailingWhitespace()
indentWithSpaces(4)
endWithNewline()
}
}
// Configure the existing check task to include Detekt and Spotless
tasks.named("check") {
dependsOn("detekt", "spotlessCheck")
}
// Task to apply all fixes
tasks.register("fix") {
group = "verification"
description = "Applies all automatic fixes including Spotless formatting"
dependsOn("spotlessApply")
}