I want to ignore a specific folder (named generated-sources) from my checkstyle reports, because they are generated.
I'm using eclipse-cs for displaying my violations.
i added a suppressionfilter to my xml:
<module name="SuppressionFilter"> <property name="file" value=".\suppressions.xml"/> </module>
my suppressions.xml looks like this:
<?xml version="1.0"?> <!DOCTYPE suppressions PUBLIC "-//Puppy Crawl//DTD Suppressions 1.1//EN" "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd"> <suppressions> <suppress files="\*generated-sources\*\*\.\*" checks="[a-zA-Z0-9]*"/> </suppressions>
but it is not working. any ideas?
Exclude packages/classes with a configuration file json configuration file, or you can put them into a separate checkstyle-exclude. json file (use -c and -e command line options to change default filenames). Checkstyle will skip files that match an entry under the "all" key.
Checkstyle allows the definition of a list of files and their line ranges that should be suppressed from reporting any violations (known as a suppressions filter ).
A suppressions XML document contains a set of suppress elements, where each suppress element can have the following attributes: files - a Pattern matched against the file name associated with an audit event. It is optional. checks - a Pattern matched against the name of the check associated with an audit event.
<suppress files="[\\/]generated-sources[\\/]" checks="[a-zA-Z0-9]*"/>
this works :)
Additionally to the answer from Philipp, I had to use an absolute pathname ( :-( ) for the suppression file:
<module name="SuppressionFilter"> <property name="file" value="/Users/xxx/workspace/suppressions.xml"/> </module>
Looks like the Checkstyle plugin is not using the project home directory.
(at least under eclipse luna / Mac OS X)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With