we are using SonarQube Community Edition 8.9.6 and Jenkins for CICD, Bitbucket is integrated via Jenkins.
Below is the Activity tab details for one of the project:
- 21 April 2021 build shown (New code period start tagging seen here)
- Next build on 01 July 2021
- There are multiple builds after this till today i.e 03 Feb 2022.
As of today 03 feb we have set the New code period as 275 days.
If I back calculate for a build executed on 03 feb 2022 the New code period should start from 04 May 2021, hence ideally the “New code” marker should be on 01 July 2021 Build.
I have two queries
Why is the “new code” marker tagged incorrectly to the build seen on 21 Apr 2021 instead of 01 July 2021.
What is the logic the SonarQube uses to perform this calculations
Welcome to the community!
Have you reanalyzed since you updated the New Code Period setting?
Hi Ann campbell,
Yes, we have reanalyzed but the issue is not yet resolved.
How about a screenshot of the Activity tab?
I am unable to take screenshots due to security reasons. Can you please provide resolution based on the above mentioned details.
For the record, you’re always welcome and even expected to redact sensitive portions of logs and screenshots. But okay.
One of the reasons we reworked and offered new options for setting the New Code Period is that the mechanics of date-based and day-count periods were so confusing.
It has been so long since I dug into this that I don’t even know where to find my notes. But I guess what’s happening is that since there’s no analysis on day -275, SonarQube is stepping backward to the one before that to include day 275.
- I urge you to reconsider using a day-count New Code Period. The practical effect is that you only have to wait a little while (okay, maybe most of a year) for “bad” things to age-out of being bad
- if you really want the July 1 analysis to be the baseline, you should probably just select it explicitly