Notification for not covered lines on a developer

At the moment if a developer introduces a code smell/issue then Sonar can be set up to send a notification to that developer. Or you can look at the new code smells and a developer will have been assigned that issue using the blame info (from git)

Is it possible to have a similar notification/page for new lines of code not covered. I assume it’s technically possible as sonar can work out what is a new line of code and if it’s covered or not and who last wrote that piece of code.

The reason we want this is we what to get to as close to 100% code coverage as possible and it would be useful for the developers to be able to get a view of exactly which lines they have touched that are not covered in a concise way.


There are some rules related to unit tests, but I think they’re language-specific, file-wide, and probably not appropriate for your need. Instead, I think your need would be satisfied during PR analysis by setting a high threshold on Coverage on New Code. That would fail the PR’s Quality Gate* if too few of the PR’s new lines were covered.

*Assuming that at least 20 lines are changed in the PR. There’s logic to ignore New Code coverage conditions when fewer than 20 lines have been touched

Maybe this will help,

Yes we already have a pretty high threshold on new coverage. But we are trying to catch the odd 1 or 2 lines that we fail to cover in a commit. I guess the only real way to do this is to run dotcover or something similar locally in VS and see any gaps there.