Using new code "since previous version" instead of "since BASELINE"

Hi Duarte,

That wouldn’t account for what we see, because prior to the second analysis, we commit code changes. So in the second analysis the SCM would report a date newer than both the initial analysis data and changed lines. We don’t analyze the same, unchanged code multiple times.

BTW, I’ve just today started using SLBs in our builds. It required us to retrieve the new_coverage metric via the SQ API and then to fail the build if it reports less than our minimum requirement. So this is no longer a problem for us. If SLBs ever enforce a new coverage quality gate, we can remove our workaround.

Regards,
Kevin

Hi, did anyone here test this change on its own environment ?
I am using a sonarqube docker image (version 8.4.1.35646) and it seems that it’s not working properly.
I tried almost every combination (using a version as baseline, using the “previous version” method, the “number of days” option) and I still see “0 new bugs”:
For example in my “baseline” analysis there are 287 bugs, then i upload another version with “288” bugs, and in “overall tab” and “issues” tab i see 288, but in the “new code” tab, it still says “0 new bugs” (the same with code smells, where I see a lot of new code smells (like hundreds), but in the “new code” tab i see “14 new code smells”.

Is anyone experiencing the same ?

Thanks a lot

Hi,
That analysis with the new version and 288 bugs is the one used as the baseline for the new version. It will always have 0 new lines of code, and 0 issues.
New bugs introduced in subsequent analysis should be considered as “new”.

Thanks Duarte, but the version I marked as baseline is the one with 287 bugs (I tested to upload also several times this version with 287 to reproduce what Kevin said: " Doing another another analysis appears to fix this") to no avail.
So when i upload the version having 288 bugs, i expect to see “1 new bug” no “0 new bugs” or else I don’t get the point of having the dashboard.

Thanks!

Could you try analyzing again with yet another new bug, to see if it shows up as new?

Yes, i tried adding another bug (n+2) and then it shows up in the dashboard.
The code smells are showing up as “14 new” (the same as in the last scan) when i think they should be a lot more i didn’t introduce new “code smells”, but i’m talking about the ones in n+1)
Is this the normal behavior ?

Thanks

Yes. As I said, the first analysis with the new version sets the baseline, meaning that all “new” values will be at 0. From there on, lines and issues added will be “new”.