Re: False report of AvoidInlineConditionals?
<[email protected]> Mon, 19 Aug 2013 14:33:03 +0000
| Newsgroups | gmane.comp.java.audit.checkstyle.user |
|---|---|
| Message-ID | <9BB759DFA3BCFF4E8A4C5F9588AE83710943EC02@C111WHRPMBX28.ERF.thomson.com> |
--===============7887410008592058346==
Content-Language: en-US
Content-Type: multipart/alternative;
boundary="_000_9BB759DFA3BCFF4E8A4C5F9588AE83710943EC02C111WHRPMBX28ER_"
--_000_9BB759DFA3BCFF4E8A4C5F9588AE83710943EC02C111WHRPMBX28ER_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
A reply from the Listserver asked for a complete sample Java file, and a co=
nfiguration file demonstrating the problem.
The request for the configuration file ... revealed the cause of the proble=
m. In the configuration file, there is an entry for RegexpMultiline. The =
"format" is not adequate, and thus falsely reported an error. I made a bad=
assumption, that this configuration was a built-in check (and a built-in f=
ormat) provided and initialized by the out-of-the-box Checkstyle configurat=
ion.
<module name=3D"RegexpMultiline">
<property name=3D"format" value=3D"\? [^;,]* \?"/>
<property name=3D"message" value=3D"Nested inline conditionals are =
not permitted"/>
</module>
In short, this is a problem with our team's configuration file, and it is n=
ot an issue/bug within the CheckStyle plugin.
// Mark Determan
>>>>>>>>>>>>>>>>>>>>>>>>>>>
From: Oliver Burn [mailto:[email protected]]
Sent: Friday, August 16, 2013 5:32 PM
To: [email protected]
Subject: Re: [Checkstyle-user] False report of AvoidInlineConditionals?
Can you provide a complete sample Java file and configuration file demonstr=
ating the problem. That would be a great help
On 17 Aug 2013 01:06, <[email protected]<mailto:mark.c.det=
[email protected]>> wrote:
I am seeing a false violation for AvoidInlineConditional, when using Checks=
tyle 5.6.
The java code that triggers the Checkstyle violation is:
//This is a SQL statement and not an inline conditional
private static final String NON_ADMIN_USER_QUERY =3D
"INSERT INTO TEMP_PERMISSIONS (RESOURCE_ID) SELECT distinct " +
"V_ENTITY_PERMISSION.ENTITY_ID FROM V_ENTITY_PERMISSION, %s resourc=
e_table " +
"where V_ENTITY_PERMISSION.ENTITY_ID =3D resource_table.%s " +
"and V_ENTITY_PERMISSION.MEMBER_GUID in (%s) and V_ENTITY_PERMISSIO=
N.ENTITY_TYPE =3D ? " +
"and V_ENTITY_PERMISSION.ROLE <=3D ? and resource_table.CUSTOMER_ST=
ORAGE_ID =3D ? " +
"and resource_table.CUSTOMER_STORAGE_ID =3D V_ENTITY_PERMISSION.CUS=
TOMER_STORAGE_ID " +
"and V_ENTITY_PERMISSION.MEMBER_TYPE in (%s)";
Is this a potential CheckStyle bug, or is there a way to configure CheckSty=
le to avoid falsely reporting a violation for AvoidInlineConditional?
Mark C. Determan
--_000_9BB759DFA3BCFF4E8A4C5F9588AE83710943EC02C111WHRPMBX28ER_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
<meta name=3D"Generator" content=3D"Microsoft Word 12 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"EN-US" link=3D"blue" vlink=3D"purple">
<div class=3D"WordSection1">
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D">A reply from the Listserv=
er asked for a complete sample Java file, and a configuration file demonstr=
ating the problem.<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D"><o:p> </o:p></span><=
/p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D">The request for the confi=
guration file … revealed the cause of the problem. In the confi=
guration file, there is an entry for RegexpMultiline. The “form=
at”
is not adequate, and thus falsely reported an error. I made a bad as=
sumption, that this configuration was a built-in check (and a built-in form=
at) provided and initialized by the out-of-the-box Checkstyle configuration=
.<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D"><o:p> </o:p></span><=
/p>
<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-si=
ze:10.0pt;font-family:Consolas;color:black">
</span><span style=3D"font-size:10.0pt;font-family:Consolas;color:teal"><=
;</span><span style=3D"font-size:10.0pt;font-family:Consolas;color:#3F7F7F"=
>module</span><span style=3D"font-size:10.0pt;font-family:Consolas">
<span style=3D"color:#7F007F">name</span><span style=3D"color:black">=3D</s=
pan><i><span style=3D"color:#2A00FF">"RegexpMultiline"</span></i>=
<span style=3D"color:teal">></span><o:p></o:p></span></p>
<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-si=
ze:10.0pt;font-family:Consolas;color:black"> &=
nbsp;
</span><span style=3D"font-size:10.0pt;font-family:Consolas;color:teal"><=
;</span><span style=3D"font-size:10.0pt;font-family:Consolas;color:#3F7F7F"=
>property</span><span style=3D"font-size:10.0pt;font-family:Consolas">
<span style=3D"color:#7F007F">name</span><span style=3D"color:black">=3D</s=
pan><i><span style=3D"color:#2A00FF">"format"</span></i>
<span style=3D"color:#7F007F">value</span><span style=3D"color:black">=3D</=
span><i><span style=3D"color:#2A00FF">"\? [^;,]* \?"</span></i><s=
pan style=3D"color:teal">/></span><o:p></o:p></span></p>
<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-si=
ze:10.0pt;font-family:Consolas;color:black"> &=
nbsp;
</span><span style=3D"font-size:10.0pt;font-family:Consolas;color:teal"><=
;</span><span style=3D"font-size:10.0pt;font-family:Consolas;color:#3F7F7F"=
>property</span><span style=3D"font-size:10.0pt;font-family:Consolas">
<span style=3D"color:#7F007F">name</span><span style=3D"color:black">=3D</s=
pan><i><span style=3D"color:#2A00FF">"message"</span></i>
<span style=3D"color:#7F007F">value</span><span style=3D"color:black">=3D</=
span><i><span style=3D"color:#2A00FF">"Nested inline conditionals are =
not permitted"</span></i><span style=3D"color:teal">/></span><o:p><=
/o:p></span></p>
<p class=3D"MsoNormal" style=3D"text-autospace:none"><span style=3D"font-si=
ze:10.0pt;font-family:Consolas;color:black">
</span><span style=3D"font-size:10.0pt;font-family:Consolas;color:teal"><=
;/</span><span style=3D"font-size:10.0pt;font-family:Consolas;color:#3F7F7F=
">module</span><span style=3D"font-size:10.0pt;font-family:Consolas;color:t=
eal">></span><span style=3D"font-size:10.0pt;font-family:Consolas"><o:p>=
</o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D"><o:p> </o:p></span><=
/p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D">In short, this is a probl=
em with our team’s configuration file, and it is not an issue/bug wit=
hin the CheckStyle plugin.<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D"><o:p> </o:p></span><=
/p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D">// Mark Determan<o:p></o:=
p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D"><o:p> </o:p></span><=
/p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D">>>>>>>&=
gt;>>>>>>>>>>>>>>>>>>=
>><o:p> </o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca=
libri","sans-serif";color:#1F497D"><o:p> </o:p></span><=
/p>
<div style=3D"border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in =
0in 0in">
<p class=3D"MsoNormal"><b><span style=3D"font-size:10.0pt;font-family:"=
;Tahoma","sans-serif"">From:</span></b><span style=3D"font-s=
ize:10.0pt;font-family:"Tahoma","sans-serif""> Oliver B=
urn [mailto:[email protected]]
<br>
<b>Sent:</b> Friday, August 16, 2013 5:32 PM<br>
<b>To:</b> [email protected]<br>
<b>Subject:</b> Re: [Checkstyle-user] False report of AvoidInlineConditiona=
ls?<o:p></o:p></span></p>
</div>
<p class=3D"MsoNormal"><o:p> </o:p></p>
<p>Can you provide a complete sample Java file and configuration file demon=
strating the problem. That would be a great help
<o:p></o:p></p>
<div>
<p class=3D"MsoNormal">On 17 Aug 2013 01:06, <<a href=3D"mailto:mark.c.d=
[email protected]">[email protected]</a>> wrot=
e:<o:p></o:p></p>
<div>
<div>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto">I am seeing a false violation for AvoidInlineConditional, when usi=
ng Checkstyle 5.6.<o:p></o:p></p>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto"> <o:p></o:p></p>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto">The java code that triggers the Checkstyle violation is:<o:p></o:p=
></p>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto"> <o:p></o:p></p>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;text-autospace:none">
<span style=3D"font-size:10.0pt;font-family:Consolas"> <s=
pan style=3D"color:#3F7F5F">
//This is a SQL statement and not an <u>inline</u> conditional</span></span=
><o:p></o:p></p>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;text-autospace:none">
<span style=3D"font-size:10.0pt;font-family:Consolas"> <b=
><span style=3D"color:#7F0055">private</span></b>
<b><span style=3D"color:#7F0055">static</span></b> <b><span style=3D"color:=
#7F0055">final</span></b> String
<span style=3D"color:#6000A0">NON_ADMIN_USER_QUERY</span> =3D</span><o:p></=
o:p></p>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;text-autospace:none">
<span style=3D"font-size:10.0pt;font-family:Consolas"> &nb=
sp; <span style=3D"color:#2A00FF">
"INSERT INTO TEMP_PERMISSIONS (RESOURCE_ID) SELECT distinct "</sp=
an> +</span><o:p></o:p></p>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;text-autospace:none">
<span style=3D"font-size:10.0pt;font-family:Consolas"> &nb=
sp; <span style=3D"color:#2A00FF">
"V_ENTITY_PERMISSION.ENTITY_ID FROM V_ENTITY_PERMISSION, %s resource_t=
able "</span> +</span><o:p></o:p></p>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;text-autospace:none">
<span style=3D"font-size:10.0pt;font-family:Consolas"> &nb=
sp; <span style=3D"color:#2A00FF">
"where V_ENTITY_PERMISSION.ENTITY_ID =3D resource_table.%s "</spa=
n> +</span><o:p></o:p></p>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;text-autospace:none">
<span style=3D"font-size:10.0pt;font-family:Consolas;background:red"> =
<span style=3D"color:#2A00FF">
"and V_ENTITY_PERMISSION.MEMBER_GUID in (%s) and V_ENTITY_PERMISSION.E=
NTITY_TYPE =3D ? "</span> +</span><o:p></o:p></p>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;text-autospace:none">
<span style=3D"font-size:10.0pt;font-family:Consolas"> &nb=
sp; <span style=3D"color:#2A00FF">
"and V_ENTITY_PERMISSION.ROLE <=3D ? and resource_table.CUSTOMER_ST=
ORAGE_ID =3D ? "</span> +</span><o:p></o:p></p>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;text-autospace:none">
<span style=3D"font-size:10.0pt;font-family:Consolas"> &nb=
sp; <span style=3D"color:#2A00FF">
"and resource_table.CUSTOMER_STORAGE_ID =3D V_ENTITY_PERMISSION.CUSTOM=
ER_STORAGE_ID "</span> +</span><o:p></o:p></p>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;text-autospace:none">
<span style=3D"font-size:10.0pt;font-family:Consolas"> &nb=
sp; <span style=3D"color:#2A00FF">
"and V_ENTITY_PERMISSION.MEMBER_TYPE in (%s)"</span>;</span><o:p>=
</o:p></p>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;text-autospace:none">
<span style=3D"font-size:10.0pt;font-family:Consolas"> </span><o:p></o=
:p></p>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto">Is this a potential CheckStyle bug, or is there a way to configure=
CheckStyle to avoid falsely reporting a violation for AvoidInlineCondition=
al?<o:p></o:p></p>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto"> <o:p></o:p></p>
<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto">Mark C. Determan<span style=3D"color:#1F497D"><o:p></o:p></span></=
p>
</div>
</div>
</div>
</div>
</body>
</html>
--_000_9BB759DFA3BCFF4E8A4C5F9588AE83710943EC02C111WHRPMBX28ER_--
--===============7887410008592058346==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
--===============7887410008592058346==
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
--===============7887410008592058346==--