Why are issues compared by date even when New Code is set to reference branch?

We’re using Sonar Developer Edition - Version 8.9.5 (build 50698) with a Go project. New Code is set to develop reference branch.

Author and commit date on develop branch is Wed Jun 1 14:50:17 2022 +0200. I found that if analysis isn’t done as a part of CI but is done later all new issues get a date such as June 1, 2022 at 5:10 PM - that’s expected but what’s unexpected is that they are listed as New Issues when a new feature branch created from develop is analyzed even though they weren’t introduced on that branch. For example, when I go to https://<SONAR-ADDRESS>/dashboard?branch=<FEATURE_BRANCH>&id=<PROJECT> it says Compared to develop, Started 12 days ago and June 1, 2022 at 2:50 PM. I’d expect to see only issues that were introduced on the feature branch listed as New Issues, not all issues that were identified after last commit in develop. I got 2 questions:

  1. Is my understanding correct?

  2. What’s the rationale behind this behavior? Are there any plans to change it?

Hi,

Welcome to the community!

We’ve done some work to improve New Code detection in branches since 8.9(.*) and I think it may be relevant.

SONAR-14929 - New Code using a ‘reference branch’ doesn’t detect changed code with git merge workflow
SONAR-15697 - New code detection when using reference branch and rebasing doesn’t detect some commits on branch

 
HTH,
Ann

Great, thanks. Are there any plans to backport these changes to 8.9.5?

Hi,

Sorry, there aren’t any plans to backport, as far as I know.

 
Ann