google / vim-coverage

Apache License 2.0
101 stars 22 forks source link

python: simplify/fix coverage #22

Closed blueyed closed 6 years ago

blueyed commented 6 years ago

Just use cov.analysis, which makes the code easier and actually fixes it for when the source code has been updated after coverage has been generated.

btw: really 2 spaces? Would you like a setup.cfg to ignore this with flake8 then?

dbarnett commented 6 years ago

If I'm reading the docs right, cov.analysis(source_file)[1] is "lines of executable statements" whereas cov.data.lines(source_file) is "lines executed". So uncovered lines are incorrectly showing as covered after your change (only comment lines w/ no executable statements aren't shown as covered). The test failures seem to agree the number of covered lines was changed.

2 spaces is Google's internal python style, and even though Google's external style guide says 4 spaces, open source Google projects tend to stick w/ 2, for example https://github.com/google/python-gflags.

blueyed commented 6 years ago

Agreed. My idea was to somehow reflect better what is actually executable (for when a file has changed, and .coverage is not up-to-date), but this does not seem to be supported anyway.