New Code data not populating

We are not able to see any data in New Code tab when comparing to any base branch even after multiple sonar scan runs.
We have a lot of changes to the branch compared to the reference branch.
Recently we have upgraded sonar developer edition from v10.4 to v2025.1.1 and updated the sonar task version after that this issue started.
We were able to see data in new code on the portal perfectly before.

Hi,

What is the New Code definition?

You should find it toward the top of the New Code tab.

 
Ann

We generally do it with reference branch every time in which we compare it with our last release branch. But since this issue has occurred we have tried with “No. of days” and even with specific setting of a branch as well.

Hi,

Can you share your analysis log?

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.

This guide will help you find them.

 
Thx,
Ann

Hi @ganncamp

I have attached logs here.

sonarlogs.txt (8.6 MB)

Hi,

This doesn’t seem to be the full log. It ends mid-stream, so to speak.

 
Ann

Hi @ganncamp ,

I am sorry. Here you go.

sonarlogs.txt (12.4 MB)

Hi,

Here you go:

2025-04-30T10:48:57.3160819Z 10:48:56.152 WARN: Shallow clone detected, no blame information will be provided. You can convert to non-shallow with 'git fetch --unshallow'.
2025-04-30T10:48:57.3161204Z 10:48:56.155 INFO: SCM Publisher 0/188 source files have been analyzed (done) | time=6ms
2025-04-30T10:48:57.3161537Z 10:48:56.155 WARN: Missing blame information for the following files:

With about 200 lines like this:

2025-04-30T10:48:57.3161889Z 10:48:56.155 WARN: * sc/tests/unit/Project/Core/code/Scripts/Vue/components/BaseTextareaOld.spec.js

 
HTH,
Ann

Hello @ganncamp,

Thanks for highlighting the issue but I apologize I didn’t understand it completely.
Can you please guide what to do next in order to fix it?

Regards,
Rohit

Hi,

Well as a first step, make sure you’re checking out with fetchDepth: 0.

 
HTH,
Ann

Hi Ann,

Tried that but unfortunately no luck.

Hi,

The message is pretty clear:

That means your attempt to apply fetchDepth: 0 - or whatever the equivalent in your CI is - hasn’t worked.

 
Ann

Hello Ann,

I meant I tried after you said to try with adding fetchdepth but that didn’t resolve the issue.
Here is the fresh logs after adding fetchdepth to checkout step and I don’t find “shallow clone” in the anymore.
sonar.txt (13.4 MB)

I am using Azure pipelines.

Hi,

Your log says that new code changes were found:

2025-05-01T15:32:16.1630412Z 15:32:15.811 INFO: SCM writing changed lines
2025-05-01T15:32:16.1634101Z 15:32:15.846 INFO: Merge base sha1: d23f0185b6bc6e8f50468e6d1b90b923907c9429
2025-05-01T15:32:30.9224845Z 15:32:30.914 DEBUG: SCM reported changed lines for 108 files in the branch
2025-05-01T15:32:30.9225886Z 15:32:30.915 INFO: SCM writing changed lines (done) | time=15104ms

So is this still true?

 
Ann

Yes Ann. I swear to god.

Hi,

Taking a closer look at your log file… nothing jumps out at me. Going back to your screenshot, I see that 20 New Lines were found.

Can you click through on that 20 and see what shows up?

 
Thx,
Ann

Hi Ann,

Clicking on that shows this:

Also my concern is why coverage data is not getting computed. And the reason for my concern is that we have a similar pipeline containing exact same steps for “develop” branch which gets triggered once a Pull Request is completed and code is merged to the develop branch. Data for that pipeline scan has no problem at all. See here:

I am not able to understand why only problem with release branches even though they have same quality gates and quality profile.

Hi,

I’m confused. I thought your concern was that

If you click through on one of those files in your first screenshot, what shows up as new code (blue highlight)?

 
Ann

Hi Ann,

Yes all highlighted one in those files are new code

I apologize if I confused you but how to fix coverage thing here?

Hi,

Could you share a screenshot of some of this new code, please?

 
Thx,
Ann