In the past days I tinkered with Checkstyle, and addressed a couple of
issues that have been bugging me for a long time.
First of all, I've upgraded the repository from Checkstyle version 3.5
to 4.1. This was painless.
Next, I enabled a few more checks. Some have been part of the coding
guidelines, but not been detected by Checkstyle yet. Most important,
attempting to assign a new value to a parameter or using more than one
return statement is now detected. Interesting new checks are those for
cyclomatic and NPath complexity. They mercilessly point out messy code
And finally, the metrics report now includes a section on Checkstyle,
showing how the number of issues changed over time. See
As you can see from the figure on "Number of issues" in the metrics
report, a lot has been resolved in the past days. Partially because the
code was cleaned up, but also because there are now suppressions for
certain messages. In particular, magic numbers in test cases are not
objected anymore, which was a major culprit in the increase of issues
in late 2005 (which was when I told Checkstyle to include source code
for test cases).
Interesting links to the repository:
- Checkstyle configuration:
- Checkstyle suppressions: