FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Excluding lines with exclude_lines in .coveragerc does not work for me · Issue #107 · codecov/codecov-python · GitHub

This repository was archived by the owner on May 21, 2025. It is now read-only.

Repository navigation

This repository was archived by the owner on May 21, 2025. It is now read-only.

Excluding lines with exclude_lines in .coveragerc does not work for me #107

Description

Excluding lines with exclude_lines in '.coveragerc' does not work for me:
There is a part of the '.coveragerc' file attached below:

[report]
exclude_lines =
    except FileNotFoundError
    except CriticalError
    except EndOfFile
    except:

These lines are taken into account as not covered by CodeConv for example here:
https://codecov.io/gh/ldorau/pmemfile/src/419f2bdde894a84d62e1c6b4d530c6bf0a1b8665/src/tools/antool/utils.py#L61

Details:

The whole source code is available here:
https://github.com/ldorau/pmemfile/tree/CodeCov-bug

The last commit:
419f2bdde894a84d62e1c6b4d530c6bf0a1b8665
docker: add python3-coverage and upgrade pip

The python code:
https://github.com/ldorau/pmemfile/tree/CodeCov-bug/src/tools/antool

The ".coveragerc" file:
https://github.com/ldorau/pmemfile/blob/CodeCov-bug/tests/antool/.coveragerc

The Travis build for commit 419f2bdde894a84d62e1c6b4d530c6bf0a1b8665:
https://travis-ci.org/ldorau/pmemfile/builds/269204603

The CodeCov report for commit 419f2bdde894a84d62e1c6b4d530c6bf0a1b8665:
https://codecov.io/gh/ldorau/pmemfile/tree/419f2bdde894a84d62e1c6b4d530c6bf0a1b8665/src/tools/antool

Lines not excluded are located for example in the following files:
https://codecov.io/gh/ldorau/pmemfile/src/419f2bdde894a84d62e1c6b4d530c6bf0a1b8665/src/tools/antool/utils.py
https://codecov.io/gh/ldorau/pmemfile/src/419f2bdde894a84d62e1c6b4d530c6bf0a1b8665/src/tools/antool/antool.py

Activity

  1. ldorau commented on Aug 28, 2017

    Author
  2. lingthio commented on Sep 14, 2017

    I'm running into the same issue.

    Notice that exclude_lines is in the [report] section. I wonder if the .coverage data file contains the missing lines and that:

    • our local coverage-reporter uses this data file MINUS any lines that match the [report]:exclude_lines entries.
    • codecov uses only this data file as-is (does not honor exclude_lines).

    If so, codecov will need to:

    • find the .coveragerc file (it can be placed anywhere and named anything)
    • remove any exclude_lines matched lines from their reporting.

    If developers can't tell CI about the rc file, and if the CI can't tell CodeCov about the rc file, CodeCov could demand that the file is named .coveragerc and resides in the root directory.

  3. alejandrolujan commented on May 23, 2018

    I'm having the same issue - declaring exclude_lines in .coveragerc or in setup.cfg does not seem to have any effect on my Codecov reports, even though the configuration is reflected in my local coverage reports.

  4. Ademord commented on Jun 13, 2018

    Did anyone get this fixed? :(

  5. alejandrolujan commented on Aug 22, 2018

    Any news w.r.t this issue? This is throwing off our coverage reports and creates noise for the team.

  6. interDist commented on Mar 1, 2020

    everybody who complained about .coveragerc not being taken into account -- shouldn't you specify all your settings in codecov.yml?..

  7. erwanp commented on Apr 6, 2020

    everybody who complained about .coveragerc not being taken into account -- shouldn't you specify all your settings in codecov.yml?..

    In my project I didn't manage to include the exclude_lines in the codecov.yml but it worked by adding a .coveragerc on the side.

  8. self-assigned this
    on Nov 29, 2020
  9. smarie commented on Mar 9, 2021

    Any progress on this issue ? I have the same problem: both .coveragerc [report] section and setup.cfg [coverage:report] configurations are ignored by codecov.

    @interDist :

    everybody who complained about .coveragerc not being taken into account -- shouldn't you specify all your settings in codecov.yml?..

    This option is not present in the codecov.yml reference : https://docs.codecov.io/docs/codecovyml-reference#coverage

    @erwanp : from your project sources and coverage reports it seems that this is not actually working, no ?

  10. smarie commented on Mar 9, 2021

    My bad: it seems to work now. The secret seems to PUSH the .coveragerc file as it is not taken into account locally (the .coverage file and generated coverage.xml report do not contain anything about ignored lines, this is a post processing thing).

    So in other words, the codecov platform seems to check the git files separately (not during report upload), and if a .coveragerc file is present, applies the exclude lines appropriately. Can anyone confirm ? What about using setup.cfg instead of .coveragerc, is this officially supported ?

    EDIT: it seems that setup.cfg configuration is also correctly taken into account. So the secret is really to push these files to github before executing codecov

  11. removed their assignment
    on Jul 21, 2021
  12. ssbarnea commented on Nov 26, 2022

    I guess that nobody looked at it and now we already migrated the config to pyproject.toml, which is likely fully ignored by codecov.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL