Le 14/07/2020 à 10:15, Jacques Le Roux a écrit :
My conclusion is that could be discussed again and I for one I'm not against
changing this rule for 2 reasons:
1. We can't use our current formatter to do it right
2. With a single line statement there are less chances to confuse and fall
in the error-prone form mentioned above
Another option would be to find a way to improve our formatter to do the right thing (ie add braces when splitting).
We discussed the point 1 with Suraj in Slack. It's actually possible in both
IntelliJ
https://www.jetbrains.com/help/resharper/Braces_for_Single_Line_Statements.html
https://stackoverflow.com/questions/55248370/intellij-checkstyle-plugin-reformat
and Eclipse
https://stackoverflow.com/questions/3704308/how-to-make-eclipse-automatically-add-braces-to-an-if-statement
I don't know for IntelliJ, but in Eclipse it's not a formatting option but a
clean-up option.
And when you clean-up you can't select a block of code, it's all the file or
nothing.
There are then more changes and some are unwanted.
So I agree with Suraj and Pritam, let's do that. There would be anyway so much
changes to do by hand that it's not rational!
Jacques