Quality Rules Based on Metrics
Besides its ability to maintain a logical architecture and to identify cyclic dependencies SonarJ also is able to calculate a bunch of useful metrics:
- ACD (average component dependency - says a lot about internal coupling)
- LOC (lines of code - where is the beef?)
- Cyclomatic complexity (where is the complexity?)
- Assertion usage
- Relational cohesion
- Metrics of Robert C. Martin ( abstractness, instability etc.
- Many others...
You can define thresholds for all metrics. E.g. you could define an upper bound for cyclomatic complexity of 15. Every developer that tries to create a method with a higher complexity will receive a warning. Then he can try to split the method into several less complex parts.
SonarJ aggregates all the metrics to the higher level. Therefore you can easily find out the cyclomatic complexity of a layer or the lines of code comprising a vertical slice.