Skip to content

Incorrect coverage values when coverage reports have duplicate blocks #61

@LanderK-Bondaval

Description

@LanderK-Bondaval

I discovered that coverage reports containing duplicate blocks for the same source code segment are parsed incorrectly, resulting in inflated or inaccurate coverage percentages. The current parser counts duplicate blocks multiple times instead of merging or deduplicating them.

This issue can arise from certain Go test configurations or tooling that produce repeated blocks in coverage output.

Impact:
The coverage percentage values produced by this action often differ significantly from the "true" value and those reported by go tool cover. For example, in one test case, the action reported ~20% coverage while go tool cover -html showed ~95% coverage. This discrepancy can cause confusion and mistrust of coverage results.

Screenshots

Image
Image

Fix
I have a PR ready with the fix, including tests and sample coverage files demonstrating the problem.

This fix aligns the parsing logic with how go tool cover handles coverage blocks — it correctly calculates total coverage after profile parsing and block deduplication logic in ParseProfilesFromReader.

Looking forward to feedback and hoping this can be merged to improve coverage accuracy.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions