SonarQube not comparing with BASELINE version

I am using SonarQube version 6.7 with SonarJava 5.6 and configured leakPeriod as version i.e. BASELINE.

  1. The BASELINE version has 3bugs and 5 code smells.
  2. During analysis at 8:50 and 8:54PM the code smells reduced to 3
  3. And at the last analysis the bugs and code smells are same as BASELINE version (i.e. 3bugs and 5 code smells):

Question:
My understanding is that each sonar run is compared against with the BASELINE version. So since the last analysis is same as the BASELINE, the quality gate should not fail.
But here it is failing and seems to compare with the previous_version. Am I missing something?

Thanks in advance for your help.

Hi,

Welcome to the community!

What are your Quality Gate criteria? What specific condition is failing?

 
Ann

@ganncamp
Thanks for replying.

I believe Criteria that new code smell should not be >0 is failing. Following is the QualityProfile.

Hi,

Your project homepage will tell you exactly which criterion is failing. E.g.
Selection_715

 
Ann

@ganncamp

Thanks for that.

Yes I can see the project overview tells that it is failing due to increased code smell. Please see image below. But the fact is that there is no increase from BASELINE version. I am not able to get why Sonar is complaining.
29%20PM

Hi,

Thanks for the details. Now I understand your confusion.

In fact, the ‘on New Code’ metrics are not about delta from previous values, but about issues raised in code that has been touched (added or edited) in the new code period.

If we did look only at deltas then if I had 3 blocker bugs open, and I fixed 1 it would be “okay” for me to add a brand new one. Instead, with ‘on New Code’ metrics, if I fix one of my blocker bugs I still can’t add new ones.

Make sense?

 
Ann

@ganncamp

Thanks for your reply.

So in my scenario, BASELINE version is controlled via some automated process. Now any one can make any change that can increase or decrease issues. What I want to achieve is that on every sonar run, the comparison is made against the BASELINE only. Is there a way where I can achieve that?

Is there a way where I can delete the analysis other than the BASELINE version automatically?

Hi,

Assuming your New Code Period is either set to prevous_version or explicitly to ‘BASELINE’ then all comparisons are always made against that analysis.

 
Ann