I want sonar analysis on newly checkin code

in my project we have nearly 100 bugs are there, but project team is asking they dont want to analyse previously existed code, they want sonar analysis on newly chekin code. how can i do that

  • i am using sonar project properties file with sonar scanner.

Hi,

There are a couple things to be said here.

First, the SonarQube interface and default Quality Gate are designed to help you focus on the New Code Period. You can’t keep analysis from picking up those old issues, but you can decide to only pay attention to issues raised on newly-changed code. That means you would essentially ignore the issues on the left side of the project homepage with a white background and focus instead on the New Code values over the yellow background on the right. We call this Fixing the Leak, or alternately Clean as You Code.

Second, if you have a commercial edition, then branch and PR analysis are available to you. With Short-Lived Branch (SLB) and PR analysis still covers all files, but all that’s reported in the UI is what’s changed in the PR / SLB.

Ideally, you’ll combine both of these things to make sure your new code stays clean.

 
HTH,
Ann

@ganncamp The link you provided showS page not found,
Can you provide solution on this.
I also have the same problem I also want to ignore previous issues in sonar and only want my sonar to scan new check in code changes and should display new issues only for that branch .
for example Master branch have 50 issues
I created branch from master.
Now when I add new code to child branch sonar should only scan for latest code.
Please help on this.

Hi,

That page was replaced with the Clean as You Code page. Sorry for the confusion.

You should know, though, that SonarQube is always going to analyze all of your code*.

 
HTH,
Ann

*You can enable incremental analysis under certain conditions for C/C++