I have 100% code coverage, but codecov is saying I have ≈20% because it is saying the lib file is ≈500 lines when it’s really just ≈100. Anyone run into this? Or know whether it’s an issue with Codecov or with my CI setup?
@BWStearns the quick answer is that it looks like you are uploading coverage for your dependencies. You can see it in the report(click Download on the right) uploaded to Codecov.
Due to the naming of those files (also src/lib.rs), we are aggregating all the coverage. I’m not familiar enough with grcov, but there should be a way to not include the dependency coverage.
For anyone who runs across the same issue: I was able to exclude deps by calling grcov like this: grcov . --binary-path ./target/debug --ignore="/*" -s ./src -t lcov --branch --ignore-not-existing -o lcov.info
You might have better results if you use -s . --keep-only 'src/**', but it’s been a while since I checked. -s tells consumers of the coverage data where the source tree actually starts, so if they want to map things back to the source code I think it’s easier (some tools do various tricks with the path prefixes so they line up, but it doesn’t always work). Then --keep-only is the thing that acts as a filter to ignore any dependency code in cargo’s build directories.