Checkstyle violations can be configured to ignore warnings using @SuppressWarnings
, e.g. @SuppressWarnings("checkstyle:CyclomaticComplexity")
by configuring a SuppressWarningsFilter
and a SuppressWarningsHolder
. This can be useful in specific situations where the developer feels that working around the warning is better than changing the code so that it is no longer applicable.
It would be helpful to know if a particular suppressed warning is no longer needed due to a refactoring or other code change, so that it can be removed, allowing the benefits of that Checkstyle check to be realized for future changes. Is there any way to be notified if a particular suppressed warning is not actually suppressing any warnings, either through a Checkstyle configuration or some other mechanism? Ideally, it would be useful to have the option of failing the build in the scenario.
There is currently no way to do this in checkstyle right now and would require modifying SuppressWarningsHolder
/SuppressWarningsFilter
or creating your own custom variant.
There is currently an open issue for this functionality in the Checkstyle project.