Understanding how "new lines to cover" works

Must-share information (formatted with Markdown):

Sonar version and tools

  • Sonar version 9.3.0.51899
  • dotnet tool JetBrains.dotCover.GlobalTool (latest)
  • dotnet tool dotnet-sonarscanner (latest)

I am trying to understand how the “new lines to cover” works. My project ‘new code’ setting is set to ‘Reference Branch’ pointing to main. While the main branch is set to ‘Previous Version’. In the current scenario, I have not run any scans against main yet. Only a single PR branch has been scanned. Yet that scan reports 0 “new lines to cover”. I’m struggling to understand this because in some instances in another project, we’ve added whole new methods and still it reports 0 lines. And yet other PRs in that project it reports many lines.

What does the Code tab of your project look like (on a pull request). Do you see lines detected as new that should be able to be covered by tests?

5 lines total detected. In this test I added an IF statement, and a method call inside the if statement. I’d expect this to count as needing coverage right?

Well… it sounds like you’ve modified a test (In this test I added an IF statement)… and I don’t think you’ll find test files represented in your coverage report.

Actually this was not a unit test

Going back to my initial question:

Can you share a screenshot (not of a specific file, but of the Code tab)

Here is the code tab in SonarQube

Here is the report in GitHub

Anyone have any ideas?