Is there a good summary somewhere on how to deal w...
# ktlint
p
Is there a good summary somewhere on how to deal with enforcing/allowing trailing commas and other rules? I'm struggling with an issue where the ktlint Gradle plugin doesn't enforce them, while IntelliJ does. I managed to change it by adding some trailing comma-related rules to .editorconfig, but I don't like the fact that I have to configure ktlint for the build system in one place, and for the IDE in the other. What's the recommended way to keep things in sync between these two environments (also applies to all other rules, so that there's a single source of truth on what ktlint enforces)?
p
I am not sure about the Gradle plugin. But
.editorconfig
is respected by IntelliJ IDEA and ktlint. But this will only work with Gradle plugin only if that plugin does not overwrite the defaults which are specified in the
.editorconfig
.
n
This may also be due to the ktlint Gradle plugin still not supporting the latest versions of ktlint https://github.com/JLLeitschuh/ktlint-gradle/issues/589
p
Hmm, true. The plugin has some maintainability issues: https://github.com/JLLeitschuh/ktlint-gradle/issues/569
p
On the long term we might adopt either the Gradle plugin or the kotlinter-plugin into the ktlint library. But we face the same problem as the maintainers of both plugins (e.g. a shortage on active contributors and maintainers).
p
FTR, what I did to get it resolved: • updated my .editorconfig to include trailing comma-related rules (commit) • moved to another Gradle plugin (jeremymailen/kotlinter-gradle) that wraps ktlint and provides its newest version (commit)