The short story
Checkstyle is a static analysis tool with an Eclipse Plugin (it also has a Maven plugin), that allows you to... check style. An excellent article describing how to install, configure for a project and run for reporting (things about style, duh) can be found here:The Long Story
... made short by Wikipedia: https://en.wikipedia.org/wiki/Checkstyle
Some modules are readily available, saving you lots of time configuring the tool:
Some modules are readily available, saving you lots of time configuring the tool:
"Checkstyle defines a set of available modules, each of which provides rules checking with a configurable level of strictness (mandatory, optional...). Each rule can raise notifications, warnings, and errors. For example, checkstyle can examine:
- Javadoc comments for classes, attributes and methods;
- Naming conventions of attributes and methods;
- Limit of the number of function parameters, line lengths;
- Presence of mandatory headers;
- The use of packets imports, of classes, of scope modifiers and of instructions blocks;
- The spaces between some characters;
- The good practices of class construction;
- Duplicated code sections;
- Multiple complexity measurements, among which expressions." (Source: Wikipedia)
Similar tools
If you're into .Net, think FxCop: