I’ll talk about just two pieces of data that can help in decision making in this two part blog. I had to obtain different data for a Quality 6 Pager I’m working on, a narrative on our current state of quality, and our target state in the organization. This concept came from Amazon and you can easily find more information on it.

The first is technical debt of a large code base (aka monolith). Many of the Sonar reports we have are based on individual component and it makes sense as such reports take time to generate. However, a Sonar report on the entire monolith has not been done and I had to go through some hoops to get the data.

Finding technical debt for a large code base

To install and run Sonar on your local is straightforward. Download from SonarQube, and run the command and then go to http://localhost:9000.

nohup ${path}/sonarqube-5.4/bin/macosx-universal-64/sonar.sh console&

The first error I got was from Sonar’s attempt to contact my SCM host

SCM provider was set to "svn" but no SCM provider found for this key. No SCM provider installed.

You have to login to Sonar’s admin and disable this feature (“General Settings > SCM”) or setting property sonar.scm.disabled=true. See more from Sonar Support on this issue.

The second step is to setup up your project to run with Sonar Scanner. You have to create a “sonar-project.properties” file in the project root that you want to scan. You can see that you can add inclusons & exclusions.

sonar.projectKey=yourProject:yourProjectComponenet
sonar.projectName=yourProject
sonar.inclusions=**/*.java
sonar.exclusions=**/target/**,**/*.js

The final step is to run “sonar-runner”. For me, I like minimal typing so I added the following in my .bashrc

In .bashrc:
export SONAR_RUNNER_HOME=$HOME/Downloads/sonar-scanner-2.5
export PATH=$PATH:$SONAR_RUNNER_HOME/bin

In project root, run:
sonar-runner

As expected, this failed after some time with out of memory error.

Caused by: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space

After some research, I added this into sonar-project.properties, and managed to obtain the data I was looking for - technical debt (number of days to fix) & number of critical issues, see sample here from Sonar.

export SONAR_RUNNER_OPTS="-Xmx1G -Xms1024m -XX:MaxPermSize=1024m -XX:-UseGCOverheadLimit"

More on Sonar?

Some good resources to read more on 1. Sonar Scanner 2. Sonar filters 3. Sonar technical debt calculation

Next

In the second part of this blog, I’ll be looking for data to better understand engineers behavior.