The Java project I'm working on uses a combination of code analysis tools: PMD, Checkstyle and FindBugs. These pick up on plenty of bugs, style issues etc. but one often slips through the net:
public class AbstractBadlyNamedClass { // Not abstract!
// ...
}
Note the other way round is checked, i.e. public abstract BadlyNamedClass
gives PMD warning "Abstract classes should be named AbstractXXX".
Could anyone advise whether there is a way of checking for this, either with one of the mentioned tools (perhaps some kind of custom rule?) or another automated tool that would do the job?
PMD, FindBugs and Checkstyle, are the most popular open-source code analyzers, they are extensively used in Java development to improve the codebase and identify potential vulnerabilities along with design flaws; every tool has its feature, purpose and strength, targeting a specific type of coding rules.
By default, for Java projects, Sonar executes FindBugs, CheckStyle, and PMD, as well as a few other "plugins", such as Cobertura. The main advantage is that it stores the history in a database.
I think the checkstyle AbstractClassName check is what you are looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With