Sonarqube wrongly identifies new code outside of configured time range

We’re using Sonarqube 9.9.4 Developer Edition.

Sometimes for larger or long-living merge requests we have problems, that sonarscanner falsely identifies code changes that are older than the configured “New Code > number of days interval” (which we set to 30 days) as new code.
For example in yesterdays CI run a change from April 16th was considered as new code.
In all CI pipelines that ran the days before, sonar-scanner didn’t report any of these code changes. This seems to have happened after we merged another feature branch (that was branched away from the current merge request branch some weeks before) back into the current merge request branch.

Because our merge pipeline relies on a successful execution of sonar-scanner, we are currently blocked to merge our changes back into the main branch. Our only way would be to disable the corresponding quality gate temporarily, what we obviously want to avoid.

Hey there.

Something you may want to consider is that the New Code Period only applies to branches, and not merge/pull request analyses. For merge/pull request analyses, the new code will always be the new code as compared to the target branch.

This makes sense to us, because the ultimate goal is keeping new issues outside of the target branch. When you’re analyzing a pull request, the target branch doesn’t care if those issues were raised yesterday or two months ago.

Could that explain what’s going on? Sorry if there’s a misunderstanding – these issues are always kind of hard to explain/diagnose in a text-based way. :slight_smile: