Re: Modifying NeedsBraces Check
Dinesh Bolkensteyn <[email protected]> Mon, 20 Feb 2012 10:48:51 +0100
| Newsgroups | gmane.comp.java.audit.checkstyle.user |
|---|---|
| Message-ID | <CAA06TwMAkBJak-NQtS8mVK3Xx4o63PQnWd5RP=xej0gxsJg9Qg@mail.gmail.com> |
--===============4481599005083128200== Content-Type: multipart/alternative; boundary=047d7b2e4aeca6674e04b9623323 --047d7b2e4aeca6674e04b9623323 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable To me it does not make sense to allow case 1 but not case 2 in your example= . I don't think that case 1 has a lower fixing priority than the case 2. If your IDE is properly and consistently set up among your team members, all those missing braces will eventually get fixed automagically as you work on each file of the legacy codebase. -- Dinesh Bolkensteyn www.SonarSource.com <http://www.sonarsource.com/> twitter.com/DBolkensteyn <http://www.SonarSource.com> On Mon, Jan 30, 2012 at 7:03 PM, Mark Tymieniecki <[email protected]>wr= ote: > Hi Dinesh,**** > > ** ** > > I don=92t suppose you have seen my observation regarding =91cannot instan= tiate > =96 LoggerAttrCheck=92 . I suspect that its probably an incorrect setting= is > some mysterious XML file I have not detected from the documentation, but = I > am open to suggestions as to my code being crap.**** > > ** ** > > Regards**** > > ** ** > > ** ** > > *From:* Dinesh Bolkensteyn [mailto:[email protected]] > *Sent:* 30 January 2012 07:20 > *To:* [email protected] > *Subject:* Re: [Checkstyle-user] Modifying NeedsBraces Check**** > > ** ** > > If you have more than 1 statement to be executed conditionally, you will > *need* braces.**** > > **** > > It is pointless to modify a "need braces" check so that it won't complain > about missing braces anymore.**** > > **** > > I guess that what you want is more an indentation check, to allow:**** > > **** > > if (condition)**** > > statement**** > > **** > > but to reject:**** > > **** > > if (condition) statement**** > > On Sun, Jan 29, 2012 at 5:48 PM, tymieniecki <[email protected]> > wrote:**** > > Hi Folks, > > OK now lets accept that the NEEDSBRACES is absolute, but I am sure we com= e > across 'pragmatic' sites who take the view that if there is only one > statement, why have braces, of the form: > If (condition) > java statement; > Else > { > java statement; > java statement; > java statement; > } > > is there any value in modifying NEEDS BRACES to accept one extra property= : > TOKENS - Tokens within which single line blocks are acceptable > > Regards > > > > > > > > > -- > View this message in context: > http://checkstyle.2069334.n4.nabble.com/Modifying-NeedsBraces-Check-tp433= 8644p4338644.html > Sent from the CheckStyle - User mailing list archive at Nabble.com. > > > -------------------------------------------------------------------------= ----- > Try before you buy =3D See our experts in action! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-dev2 > _______________________________________________ > Checkstyle-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/checkstyle-user**** > > ** ** > > > -------------------------------------------------------------------------= ----- > Try before you buy =3D See our experts in action! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-dev2 > _______________________________________________ > Checkstyle-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/checkstyle-user > > --047d7b2e4aeca6674e04b9623323 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable To me it does not make sense to allow case 1 but not case 2 in your example= .<div><br></div><div>I don't think that case 1 has a lower fixing prior= ity than the case 2.</div><div><br></div><div>If your IDE is properly and c= onsistently set up among your team members, all those missing braces will e= ventually get fixed automagically as you work on each file of the legacy co= debase.</div> <div><span style=3D"font-family:arial,sans-serif;font-size:13px;border-coll= apse:collapse"><br>--<br>Dinesh Bolkensteyn<br></span><span style=3D"font-f= amily:arial,sans-serif;font-size:13px;border-collapse:collapse"><a href=3D"= http://www.sonarsource.com/" target=3D"_blank">www.SonarSource.com</a></spa= n><br> <a href=3D"http://twitter.com/DBolkensteyn" target=3D"_blank">twitter.com/D= Bolkensteyn</a><span style=3D"font-family:arial,sans-serif;font-size:13px;b= order-collapse:collapse"></span><span style=3D"font-family:arial,sans-serif= ;font-size:13px;border-collapse:collapse"><a href=3D"http://www.SonarSource= .com" target=3D"_blank"></a></span><br> <br> <br><br><div class=3D"gmail_quote">On Mon, Jan 30, 2012 at 7:03 PM, Mark Ty= mieniecki <span dir=3D"ltr"><<a href=3D"mailto:[email protected]">ty= [email protected]</a>></span> wrote:<br><blockquote class=3D"gmail_quo= te" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"= > <div lang=3D"EN-GB" link=3D"blue" vlink=3D"purple"><div><p class=3D"MsoNorm= al"><span style=3D"font-size:11.0pt;color:#1f497d">Hi Dinesh,<u></u><u></u>= </span></p><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;color:#1f= 497d"><u></u>=A0<u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;color:#1f497d">I don= =92t suppose you have seen my observation regarding =91cannot instantiate = =96 LoggerAttrCheck=92 . I suspect that its probably an incorrect setting i= s some mysterious XML file I have not detected from the documentation, but = I am open to suggestions as to my code being crap.<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;color:#1f497d"><u></= u>=A0<u></u></span></p><p class=3D"MsoNormal"><span style=3D"font-size:11.0= pt;color:#1f497d">Regards<u></u><u></u></span></p><div class=3D"im"><p clas= s=3D"MsoNormal"> <span style=3D"font-size:11.0pt;color:#1f497d"><u></u>=A0<u></u></span></p>= <p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;color:#1f497d"><u></= u>=A0<u></u></span></p><p class=3D"MsoNormal"><b><span lang=3D"EN-US" style= =3D"font-size:10.0pt;font-family:"Tahoma","sans-serif""= >From:</span></b><span lang=3D"EN-US" style=3D"font-size:10.0pt;font-family= :"Tahoma","sans-serif""> Dinesh Bolkensteyn [mailto:<a = href=3D"mailto:[email protected]" target=3D"_blank">dinesh= [email protected]</a>] <br> <b>Sent:</b> 30 January 2012 07:20<br><b>To:</b> <a href=3D"mailto:checksty= [email protected]" target=3D"_blank">[email protected]= ceforge.net</a><br><b>Subject:</b> Re: [Checkstyle-user] Modifying NeedsBra= ces Check<u></u><u></u></span></p> <p class=3D"MsoNormal"><u></u>=A0<u></u></p></div><div><p class=3D"MsoNorma= l">If you have more than 1 statement to be executed conditionally, you will= *need* braces.<u></u><u></u></p></div><div><div class=3D"h5"><div><p class= =3D"MsoNormal"> =A0<u></u><u></u></p></div><div><p class=3D"MsoNormal">It is pointless to m= odify a "need braces" check so that it won't complain about m= issing braces anymore.<u></u><u></u></p></div><div><p class=3D"MsoNormal">= =A0<u></u><u></u></p> </div><div><p class=3D"MsoNormal">I guess that what you want is more=A0an i= ndentation check, to allow:<u></u><u></u></p></div><div><p class=3D"MsoNorm= al">=A0<u></u><u></u></p></div><div><p class=3D"MsoNormal">if (condition)<u= ></u><u></u></p> </div><div><p class=3D"MsoNormal">=A0 statement<u></u><u></u></p></div><div= ><p class=3D"MsoNormal">=A0<u></u><u></u></p></div><div><p class=3D"MsoNorm= al">but to reject:<u></u><u></u></p></div><div><p class=3D"MsoNormal">=A0<u= ></u><u></u></p> </div><div><p class=3D"MsoNormal">if (condition) statement<u></u><u></u></p= ></div><div><p class=3D"MsoNormal">On Sun, Jan 29, 2012 at 5:48 PM, tymieni= ecki <<a href=3D"mailto:[email protected]" target=3D"_blank">tymieni= [email protected]</a>> wrote:<u></u><u></u></p> <p class=3D"MsoNormal">Hi Folks,<br><br>OK now lets accept that the NEEDSBR= ACES is absolute, but I am sure we come<br>across 'pragmatic' sites= who take the view that if there is only one<br>statement, why have braces,= of the form:<br> If (condition)<br>=A0 java statement;<br>Else<br>{<br>=A0java statement;<br= >=A0java statement;<br>=A0java statement;<br>}<br><br>is there any value in= modifying NEEDS BRACES to accept one extra property :<br>TOKENS - Tokens w= ithin which single line blocks are acceptable<br> <br>Regards<br><br><br><br><br><br><br><br><br>--<br>View this message in c= ontext: <a href=3D"http://checkstyle.2069334.n4.nabble.com/Modifying-NeedsB= races-Check-tp4338644p4338644.html" target=3D"_blank">http://checkstyle.206= 9334.n4.nabble.com/Modifying-NeedsBraces-Check-tp4338644p4338644.html</a><b= r> Sent from the CheckStyle - User mailing list archive at Nabble.com.<br><br>= ---------------------------------------------------------------------------= ---<br>Try before you buy =3D See our experts in action!<br>The most compre= hensive online learning library for Microsoft developers<br> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,<br= >Metro Style Apps, more. Free future releases when you subscribe now!<br><a= href=3D"http://p.sf.net/sfu/learndevnow-dev2" target=3D"_blank">http://p.s= f.net/sfu/learndevnow-dev2</a><br> _______________________________________________<br>Checkstyle-user mailing = list<br><a href=3D"mailto:[email protected]" target=3D"= _blank">[email protected]</a><br><a href=3D"https://lis= ts.sourceforge.net/lists/listinfo/checkstyle-user" target=3D"_blank">https:= //lists.sourceforge.net/lists/listinfo/checkstyle-user</a><u></u><u></u></p= > </div><p class=3D"MsoNormal"><u></u>=A0<u></u></p></div></div></div></div><= br>------------------------------------------------------------------------= ------<br> Try before you buy =3D See our experts in action!<br> The most comprehensive online learning library for Microsoft developers<br> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,<br= > Metro Style Apps, more. Free future releases when you subscribe now!<br> <a href=3D"http://p.sf.net/sfu/learndevnow-dev2" target=3D"_blank">http://p= .sf.net/sfu/learndevnow-dev2</a><br>_______________________________________= ________<br> Checkstyle-user mailing list<br> <a href=3D"mailto:[email protected]">Checkstyle-user@li= sts.sourceforge.net</a><br> <a href=3D"https://lists.sourceforge.net/lists/listinfo/checkstyle-user" ta= rget=3D"_blank">https://lists.sourceforge.net/lists/listinfo/checkstyle-use= r</a><br> <br></blockquote></div><br></div> --047d7b2e4aeca6674e04b9623323-- --===============4481599005083128200== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 --===============4481599005083128200== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Checkstyle-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/checkstyle-user --===============4481599005083128200==--