On 03/19/2013 08:43 PM, Thomas Neidhart wrote:
> On 03/19/2013 08:18 PM, Luc Maisonobe wrote:
>> 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.
>
> Go to Project Properties | Checkstyle | Local Check Configurations
>
> Create a new Project Relative Configuration, select the checkstyle.xml
> file. Give it a meaningful name.
>
> Click on protect Checkstyle configuration file.
>
> For math this is not necessary, but normally you would need to resolve
> some properties, like location of header template file.
>
> When you are done, click on the Main tab, and select the newly created
> configuration, otherwise the default one is used which creates lots of
> warnings.
>
> Something that I usually add to the checkstyle.xml:
>
> <property name="severity" value="warning"/>
>
> As the warnings are otherwise reported as errors, which is annyoing.
to only check the src/main/java folder, do the following:
On the Main tab of Checkstyle configuration, disable simple
configuration checkbox, then edit the existing file set, and use a
pattern like this:
src/main/java/.*\.java
Thomas
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]