Freddy
Freddy

Reputation: 876

Override one rule in maven checkstyle

I am currently using maven checkstyle with the google rules.

Whenever I run it I get the message [...] (coding) HiddenField: 'userId' hides a field. which I want to hide without creating my own rule xml file.

Is there a way to override a rule in checkstyle without replacing the whole xml file?

My code so far:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-checkstyle-plugin</artifactId>
    <version>2.17</version>
    <configuration>
        <configLocation>google_checks.xml</configLocation>
    </configuration>
</plugin>

Upvotes: 3

Views: 3347

Answers (1)

Sam
Sam

Reputation: 9944

Yes, you can suppress rules using an additional suppressions file. You can see an example at http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/suppressions-filter.html

Upvotes: 3

Related Questions