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

.editorconfig file per module? #321

Closed
jasonab opened this issue Apr 7, 2023 · 7 comments
Closed

.editorconfig file per module? #321

jasonab opened this issue Apr 7, 2023 · 7 comments

Comments

@jasonab
Copy link
Contributor

jasonab commented Apr 7, 2023

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?

@jeremymailen
Copy link
Owner

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?

@jasonab
Copy link
Contributor Author

jasonab commented Apr 11, 2023

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.

@jasonab
Copy link
Contributor Author

jasonab commented Apr 11, 2023

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.

@jeremymailen
Copy link
Owner

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?

@jasonab
Copy link
Contributor Author

jasonab commented Apr 14, 2023

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.

@jeremymailen
Copy link
Owner

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.

@jeremymailen
Copy link
Owner

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

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

2 participants