aconrad / pycobertura

A code coverage diff tool for Cobertura reports
MIT License
114 stars 39 forks source link

Account for moved/renamed/delted files in miss counts #172

Closed wdouglass closed 10 months ago

wdouglass commented 11 months ago

When files are renamed, pycobertura may falsely indicate an increase in missed lines, because deleted files aren't accounted for in the count. This patch rectifies that situation

Please let me know if I've made any bad assumptions, and thank you very much for this useful tool!

aconrad commented 11 months ago

Hi @wdouglass,

Thanks for your contribution to pycobertura!

Could you take a moment to elaborate and illustrate with a few scenarios of what you observe that isn't right and what you expect to see? It would be helpful for me so I can better review this PR with your scenarios in mind. If you haven't already, adding a test specifically for your scenario would help too.

Thanks!

wdouglass commented 11 months ago

I gladly will! So here's the problem I saw

Imagine I have a program, that's made of source files main.c and a.c. say a.c has 5 missed lines. Now, if a.c got renamed to b.c, a pycobura diff should show a zero delta in total missed lines, but it was counting the new missed lines in b.c without subtracting the lines that were no longer missed in a.c (which no longer exists), and showing +5 missed lines

I'll definitely generate some reports and write a test that exercises this tomorrow morning, and push it to this PR. Thanks again for maintaining this project!

wdouglass commented 11 months ago

note: i force-pushed to add my GPG signature

aconrad commented 10 months ago

Released as v3.2.3.