views:

27

answers:

2

Is there a way to define a configuration XML for Checkstyle in Eclipse that would be project specific, as in "you put a XML file in the project tree and Checkstyle recognizes it"?

As far as I've researched, I've seen how to change the configuration for Eclipse as a whole, and how to include a Supressions Filter, which (as far as I understand) is not what I'm looking for since it works only to supress particular instances of warnings in given files/lines, but I want to supress classes of errors (disabling the "blank space at and of line" - which seriously bothers me because Eclipse's editor/formatter keeps pushing me to do it the 'wrong way' -, for example).

+1  A: 

You can define any specific validation at Project properties (right click on the project node at project explorer). It includes checkstyle validations.

Tomas Narros
+1  A: 

Yes, it's possible.

It's a project-relative configuration: http://eclipse-cs.sourceforge.net/advanced_configtypes.html

Sample .checkstyle:

<?xml version="1.0" encoding="UTF-8"?>
<fileset-config file-format-version="1.2.0" simple-config="false">
    <local-check-config name="project-checkstyle-config" location="/myProject/checkstyle.xml" type="project" description="Project-specific Configuration">
        <additional-data name="protect-config-file" value="false"/>
    </local-check-config>        
</fileset-config>
gawi