Codecov generates negative coverage for unchanged files

Description

While creating a new pull request several times, it happens that the codecov has reported negative coverage for files that have not been modified at all. It also varies, sometimes codecov is positive and sometimes is not.
Here is a PR link (https://github.com/eclipse/kapua/pull/2937), it is an open-source project.

After creating the PR on eclipse / kapua official repo, codecov generates negative coverage. Meanwhile, I tried to do the same PR to my forked develop and there codecov works without problems (https://github.com/code-incubus/kapua/pull/3).
The question is why codecov generate and show negative reports / or missed lines. if the new tests were added and if the CI passed correctly?
Please advise for any hint regarding this issue.

Repository

My forked project:


Official repo:

Versions

/

Additional Information

I am also submitting a .yaml file configuration …
codecov:
require_ci_to_pass: true

comment:
    behavior: default
    layout: "reach, diff, flags, files"
    require_base: false
    require_changes: false
    require_head: true

coverage:
    precision: 2
    range: "70...100"
    round: down
    status:
        changes: false
        project: true
        patch: true

parsers:
    gcov:
        branch_detection:
            conditional: true
            loop: true
            method: false
            macro: false
    javascript:
        enable_partials: false

ignore:
    - "qa"
    - "**/test/"
    - "**/test-steps/"
2 Likes

I can confirm this - I tried on my fork and although I get +0.00% coverage it is not negative (link to my fork PR is here).
Can anybody else maybe try and see if they get negative coverage (try to create a PR on your own form from the branch code-incubus provided to newest develop branch of Kapua project)? This is getting really frustrating on the Kapua project, as some PRs without tests have 1.xx+% coverage and sometimes PR with only tests have negative coverage…

Leo

1 Like

Hi all, we have made some changes and upgrades to our system. Is this still happening and if so, is there a more recent commit where this occurs?

Hi @tom,
thanks for the update. Until now we have implemented a “workaround” (creating PRs with close to 1k lines, that way we always have positive coverage).
I will try to create some simple (short tests) and push them to my fork. I will let you know how this goes.

Leonardo

1 Like