ktlint-gradle
ktlint-gradle copied to clipboard
ktlint_code_style=android in your editorconfig does not appear to be respected by this plugin
From the docs for ktlint. ktlint_code_style in your editorconfig should be all you need to set for android rule set
- https://pinterest.github.io/ktlint/rules/configuration-ktlint/#code-style
- https://pinterest.github.io/ktlint/install/cli/#miscellaneous-flags-and-commands
- https://github.com/pinterest/ktlint/releases/tag/0.46.0
"The CLI parameter --android can be omitted when the .editorconfig property ktlint_code_style = android is defined"
I added ktlint to this example project(https://github.com/DavidCorrado/ktlintExample/commit/3ce45aaeb316d055994b517c22d315ea7b28a617). I might be understanding things wrong but my understanding was if I use in editorconfig
ktlint_code_style = android
I dont need
ktlint {
android.set(true)
}
You should be able to reproduce android rule set being ran here by running app:ktlintCheck https://github.com/DavidCorrado/ktlintExample
Then if you comment out the android.set here https://github.com/DavidCorrado/ktlintExample/blob/main/app/build.gradle#L68 You will see that you get trailing-comma-on-call-site,trailing-comma-on-declaration-site violations. Which I think are nonandroid rules
Convo in kotlin slack https://kotlinlang.slack.com/archives/CKS3XG0LS/p1676489483257549
On 11.5.0 of the plugin I am able to get this to work. I had to set the ktlin version explicitly on all subprojects like so:
subprojects {
apply(plugin = "org.jlleitschuh.gradle.ktlint")
configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
version.set("0.50.0")
android.set(true)
}
}
configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
version.set("0.50.0")
}