Sonar Cloud is not detecting New Source Code

New source code is not detected

  • ALM used Azure DevOps
  • CI system used Azure DevOps
  • .Net Project
  • Sonar Cloud

Hey there.

That’s not a lot of information to go on. Can you provide more details?

Can you please let me know what more information is needed, I can provide.

Hi @Colin ,

Can you help me here please, what more information is required. Appreciate your assistance.


How do you know New source code is not detected? What do you see in the logs/UI (feel free to share screenshots).

Let me give an example.

If new source code is added without Unit Test. cases & created a PR, Code is merging to main branch. Expectation from sonar is it should fail if Unit Test is not detected for new code.

@Colin can you help here pls.

@Colin I request you to please provide your inputs…

  1. List item

@Colin. We want to verify that if we want to add new source code (Raising PR), with out Unit Test. Will sonar detect that no unit test available for new source code & fail the build before merging to main branch.


We have source code with unit test cases in our develop branch(main branch).
For testing purpose if Sonar detects code without unit test cases we added new source code without unit test cases.
We were expecting the behavior of Sonar that it should fail to merge PR if it doesn’t detect unit test cases for the code which was newly added.

can you add your inputs here please.

Appreciate your help.

Can you share a screenshot (of SonarCloud) where you see this behavior (the Quality Gate not failing on a PR due to no coverage)

Sonar cloud coverage is not failing with the new code without UT:

It looks like SonarCloud detects 34 new lines, but none can be covered by tests. Based on the Code tab of your pull request, do you see any new code that actually should be covered by unit tests (and isn’t, say, comment lines or configuration files?)

This was the new code of 34 lines included.



Sorry to bother you again. I just want to know the behavior of Sonar Cloud on detecting new code. Will Sonar Cloud fails Azure DevOps pipeline if new Source Code is added with no coverage (no test cases).

If it detects, but in our scenario, we added new code without test case to it but still the build bypass SonarCloud and build is passed.

Appreciate your help.

@Colin ,

Can you please help here.

Can you please help on this issue.