Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ktlint_code_style=android in your editorconfig does not appear to be respected by this plugin #652

Open
DavidCorrado opened this issue Mar 9, 2023 · 1 comment
Assignees

Comments

@DavidCorrado
Copy link

DavidCorrado commented Mar 9, 2023

From the docs for ktlint. ktlint_code_style in your editorconfig should be all you need to set for android rule set

"The CLI parameter --android can be omitted when the .editorconfig property ktlint_code_style = android is defined"

I added ktlint to this example project(DavidCorrado/ktlintExample@3ce45aa). 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

@idunnololz
Copy link

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")
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants