Sonar Code Complexity metrics
Sonar hosts a wide selection of complexity-related rules to help us monitor our software projects. Next, we are going to add 17 rules of major severity to the custom packt profile.
| 
 Complexity rules profile distribution  | ||
|---|---|---|
| 
 Severity  | 
 Rules count  | 
 Value  | 
| 
 Major  | 
 17  | 
 17 x 3 = 51  | 
| 
 Total value  | 
 51  | |
Log in to Sonar as administrator and add the following rules to the custom packt profile:
| 
 Complexity rules  | ||
|---|---|---|
| 
 Severity  | 
 Name  | 
 Analyzer  | 
| 
 Major  | 
 Boolean Expression Complexity  | 
 Checkstyle  | 
| 
 Major  | 
 Class Data Abstraction coupling  | 
 Checkstyle  | 
| 
 Major  | 
 Class Fan Out Complexity  | 
 Checkstyle  | 
| 
 Major  | 
 Cyclomatic Complexity  | 
 Checkstyle  | 
| 
 Major  | 
 JavaNCSS  | 
 Checkstyle  | 
| 
 Major  | 
 Nested For Depth  | 
 Checkstyle  | 
| 
 Major  | 
 Nested If Depth  | 
 Checkstyle  | 
| 
 Major  | 
 Nested Try Depth  | 
 Checkstyle  | 
| 
 Major  | 
 Simplify Boolean Expression  | 
 Checkstyle  | 
| 
 Major  | 
 Simplify Boolean Return  | 
 Checkstyle  | 
| 
 Major  | 
 Too many fields  | 
 PMD  | 
| 
 Major  | 
 Too many methods  | 
 PMD  | 
| 
 Major  | 
 Avoid too complex class  | 
 Sonar  | 
| 
 Major  | 
 Avoid too complex method...  | |