[ovirt-devel] Why are Java checkstyle checks applied to test code?

Yevgeny Zaspitsky yzaspits at redhat.com
Tue Oct 7 12:16:52 UTC 2014


I do not see a difference between "src" and "test" from checkstyle point of view. 
You've encountered a checkstyle problem that might be solved in a less drastic way than shutting it down. If that wouldn't a test code you wouldn't come up with that solution, right? Have you tried to suppress checkstyle in a more local way? 
How about using SuppressionCommentFilter [1] and/or @SuppressWarnings("checkstyle:XXX") locally? That [2] is what I found by my short googling...

BTW, as soon as you raised checkstyle topic we might review its configuration. E.g. I'm in favor of removing any validation ovirt standard formatter does not fix for us automatically or alternatively configure the formatter to be such.

[1] - http://checkstyle.sourceforge.net/config.html#SuppressionCommentFilter
[2] - http://stackoverflow.com/questions/4023185/how-to-disable-a-particular-checkstyle-rule-for-a-particular-line-of-code

Best regards, 
____________________ 
Yevgeny Zaspitsky 



----- Original Message ----- 

> From: "Vojtech Szocs" <vszocs at redhat.com>
> To: devel at ovirt.org
> Sent: Monday, October 6, 2014 5:25:43 PM
> Subject: [ovirt-devel] Why are Java checkstyle checks applied to test code?

> Hi guys,

> Alex wrote a patch with code in src/test/java containing something like:

> private static final String PLACE_HOLDER_STRING = "\\{(\\d+)\\}";

> Checkstyle's parser choked on { and } symbols within the String constant
> and the whole build failed on Checkstyle "can't parse Java file" error.
> This is obviously an issue with Checkstyle, not with our Java code.

> In Engine root POM, we have maven-checkstyle-plugin:check applied to both
> main *and* test code. So what's the reason/benefit of checking test code
> with Checkstyle? What to do in cases when Checkstyle parser fails but the
> given Java class is syntactically OK?

> Long story short - why this:

> <includeTestSourceDirectory>true</includeTestSourceDirectory>

> instead of this?

> <includeTestSourceDirectory>false</includeTestSourceDirectory>

> or just removing that config option, since default is false anyway?

> Reference:
> http://gerrit.ovirt.org/#/c/32995/2/frontend/webadmin/modules/pom.xml

> Regards,
> Vojtech
> _______________________________________________
> Devel mailing list
> Devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/devel



More information about the Devel mailing list