If you are using the command line version of Checkstyle, the easiest way would be to look at the XML output report. Use -f xml
to tell Checkstyle to output XML. Violation messages in XML look like this:
<error line="0" severity="error" message="Missing package-info.java file."
source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocPackageCheck"/>
So here, the check name for use by the suppression filter is JavadocPackage
.
For manual lookup, you have some further options:
- You could manually go to the list of available checks and search it for keywords from your violation message. (Thanks @crasp for pointing this out in the comments.)
- If you are using Eclipse, you can check the "Include rule names in violation messages" checkbox as described here to see the rule name in Eclipse.
- If you are using SonarQube, you can see the rule name by clicking on the issue.