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:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;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:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span><=
/p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D">The request for the confi=
guration file &#8230; revealed the cause of the problem.&nbsp; In the confi=
guration file, there is an entry for RegexpMultiline.&nbsp; The &#8220;form=
at&#8221;
 is not adequate, and thus falsely reported an error.&nbsp; 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:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</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;&nbsp;&nbsp;
</span><span style=3D"font-size:10.0pt;font-family:Consolas;color:teal">&lt=
;</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">&quot;RegexpMultiline&quot;</span></i>=
<span style=3D"color:teal">&gt;</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;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;
</span><span style=3D"font-size:10.0pt;font-family:Consolas;color:teal">&lt=
;</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">&quot;format&quot;</span></i>
<span style=3D"color:#7F007F">value</span><span style=3D"color:black">=3D</=
span><i><span style=3D"color:#2A00FF">&quot;\? [^;,]* \?&quot;</span></i><s=
pan style=3D"color:teal">/&gt;</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;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;
</span><span style=3D"font-size:10.0pt;font-family:Consolas;color:teal">&lt=
;</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">&quot;message&quot;</span></i>
<span style=3D"color:#7F007F">value</span><span style=3D"color:black">=3D</=
span><i><span style=3D"color:#2A00FF">&quot;Nested inline conditionals are =
not permitted&quot;</span></i><span style=3D"color:teal">/&gt;</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;&nbsp;&nbsp;
</span><span style=3D"font-size:10.0pt;font-family:Consolas;color:teal">&lt=
;/</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">&gt;</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:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span><=
/p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D">In short, this is a probl=
em with our team&#8217;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:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span><=
/p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D">// Mark Determan<o:p></o:=
p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span><=
/p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D">&gt;&gt;&gt;&gt;&gt;&gt;&=
gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;=
&gt;&gt;<o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</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:&quot=
;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style=3D"font-s=
ize:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> 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>&nbsp;</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, &lt;<a href=3D"mailto:mark.c.d=
[email protected]">[email protected]</a>&gt; 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">&nbsp;<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">&nbsp;<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">&nbsp;&nbsp;&nbsp; <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">&nbsp;&nbsp;&nbsp; <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">&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp; <span style=3D"color:#2A00FF">
&quot;INSERT INTO TEMP_PERMISSIONS (RESOURCE_ID) SELECT distinct &quot;</sp=
an> &#43;</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">&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp; <span style=3D"color:#2A00FF">
&quot;V_ENTITY_PERMISSION.ENTITY_ID FROM V_ENTITY_PERMISSION, %s resource_t=
able &quot;</span> &#43;</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">&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp; <span style=3D"color:#2A00FF">
&quot;where V_ENTITY_PERMISSION.ENTITY_ID =3D resource_table.%s &quot;</spa=
n> &#43;</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">&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=3D"color:#2A00FF">
&quot;and V_ENTITY_PERMISSION.MEMBER_GUID in (%s) and V_ENTITY_PERMISSION.E=
NTITY_TYPE =3D ? &quot;</span> &#43;</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">&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp; <span style=3D"color:#2A00FF">
&quot;and V_ENTITY_PERMISSION.ROLE &lt;=3D ? and resource_table.CUSTOMER_ST=
ORAGE_ID =3D ? &quot;</span> &#43;</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">&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp; <span style=3D"color:#2A00FF">
&quot;and resource_table.CUSTOMER_STORAGE_ID =3D V_ENTITY_PERMISSION.CUSTOM=
ER_STORAGE_ID &quot;</span> &#43;</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">&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp; <span style=3D"color:#2A00FF">
&quot;and V_ENTITY_PERMISSION.MEMBER_TYPE in (%s)&quot;</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">&nbsp;</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">&nbsp;<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==--