Hello! We are having a problem with old issues showing up as blockers for Quality Gates on what should be new code.
Our team recently transitioned over from SonarQube to SonarCloud MTM and are having issues with “New Code”. The previous definition we used was the mainline branch as the reference branch and on that branch we defined a 30 day “number of days” time period for new code. That does not appear to be an option in SonarCloud, so we are using the “previous version option”, although in testing this issue has occurred in the “number of days” setting as well.
The problem is really old issues that do not have a history of ever being closed and have nothing to do with new code are presenting as blockers. These methods and blocks of code have been untouched for years.
Your second screenshot shows that your issue was raised on June 27. Would that be the date you first analyzed the project on SonarCloud?
When a project is first analyzed, all the issues raised in that analysis get the analysis date, rather than all being backdated to when the code was last touched.
No, we only started using SonarCloud this year, in June 27th 2017 we were still using SonarQube. The problem isn’t that the issues aren’t being backdated it is that items already raised years ago are being considered blockers now.
I don’t think the Quality Gate you’re showing is what’s applied. Because if it were, then the failed conditions shown on your project homepage would include the words “on New Code”.
If that was the case, wouldn’t all branches in the project be affected? We are only experiencing this issue on a subset. Also, shouldn’t I be able to see additional Quality Gates under “Quality Gates”? If it can be applied from elsewhere, I would not know where to look.
I can confirm the Quality Gate assigned to the project is only listed as “New Code”. To my understanding there was never any Quality Gate without the New Code condition.
That branch ran 6 days ago. I do not have the ability to re-analyze that specific branch right now but that specific issue was merged into a different branch which I was able to re-analyze today and it is still having that problem.
Okay, I’m finally registering that your homepage screenshots don’t include New and Overall tabs. That means we’re dealing with a short-lived branch, where only “new” code and “new” conditions are considered. (Sorry, I’m a little slow sometimes.)
So then this is either about the definition of new code for your branch or about the SCM data available during analysis.
Can you provide the full analysis log for this branch?
The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.