Is there a way to enforce curly braces for if statements and loops in Kotlin, or even better, automatically add it (like the code formatter in Ktlint does)?
I noticed there are options in
Ktlint seems to have such options, but it's marked as experimental and it will only show warnings
What are other teams using for automated code formatting in Kotlin?
👍 1
s
spand
10/06/2020, 1:01 PM
We only rely on IDEA doing it on the go since we only want to auto format on changed lines in a commit. Have not looked much around if that is possible with tools like Ktlint but I assume not.
j
janvladimirmostert
10/06/2020, 1:28 PM
how does one setup IDEA to do it, is this via .editorconfig or is there another place where you can set it up?
s
spand
10/06/2020, 1:31 PM
Code -> Reformat File -> Only VCS changed text
spand
10/06/2020, 1:32 PM
We manually get people to set this setting
spand
10/06/2020, 1:32 PM
I think this is the behavior with Reformat code in the commit dialog
j
janvladimirmostert
10/06/2020, 1:36 PM
ah, under Version control, there are Before Commit options, i guess this is a good start
Thanks for the input!