[Qt-creator] Coding style: Braces & single-line statements

Poenitz Andre Andre.Poenitz at digia.com
Thu Sep 20 10:38:30 CEST 2012


Christian Kandeler wrote:
> [...] The final else clause forces braces for all other conditional
> statements. Now if I remove the call to prepareStuff, e.g. because it is
> integrated into functionx, suddenly ALL the braces must go, because only
> one-line statements are left.
> In my experience, this kind of stuff happens a lot, and it's mighty
> annoying both for the person who has to add/remove lots of braces for no
> sensible reason and for the reviewer, who is distracted from the actual
> content of the patch by all the noise.

You are already excused by the preamble:

   "As usual, rules are not set in stone. If you have a good reason to break one, do so. 
   But first make sure that at least some other developers agree with you."

> I therefore propose that we stop disallowing braces for one-line
> statements, instead leaving the decision to the discretion of the
> respective developer.

I think the issue is covered by the existing rules, so the rules do not need to be changed.
Reformatting in such cases is optional as "not wanting to do excessive extra work"
 _is_ a good reason and you'll surely find another developer agreeing with that.

Andre'



More information about the Qt-creator mailing list