Home > TIP > How to make Checkstyle ignore some class?

How to make Checkstyle ignore some class?

Other Easy TIP to ignore some given class from
Checkstyle. This could be useful when you are dealing with third-party codes.

You should have a suppressions.xml configured in your checks.xml, something like this:

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

Inside your suppressions.xml you will have:

<suppress checks="." files="YourClass.java" />

The main point of this post is:
Inside your suppress tag you find the checks, and for this tag you can use regEx, in the example above I’m filtering all checkers for YourClass.java.

Thats it.
Cheers

Categories: TIP

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: