taiki-e / cargo-llvm-cov

Cargo subcommand to easily use LLVM source-based code coverage (-C instrument-coverage).
Apache License 2.0
933 stars 57 forks source link

Highlight covered lines green in html report #86

Closed Warwolt closed 2 years ago

Warwolt commented 3 years ago

First of all, really nice project! I got it installed and running in my Windows environment with zero hassle. 👏

I've only used gcov in C++ based projects before, and so I've only seen that classical blocky html report. Gcov seems to render covered lines in green, and non-covered lines in red, in their html reports. As far as I can tell for the rust code that I've tested cargo-llvm-cov with, I'm only getting red lines.

image image

Is it possible for cargo-llvm-cov to generate html reports that contain these green lines? Or does it already and I'm just perhaps having a config issue?

taiki-e commented 2 years ago

I think this is because llvm-cov supports region coverage and branch coverage. (Note: It's llvm-cov that actually provides the functionality to generate the report, and cargo-llvm-cov just calls it with the appropriate flags.)

codecov and others represent partial coverage as a yellow line, but it's not clear which regions are not covered. The following is an example of llvm-cov region coverage.

llvm-cov

Also, if you want to see a line-style coverage report locally, I guess you can use lcov's html report (cargo-llvm-cov supports the lcov format).

taiki-e commented 1 year ago

FYI, I believe that by using llvm-cov-pretty together, you will get the report with the design you want.