I’ve been using the above (and a few others like CodeNarc) code quality plugins for quite a bit and I thought I’d give my 2 cents here on a matter of style: the way you can suppress checks in each of these tools.
I do like the way Checkstyle allows you to define what to include and also what to suppress — even more so I like the usage of regex’s when it comes to specifying classes/paths. Findbugs has a similar setup where you define the exclusions via a configuration file.
Then there’s PMD where one can simply use the
@SuppressWarnings annotation. Which I’m a personal fan of!
It somehow makes more sense to me to annotate a method or a class with a specific warning I want excluded because when you read the source code it tells you upfront that the coding is intended (for some reason which I expect to be explained somewhere in the comments or the code itself) to be written that way. With the other tools I have to run a whole build to find out the warnings — which might be counter-intuitive, as well as a waste of time. I know Findbugs introduced its own annotations, but that requires extra dependencies and imports — where with PMD one has to use only the standard JDK annotation for
@SuppressWarnings. I would love to see this as a standard across all these tools. Just a personal preference, of course!