jeremymailen / kotlinter-gradle

Painless, fast ktlint plugin for Gradle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

.editorconfig file per module?

jasonab opened this issue · comments

I'm not sure what the expected behavior is here - I have a .editorconfig file in my root, but the submodules do not respect the rules in that file. If I copy that file into each submodule, then kotlinter/ktlint respects those rules, but this seems like a bad pattern. Do I need to configure kotlinter somehow to use my root .editorconfig or am I supposed to copy it?

It should honor an .editorconfig file in the root directory and editorconfig files further down the tree can modify that behavior as per the spec for editorconfig.

Largely this behavior is implemented in the underlying ktlint library via ec4j.
Is there anything unusual about your project? Is kotlinter-gradle applied to the root project or just the submodules?

Should not be anything unusual - standard root project with several subprojects. We do apply the kotliner plugin to the root to do config, but I guess I'm not sure if that actually carries over. We also apply the plugin to all the submodules.

Ok, I think I figured it out - the gradle daemon is caching the .editorconfig file, and not respecting changes to it. I'm not sure where that's coming from, but I can reproduce it regularly. This is with gradle 7.6.1.

Ok, yeah, the .editorconfig not being re-evaluated is an issue that's come up, although I thought we fixed it in https://github.com/jeremymailen/kotlinter-gradle/releases/tag/3.12.0.
Which version are you on?

Looks like that was using 3.12

Sorry, that was using 3.14. I will say that often I was not changing code files in between formatting runs, just the .editorconfig file, so I'm not sure if that bypassed your fix.

The fix was basically to track the .editorconfig files as inputs to the build to correctly re-run tasks when they changed.
So one possibility is a really long lived gradle daemon with some cruft.
The other possibility is we didn't fix the bug like we thought.

Yeah, I'll close this for now and open a bug for editorconfig staleness.