I setup a new CI build with SonarQube analysis this week and noticed right off there were far more lines of code for the project than I was expecting.
There are many options on this page. In my case I needed to exclude source files. SonarQube uses a nice wildcard syntax to make exclusion easier:
We used the following exclusions to ignore the third party source files:
With this change our Lines of Code looked much better:
The unexpected but happy byproduct of this change was our build analysis times went from 16 minutes to 6 minutes with this single change. So now the cost of analysis is effectively free on our CI build where before it caused a 10 minute penalty.
If this post was helpful, you have questions or you want to share your results/experience please leave a comment below. Thanks!