Skip to content

Commit 87b5eac

Browse files
committed
Swap to ktfmt (googleStyle), but keep ktlint for gradle scripts (#233)
Seems like this is the way to go...? Related: will-molloy/java-template#245 GitOrigin-RevId: 65b15a6b34bff8a4072558e718b2ed055c44ecf6
1 parent f45b46d commit 87b5eac

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

build.gradle.kts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,19 @@ allprojects {
3737

3838
apply(plugin = "com.diffplug.spotless")
3939
configure<SpotlessExtension> {
40+
// https://github.com/diffplug/spotless/tree/main/plugin-gradle#java
4041
java {
4142
removeUnusedImports()
4243
googleJavaFormat()
4344
trimTrailingWhitespace()
4445
endWithNewline()
4546
}
47+
// https://github.com/diffplug/spotless/tree/main/plugin-gradle#kotlin
48+
// Compared to ktlint, it seems ktfmt is better for actual Kotlin code (more deterministic/consistent output).
49+
// Furthermore, spotless is more for formatting than linting.
50+
// However, it has some weird output with Gradle scripts, so using ktlint for that.
4651
kotlin {
47-
ktlint().editorConfigOverride(mapOf("ktlint_standard_package-name" to "disabled"))
52+
ktfmt().googleStyle()
4853
trimTrailingWhitespace()
4954
endWithNewline()
5055
}
@@ -55,7 +60,7 @@ allprojects {
5560
}
5661
}
5762

58-
// TODO detekt for kotlin
63+
// TODO Kotlin alternative?
5964
apply(plugin = "checkstyle")
6065
configure<CheckstyleExtension> {
6166
toolVersion = "10.12.0"

0 commit comments

Comments
 (0)