How to create an issue when code coverage is missing?

Hello,

I just started with SonarQube 9.2 and a RubyOnRails Project on Bitbucket Cloud. Everything works so far.

Now I would like to see which lines are not covered by a test in the Pull Request Report. I have the test coverage up and running with SimpleCov and I see the annotated lines in SonarQube.

The problem now is that there are no issues created when the code coverage rule is not met and therefor no annotation is created in the bitbucket PR.

The description of the rule says the following:

So why is there no issue created for this rule even if it fails?

Hi,

This one may actually be tricky. It’s looking at the coverage percentage on the overall file, and PRs look at just new lines. So… I see two potential problems here:

  • while the coverage % on new code may be below the rule threshold, the overall coverage may not be
  • since this is a file-level issue, it’s likely not raised on a new line and thus wouldn’t be reported on a PR.

I think this is an interesting issue. I’m going to forward it internally, but I can’t promise anything.

 
Ann

1 Like