At the core of Sanity4J is a rule base consisting of Java don'ts!
These rules are fundamentally sourced from widely used Open Source projects such as SpotBugs, PMD and Checkstyle.
Senior developers categorised and standardised these rule bases so that they could be aggregated and analysed as a group. Each rule was also assigned a severity rating.
Sanity4J allows organisations to modify severity ratings for individual rules. For example, some organisations may place increased significance on rules leading to increased memory or CPU utilisation.
Organisations are also able to write custom rules specific to their environment and experience. For example, an organisation may be aware of anti-patterns relating to how services are used. Sanity4J can warn developers if these rules are broken.
The number and severity of rule breaches are aggregated using a metric, which is compared against the size of the code base (measured in lines of code). This metric is expressed as a quality percentage (%).
Sanity4J tracks quality (%) over time in a graphical format so improvements and regressions are visible to management and developers.
Developers can drill down into specific quality issues, access information describing the basis of the issue and potential remediation options. This has proved valuable in increasing the skills of developers.
Another factor in reducing project technical debt is the delivery of a suite of automated Java Unit tests (jUnit). Maintenance developers rely on these tests to ensure that they don't break existing code when they make changes.
Sanity4J integrates results from the open source Code Coverage tool JaCoCo. Code Coverage is the proportion of code executed during a jUnit test run. The coverage tools watch while jUnit tests run, and record which lines of code get executed. They then calculates the percentage of lines covered.
A high Code Coverage % is another important indicator of quality. Sanity4J combines Code Coverage % and Quality % into a single graph which can be used to measure the performance of development teams on how they deliver quality code over time.