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

Vojtech Szocs vszocs at redhat.com
Mon Oct 6 14:25:43 UTC 2014


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



More information about the Devel mailing list