Inconsistent partially covered lines


I got undermentioned codecov raport which I’m confused about:

What does it mean that return statement is partially covered? It happens also for other lines e.g 2 consecutive lines (like variable declaration) has different coverage. One is fully covered but second is only partially. I don’t know how to interpret that.

There is full codecov raport for this repo.

Does anynone know how to fix this? Is this some common bug or I’m doing something wrong. I use c++20 and gcov10 + gcovr for .xml generation.


@nekoffski, this looks like it has to do with how you are collecting coverage. Codecov is getting the upload here and is parsing the lines that are reported:

Specifically, you’ll see line 39 is only covered 50% (as a partial), and thus shows the return line as such.

I don’t have an answer for you, but I think it would be helpful to share a CI link or how you are collecting coverage reports.

Oh, thanks for giving me the hint that this could be issue with generating .xml file! It turned out that yellow lines are places where exceptions could be throwed. Unfortunately, in this case other part of code is reponsible for checking for exception so I had to disable it by adding --exclude-throw-branches flag.

Thank you for quick response.

1 Like