jeremymailen / kotlinter-gradle

Painless, fast ktlint plugin for Gradle
Apache License 2.0
597 stars 50 forks source link

Task formatKotlin does not respect ignored directories. #337

Open strindberg opened 1 year ago

strindberg commented 1 year ago

We have configured the linter to ignore our (generated) code directory db like so:

tasks.lintKotlinMain {
    exclude("**/db/**")
}

This works fine. However, when running task formatKotlin, the formatter does not respect this setting but formats the code in the db directory.

jasonab commented 1 year ago

I got it to work this way: https://github.com/jeremymailen/kotlinter-gradle/issues/251#issuecomment-1577310228

strindberg commented 1 year ago

Thank you, that's a good workaround. However, I still think there is room for improvement in the plugin: either that the format task inherits its exclusions from the lint task if no exclusions are specified, or that the format task also can be configured in the same way as the lint task, i.e. with an exclude-dsl.