1

is there a manner, using sonar runner, to see only the delta of the issues? For delta I mean only the issues introduced by recent changes? If yes how? Thanks and best regards

user2572526
  • 1,219
  • 2
  • 17
  • 35

2 Answers2

1

You have to change the Leak Period of your project.

Default value is previous_version, which means you get the delta between last analysis and last version (defined in sonar-project.properties for example).

Based on your example, you want the delta between each analysis, so you need to set up the parameter to previous_analysis.

Solution 1 : Setting using web interface

The easiest way to change the parameter is to use the sonar web interface as described in the documentation : change the Leak Period

Solution 2 : Setting using configuration file

If you can't or don't want to use web interface to set this parameter, use the configuration file sonar-project.properties.

  1. Create or edit sonar-project.properties into the root folder of your project
  2. Add the following line : sonar.timemachine.period1=previous_analysis

Solution 3 : Set as a parameter of command line

The last solution is to add an argument of the command line to take into account the parameter. You have to add the argument -Dsonar.timemachine.period1=previous_analysis to your command line.

SonnarQube scanner options are defined in the manual page

Flows
  • 3,675
  • 3
  • 28
  • 52
  • Hi Flows, how can I set this parameter? I'm using sonar runner on my local machine not on the sonar server so I've not a web interface. Where should I put this sonar.proerties file? And exactly what is the parameter key? Tnx! – user2572526 Jun 10 '16 at 05:47
  • The file `sonar-project.properties` (I edited my message) has to be on the root directory of your project. In the file, add the following line : `sonar.timemachine.period1=previous_analysis` – Flows Jun 10 '16 at 06:23
  • Hi again Flows, do you know if there is also a manner to pass this "sonar.timemachine.period1" parameter as a command line parameter without create a sonar-project.properties file? – user2572526 Jun 20 '16 at 12:42
  • You have to use -D option to set this parameter. I updated my answer. In your case, use `-Dsonar.timemachine.period1=previous_analysis`. – Flows Jun 20 '16 at 13:56
1

Or if you are using Visual Studio Team Services and git you have the option on getting new issues in a Pull request using this new feature they are rolling out. https://blogs.msdn.microsoft.com/visualstudioalm/2016/06/02/sonarqube-code-analysis-issues-integration-into-pull-requests/

  • Hi Ove, thanks for the answer but actually I'm not using Visual Studio, I'm using NetBeans with the radar plugin. – user2572526 Jun 10 '16 at 05:48