Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checkstyle multiple files SuppressionFilter

I want to have multiple suppression files for Checkstyle. Which means, that I'll have 2 separate files with separate suppression rules:

The way to add 1 file is this is to add this in the rules:

<module name="SuppressionFilter">
    <property name="file" value="docs/suppressions.xml"/>
</module>

What I want to achieve is: (This isn't legal syntax)

<module name="SuppressionFilter">
    <property name="file" value="docs/suppressions-1.xml"/>
    <property name="file" value="docs/suppressions-2.xml"/>
</module>

I tried using 2 separate SuppressionFilters, but this seems to overwrite the first with the second.

What I mean is:

<module name="SuppressionFilter">
    <property name="file" value="docs/suppressions-1.xml"/>
</module>

<module name="SuppressionFilter">
    <property name="file" value="docs/suppressions-2.xml"/>
</module>

If done as above, it will only use suppressions-2.xml

Is there a way to do this?

like image 219
abeer Avatar asked Nov 09 '22 16:11

abeer


1 Answers

Your option 2 is good, just add the module twice:

<module name="SuppressionFilter">
    <property name="file" value="docs/suppressions-1.xml"/>
</module>
<module name="SuppressionFilter">
    <property name="file" value="docs/suppressions-2.xml"/>
</module>

Both suppressions will be active, so anything that is suppressed in either file will be suppressed.

If your suppressions-1.xml is not working, it would be a problem in that file.

like image 194
barfuin Avatar answered Dec 01 '22 07:12

barfuin