Re: Modifying NeedsBraces Check
Dinesh Bolkensteyn <[email protected]> Mon, 30 Jan 2012 08:19:43 +0100
| Newsgroups | gmane.comp.java.audit.checkstyle.user |
|---|---|
| Message-ID | <CAA06TwNcXWz4Tg16_iDcM79adjA99L-J_hBEU5yg1p8v3uBJ+Q@mail.gmail.com> |
--===============0554024469690782660== Content-Type: multipart/alternative; boundary=14dae9340449ab216004b7b9abef --14dae9340449ab216004b7b9abef Content-Type: text/plain; charset=ISO-8859-1 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 come > 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-tp4338644p4338644.html > Sent from the CheckStyle - User mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > 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 > _______________________________________________ > Checkstyle-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/checkstyle-user > --14dae9340449ab216004b7b9abef Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <div>If you have more than 1 statement to be executed conditionally, you wi= ll *need* braces.</div> <div>=A0</div> <div>It is pointless to modify a "need braces" check so that it w= on't complain about missing braces anymore.</div> <div>=A0</div> <div>I guess that what you want is more=A0an indentation check, to allow:</= div> <div>=A0</div> <div>if (condition)</div> <div>=A0 statement</div> <div>=A0</div> <div>but to reject:</div> <div>=A0</div> <div>if (condition) statement<br></div> <div class=3D"gmail_quote">On Sun, Jan 29, 2012 at 5:48 PM, tymieniecki <sp= an dir=3D"ltr"><<a href=3D"mailto:[email protected]">tymienieckiM@o2= .co.uk</a>></span> wrote:<br> <blockquote style=3D"BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PA= DDING-LEFT:1ex" class=3D"gmail_quote">Hi Folks,<br><br>OK now lets accept t= hat the NEEDSBRACES is absolute, but I am sure we come<br>across 'pragm= atic' 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 stat= ement;<br>Else<br>{<br>=A0java statement;<br>=A0java statement;<br>=A0java = statement;<br>}<br><br>is there any value in modifying NEEDS BRACES to acce= pt one extra property :<br> TOKENS - Tokens within which single line blocks are acceptable<br><br>Regar= ds<br><br><br><br><br><br><br><br><br>--<br>View this message in context: <= a href=3D"http://checkstyle.2069334.n4.nabble.com/Modifying-NeedsBraces-Che= ck-tp4338644p4338644.html" target=3D"_blank">http://checkstyle.2069334.n4.n= abble.com/Modifying-NeedsBraces-Check-tp4338644p4338644.html</a><br> 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]">Checkstyle= [email protected]</a><br><a href=3D"https://lists.sourceforge.net= /lists/listinfo/checkstyle-user" target=3D"_blank">https://lists.sourceforg= e.net/lists/listinfo/checkstyle-user</a><br> </blockquote></div><br> --14dae9340449ab216004b7b9abef-- --===============0554024469690782660== 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 --===============0554024469690782660== 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 --===============0554024469690782660==--