Hi Jared,

Le 19/03/2013 17:14, Becksfort, Jared a écrit :
> Hello,
> 
> I am using the Apache Common XML file to format my code submissions
> in Eclipse.  Gilles says my last submission has some CheckStyle
> warnings, so I installed the CheckStyle plugin.  It gives tons of
> warnings, including some that go against the posted style guidelines,
> such as "All public methods must advertise all exceptions they
> generate...".  It also complains about lines being too wide, but the
> XML file configuration does not wrap certain types of lines.  There
> are lots of others, including spaces following the asterisks in the
> javadocs, which surely the autoformatter could handle.

The problem you encounter is known. Basically, it is due to the eclipse
checkstyle plugin configuration ignoring the checkstyle.xml file. When
you ask eclipse to run checkstyle, it uses a completely different
default configuration, and of course will raise thousands of warnings.

We have set up the appropriate setting for the maven checkstyle plugin
(see the pom.xml which specifies that ${basedir}/checkstyle.xml and
${basedir}/license-header.txt should be used).

Configuring the eclipse checkstyle plugin is completely different. I
tried to make it use the same files, but failed up to now. I will
perhaps give it another try later on.

Up to now, I use the Apache Common XML to have eclipse formatter be as
close as possible to our checkstyle configuration, but I don't use the
eclipse checkstyle plugin to do the checks. I use the maven checkstyle
plugin, which is run automatically when I run:

  mvn -Dmaven.skip.test=true site

Note that I skip the tests for this checks because the maven cobertura
plugins takes several hours on my computer to pass the Bobyqa tests.

> 
> I admit that I am using CheckStyle for the first time, so maybe it is
> a simpler process to fix that it first appears.  But it seems like an
> annoying barrier to entry for contributors who submit working code to
> have to figure out which lines to reformat spaces, wrapping,
> exceptions etc.  Is there not an automatic way that the committers of
> the project can auto format the code without CheckStyle warnings?  If
> not, I wonder why formatting with the supplied XML file does not
> drastically reduce the number of CheckStyle warnings.

This XML file should really reduce the number of warnings, but there are
many things the eclipse formatter does not do by itself, so this file
will not reduce the number of warnings down to zero. There is also one
incompatibility with this formatter file and checkstyle, on the
indentation of throw declaration in methods. In fact, for this specific
setting, there is currently no way to have a common setting in eclipse
and in checkstyle. As checkstyle is our reference (some developers don't
use eclipse), when a method declaration is indented automatically by
eclipse with our formatter settings, this will create a checkstyle warning.

If I find a way to have eclipse and checkstyle using the same
configuration file and be happy at the same time, I'll describe this. If
someone already knows a way to do that, I'll be happy to know.

best regards,

Luc

> 
> Thanks, Jared
> 
> Email Disclaimer:  www.stjude.org/emaildisclaimer Consultation
> Disclaimer:  www.stjude.org/consultationdisclaimer
> 
> 
> ---------------------------------------------------------------------
>
> 
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to