Running SonarCube on your laptop using Docker

I recently wanted to do some source code analysis and found it difficult to find a good eclipse plugin. Luckily, it’s now very easy to get your own SonarCube server running. Basically you only need a docker installation and a few simple steps.

To start a SonarQube instance you run the following command:

Starting the SonarQube server will take several minutes. After it has started, you can generate a sonar report of your maven application with the followng command:

If all goes well, you’ve just created your first report and can access it on localhost on port 9000! Because the local SonarQube server stores every analysis in an internal H2 database you can even see what has changed since the last run. Have fun!

sonarcube-issues

It seems that this project needs some attention…

Please note that this setup is not recommended for production. If you want to know more, checkout the SonarQube docker page.

Integrating Karma 0.8 tests in Maven with Sonar(Cube) test coverage

NOTE: this blog post was written for version 0.8 of the Karma test runner.
An updated blog post for the new Karma 0.10 can be found here.

For my current project we are using Maven to build our AngularJS application.
Furthermore we use Sonar (recently renamed to SonarCube) to monitor our code standards / best practices and unit test coverage.

In this blog post we describe how to integrate the Karma (Testacular) test runner with Maven and how to add your AngularJS (or any JavaScript) application to SonarQube.
Continue reading