Is there a way to run sonar on projects without using the repository?

iCodeLikeImDrunk picture iCodeLikeImDrunk · Feb 7, 2012 · Viewed 39.8k times · Source

In a recent sonar test, we found over 30k total violations in our projects. I was told to spend some time to look over all of the blocker/critical violations and fix them accordingly. I was told by my mentor that to run sonar on the projects again, I would have to first commit the changes I made. And because I am an intern they don't want to do that. Is there any another method besides committing the changes and run sonar?

I am using Intellij and the projects are mavenized, if that helps with anything.

Answer

alex.p picture alex.p · Feb 7, 2012

Yep, set up a local Sonar server by following the instructions at http://docs.sonarqube.org/display/SONAR/Installing

Once you've done that you can view all your projects at localhost:9000 by doing mvn sonar:sonar. It's not necessary to install a build server, so long as your projects are maven-enabled you should be able to just do mvn sonar:sonar whilst a local sonar server is running.

You can also install the eclipse plugin (if you use eclipse) which will allow you to do realtime code analysis - so you can see when you've managed to solve a violation. Violations are highlighted directly in the code as well which helps considerably.

http://docs.sonarqube.org/display/SONAR/SonarQube+in+Eclipse