Skip to content

[Bug]: Wrong failure behavior when comparing with diff #45

Description

@emmanuelsdias

What happened?

Hello, first of all just wanted to say that I really like this project, it's one of the best coverage actions I've used so far!

I think the new-uncovered-statements-failure and coverage-reduction-failure behaviors are swapped. When using coverage-reduction-failure, even when overall coverage increases, my action fails if there's any Missing > 0 in the diff report.

According to pycobertura's docs on diff exit codes, we have the following exit codes:

  • 2: the changes worsened the overall coverage
  • 3: the changes introduced uncovered statements but the overall coverage is still better than before

As you can see, pycobertura's error exit code 3 indicates that overall coverage increased despite new uncovered lines. However, when we check this action's code, we see that coverage-reduction-failure checks for exit code 2, not 3.

if [[ "${{ env.pycobertura_status }}" == "2" && "${{ inputs.coverage-reduction-failure }}" == "true" ]]

Meanwhile, the new-uncovered-statements-failure matches the worsened the overall coverage descripition, which associates any increase in uncovered line as failures.

if [[ "${{ env.pycobertura_status }}" == "3" && "${{ inputs.new-uncovered-statements-failure }}" == "true" ]]

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct.

Contribution Guidelines

  • I agree to follow this project's Contribution Guidelines.

Security Policy

  • I agree to follow this project's Security Policy.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions