jeremymailen / kotlinter-gradle

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

Multi Module project not reading editorconfig file in the root directory #303

Closed jonschmidt closed 1 year ago

jonschmidt commented 1 year ago

I have a .editorconfig file in my root directory, and when I run lintKotlin it seems to ignore any configuration I have in there. If I copy the editorconfig file into a submodule directory, then that submodule directory acutally uses the configuration just fine. According to everything I am reading, ktlint should traverse upwards until it hits the root directory and use the editorconfig it finds there, but this does not seem to work? I am following the multi module instructions in the documentation and using version 3.12.0

mateuszkwiecinski commented 1 year ago

Hey @jonschmidt 👋 Thanks for reporting the issue. Would you be able to provide a repro project? AFAICS this plugin doesn't influence which .editorconfig files are taken into account when running ktlint 🤔

I'll have a couple of thoughts/suggestion that should help you to narrow down the root cause:

  1. Does any of your .editorconfig files have root=true clause? It would stop traversing upwards file hierarchy.
  2. Would an --info parameter added to your gradle invocation reveal any useful details on which .edidorconfig files are taken into account?
  3. Having https://github.com/jeremymailen/kotlinter-gradle/issues/262 in mind - does killing gradle daemon with ./gradlew stop change/fix the behaviour you observe?
  4. Are you able to reproduce the same behaviour when running ktlint from CLI? 👀
jonschmidt commented 1 year ago

Hey, so this actually works now. It might have been a matter of killing the gradle daemon actually, as I reported this right when I first installed the plugin. Things seem to work ok now though. Thanks

mateuszkwiecinski commented 1 year ago

Thanks for sharing that 🙏 I'm glad you managed to make the plugin work in your case :) I have a suspicion on what might be the root cause, but I have it on my TODO list, after I manage to merge all me PRs and Ktlint APIs stabilize a bit 😅

I'll close the issue for now, as there is nothing actionable for the given moment. Thanks again for reporting issues!