google / vim-coverage

Apache License 2.0
101 stars 22 forks source link

Add a gcov plugin #41

Closed okkays closed 3 years ago

okkays commented 3 years ago

lcov is a graphical front end for gcov.

By having lcov support, we can achieve gcov support by running gcov's binary gcda files through lcov's geninfo. There are other applications (such as bazel) that produce lcov-style reports without the use of lcov or gcov directly, so lcov support seems to get us the broadest support with the least lift.

This plugin looks for coverage data in a configured set of directories (by default, '.') for a set of file patterns (by default, ['*.gcda.info', 'coverage.dat', and '_coverage_report.dat']) containing that lcov geninfo data. It builds a list of coverage reports (in the format of coverage#CreateReport) based on the files it finds. The geninfo format itself is relatively straightforward; the plugin just needs to:

  1. Read the collection of records in each info file.
  2. Keep track of which source file each record corresponds to.
  3. Create a coverage report for that source file.
  4. Merge branch information (partial coverage info) and coverage information within each report.
  5. Merge coverage information between reports (two tests can produce two reports that cover the same file in different ways).

I'm still relatively new to writing "good" vimscript, so any comments/nits on best practices definitely welcome!

Thanks for taking a look!

okkays commented 3 years ago

Perfect! Definitely what I was looking for; thanks for taking the time to be thorough!

I'll finish things up sporadically over the next couple of days. I'll let you know when it's ready for another pass.

okkays commented 3 years ago

comments addressed!

dbarnett commented 3 years ago

All set. Merging!