Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to force Checkstyle to ignore particular warning in the source code? [duplicate]

PMD has a way to ignore particular warning with //NOPMDcomment inside Java source file.

Does Checkstyle have similar option?

like image 366
Andrey Adamovich Avatar asked Nov 09 '09 22:11

Andrey Adamovich


People also ask

How do I stop checkstyle warning?

It is possible to suppress all the checkstyle warnings with the argument "all" . You can also use a checkstyle: prefix to prevent compiler from processing these annotations. You can also define aliases for check names that need to be suppressed.

How do I exclude files from checkstyle?

To skip all checks in all files under directories (packages) named "generated", you must use regex pattern <suppress checks="[a-zA-Z0-9]*" files="[\\/]generated[\\/]" /> It was really little hard for me to find out the right pattern for files parameter.


1 Answers

Yes, look at the SuppressionCommentFilter and SuppressWithNearbyCommentFilter options.

like image 151
Taylor Leese Avatar answered Sep 23 '22 17:09

Taylor Leese