SlatherOrg / slather

Generate test coverage reports for Xcode projects & hook it into CI.
MIT License
1.55k stars 236 forks source link

Add Branch Coverage data for ProfData coverage files #477

Closed hborawski closed 3 years ago

hborawski commented 3 years ago

Using the lcov json data segments, populate branch_coverage_data for profdata coverage files

This allows the cobertura report to correctly calculate branch coverage

Also added branch coverage to the HTML output by using the segments to determine column ranges that were not hit, so null coalesecing operations, or other single line branches can be determined as missed coverage.

Please let me know if there are any updates required for this PR, it's been quite some time since using ruby, so I'm sure the code can be improved.

I made sure the existing tests pass, and i added some small profdata tests to check that the branch data populates as expected.

I've also tested this locally against a real project and compared output to Xcode, to see how it works on a larger codebase.

Example of a covered line with an uncovered branch: Screen Shot 2021-02-23 at 2 52 52 PM

coveralls commented 3 years ago

Coverage Status

Coverage increased (+0.6%) to 96.176% when pulling d3c0ff661303d5141fa5756b24f78e8560564b4b on hborawski:profdata-branch-coverage into f5dfc242cf7477c909c0f3a0b687d19dca958529 on SlatherOrg:master.

hborawski commented 3 years ago

Updated the code to use snake case for all the variables, didn't even realize the rest of the codebase was snake 🤦

ksuther commented 3 years ago

Merged, thanks for the contribution! I'll make a release to include this.

hborawski commented 3 years ago

Happy to help, and excited to get all my projects updated with this!