VirtualMock strives to have a clean and high-quality codebase. Several tools are used to achieve this goal. PMD and Checkstyle are used to ensure good style. Clover and Hansel are used to ensure full unit test coverage.
It is always pleasantly surprising when a "secondary goal" such as good style or complete unit test coverage uncovers a bug, or leads you to a better design that you would not have thought of otherwise. This has happened several times on VirtualMock :)
Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. Virtualmock uses a Checkstyle config that is based on the default Sun checks config. Changes that have been made are detailed below. You can see the Checkstyle report for VirtualMock. See Checkstyle Project Page on SourceForge for more info on Checkstyle.
JavadocMethod - This check has the "allowUndeclaredRTE" property set to "true". I prefer to not declare RuntimeExceptions.
JavadocVariable - This check has the "scope" property set to "package", because Javadoc is not provided for all private fields.
LineLength - Changed to 90. Jalopy sometimes lets a line run a bit over 80 chars.
HiddenField - This check has the "ignoreConstructorParameter" and "ignoreSetter" properties set to true, to allow "this.field = this" to be used in setter accessors.
MagicNumber - This check has "3" added to the list on the "ignoreNumbers" property. "3" is used in some hardcoded array indices in VirtualMock.
DesignForExtension - This check was disabled. VirtualMock is designed for flexibility, and as the description of this rule on the Checkstyle site states, this approach limits flexibility of subclasses.
GenericIllegalRegexp - The default check warns if there are any trailing spaces before a newline, using pattern "\s$". This was changed to warn if there is more than one trailing space, using pattern "\s{2}$". This was done because Jalopy automatically puts a trailing space after asterisks on empty javadoc lines.
FinalParameters - This check was disabled. IMHO, putting final before every parameter would add sacrifice more in readability than it would gain in stability. Plus, I think other tools (such as PMD) can catch if you modify a parameter.
PMD scans Java source code and looks for potential problems. This section details the changes that have been made to the default PMD rule sets. You can see the PMD report for VirtualMock. See PMD Project Page on SourceForge for more info on PMD.
OnlyOneReturn - This rule (which I used to follow) was disabled. VirtualMock is written in Java, not COBOL (no offense, I've written plenty of COBOL :) ). Arguments against this approach are mentioned in Martin Fowler's Refactoring book, I believe in the discussion of Guard Clauses.
AtLeastOneConstructor - This rule was disabled. What's wrong with using the default constructor?