During the search about tools for automated detection of source code error, I’ve stumbled on a very interesting project, Checkstyle, that commits itself to check the adherence of source code to a given formal rule set, having 3 defaults already adopted by some workgroup (these default sets are named “google”, “sun”, and “sun modified for Eclipse”). Not exactly what I was looking for, because I was searching something similar to FindBugs, but I am happy nonetheless.
Checkstyle is a standalone project, but plugins for various IDE have been created by third-parties: I have tried Eclipse-CheckStyle.

Source code style standardization shouldn’t be underrated: even without being part of a large team, it is easy to understand that it improves many aspects.
Code readability: if my source code is easier to be read, it is also easier to be understood by other team members.
Software mantainability: reviewing other people’s code and modifying your own are activities with intrinsic hurdles (for example: where is the bug? what this (undocumented) code does? and so on), so it is better to avoid adding more (for instance: why did the author write some variables like constants?).
Efficiency: a developer, used to write with the right style, will be more ready to understand the good examples that can be found on the net.

Checkstyle’s defaults are not absolute truth, but can be used to create new rule set for your developer team. The rule editor is quite complex and not really user friendly, but in few steps I was able to increase the row’s max length and allow the tab character to be user for indentation.
Eclipse-Checkstyle doesn’t check your code in real time (i.e. while you are typing), but only on demand or on project’s rebuild, highlighting the not compliant rows with a yellow background that is impossible to ignore.

All in all, Checkstyle improves the efficiency of source code writing and reviewing tasks… and its appearance (but this is a personal opinion!)

Annunci