Checkstyle equivalent to PMD
As one of the developers of Checkstyle, I am always interesting in articles about Checkstyle and similar tools like PMD. So I read the recent article Improving Project Quality with PMD with some interest. The comment about Checkstyle not being geared towards "identifying latent defects" was disheartening as this has been a major thrust for well over a year.
So for a bit of fun I thought I would rewrite the example given in the article showing how to find classes that are not declared in a package. The resulting Check for Checkstyle is:
This check will only report of files that do not have a declared package. I suspect the example shown by Tom Wheeler in the article will fire for every class declared in a file. It also will not fire for interfaces. I would be interested to hear from people more skilled in PMD than me if I am wrong.