code coverage drops when removing unused imports in Python code
complete
Fabian Egli
Thank you! This is great, but from the documentation I am not sure on which level I should apply the
removed_code_behavior
config. Could you please include it in the sample config listed in the linked page? If I read that correctly it is implied that it goes into the "project" section, but this could probably be more explicitly stated if so.AJ Fazzio
Fabian Egli: Great feedback, thank you! You're correct, it goes in the "project" section, but I will update the docs to be clearer on that front.
AJ Fazzio
complete
AJ Fazzio
Hi all, we've recently rolled out our "removed code behavior" functionality, full docs here: https://docs.codecov.com/docs/commit-status#removed_code_behavior
This will allow you to configure exactly how you want Codecov to behave in the scenario of removed code or code refactoring. This also represents a change in default behavior for project checks, if the patch is 100% covered, but your project coverage goes down, we will now pass the checks by default. Please give it a shot and let us know if you have any feedback!
AJ Fazzio
Merged in a post:
Codecov is breaking CI even when coverage is not affected
ed
If I remove a line of code, it's expected that I'll get one less covered line.
Codecov still displays this case as a failure, which makes no sense to me
J
Jerrod Engelberg
@ed, this is great feedback and I agree with you. We're planning to build support for this edge case --> you can read it here and add any feedback: https://app.codecov.io/gh/feedback/p/code-coverage-drops-when-removing-unused-imports-in-python-code
Jerrod Engelberg
Another comment from community on this same topic: https://community.codecov.com/t/a-decrease-in-the-coverage-percentage-is-not-a-reliable-metric/2621/2
Fabian Egli
Here is another example of a related issue when unnecessary code is removed that is not import statements: https://github.com/nf-core/tools/pull/1744#issuecomment-1207395169
Related Stackoverflow page: https://stackoverflow.com/questions/45601477/pylint-warning-for-useless-super-delegation/51030674#51030674
AJ Fazzio
Merged in a post:
Offset coverage
Kirsten Lambertsen
Codecov should detect when coverage goes down due to removed covered lines so that coverage reporting is more accurate.
AJ Fazzio
planned
AJ Fazzio
Hi Fabian Egli this is something we're working on this quarter, we don't believe it makes sense to penalize a user simply for having fewer lines of code, we'll follow up once we have released our fix for this particular case.
Load More
→