Hi! Is it possible to configure ktlint so that it only accepts one way of formatting the code?
What i find frustrating is that you can format with ktlint, change the formatting manually, then run ktlint again, and it will accept both formattings. To leave no room for discussion/uneccesary changes in PRs such a feature would be really good.
b
Brais Gabin
03/09/2023, 7:50 PM
If your are looking for a more strict formatter you can check ktfmt.
m
Mkohm
03/09/2023, 7:58 PM
Thanks! What is the reason behind not having super strict rules? Wouldnt that be more «anti-bikeshedding»?
b
Brais Gabin
03/09/2023, 8:01 PM
A strict formatter and intellij doesn't work that well together. I think that's one of the reasons. But I don't know the real reasons behind it.
m
Mkohm
03/09/2023, 8:04 PM
Darfmt in intellij works flawlessly- after programming in dart for a while i really missed the formatter when going back to Kotlin. Thats why i asked here, but will test ktfmt!
s
Sha Sha Chu
03/09/2023, 8:06 PM
@Mkohm could you file an issue on github? that sounds surprising but given the interaction between different rules it's possible that happens
m
Mkohm
03/09/2023, 8:14 PM
Might be that i havent played around enough with the rules. Will create an issue next time i experience it 😊