incubator-jspwiki-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glen Mazza <>
Subject Switching to different bracing style?
Date Fri, 19 Jul 2013 21:35:41 GMT
Hi Team, the next Sonar complaint, and there's a significant 500 of them 
within JSPWiki, is that we're not using braces for single-line 
if/while/for loops.  I know for CXF braces are always required, and I 
suspect the majority of Apache projects today also disallow them, so the 
requirement is not unreasonable.  Fixing them is not the problem, what 
*is* the problem is our older-fashioned bracing system, i.e., instead of 
switching from this

Style A:

if (a > b)
    c = 10;
else if (d > e)
    f = 20;

to this (the bracing system JSPWiki presently uses):

Style B:

if (a > b)
    c = 10;
else if (d > e)
    f = 20;

I'd like to be doing this instead:

Style C:

if (a > b) {
    c = 10;
} else if (d > e) {
    f = 20;

I've checked five major open source projects -- Style C is all they use:


Camel -

Tomcat -

Hadoop -

Spring Framework:

Style B might be OK for projects that still allow Style A, but it makes 
the code too bloated once Style A is disallowed.  I don't think we'll be 
able to attract many committers sticking with Style B anymore.  
Basically, to avoid the busywork of converting Style B to Style C, we'll 
allow either in our source code but with the expectation that more and 
more code will be adopting Style C as time moves on, how does that 
sound?  (Or, do we want to continue with allowing Style A and Style 
B?--we're welcome to ignore Sonar on this.)


View raw message