False negatives for function calls splitted along multiple lines
See original GitHub issueHi, thanks for this library. It is very helpful in our project!
I think I found an issue, false negative, that affects overall quality of diff-cover check in a specific use case.
I use diff-cover 6.4.4 with coverage.py in version 6.2 through pytest-cov in version 3.0.0 with Cobertura XML report.
- Recently I updated function call in my production code (the signature of the function I use changed, it has a new argument, and I’ve added new keyword argument to the call)
- This production call has no test coverage.
- Diff-cover doesn’t fail for the line with a new argument in the function call.
Expected:
- Diff-cover fails for the line with a new argument in function call because of lack of the coverage.
Details: I think that probably diff-cover ignores lines without coverage report, and probably (?) it should for every changed line in diff search for first line above with reported coverage. On the image below red line point to lines not covered by tests (GitLab supports Cobertura reports).
$ diff-cover coverage.xml --fail-under 100 --html-report diff-cover.html --compare-branch origin/develop
-------------
Diff Coverage
Diff: origin/develop...HEAD, staged and unstaged changes
-------------
…/file_on_screenshot.py (100%)
…/obfuscated.py (100%)
…/obfuscated2.py (100%)
-------------
Total: 13 lines
Missing: 0 lines
Coverage: 100%
-------------
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Misses in coverage · Issue #351 · xd009642/tarpaulin - GitHub
It looks like my coverage report is counting the lines in tests as part of coverage (including one miss, somehow).
Read more >Is it a bad idea to list every function/method argument on a ...
I would say that function calls should be all on one line unless they ... when all parameters are on one line, and...
Read more >Styling multi-line conditions in 'if' statements? [closed]
I like having the closing bracket and colon on their own line to separate the if condition from the body, though (and it's...
Read more >Break a long line into multiple lines in Python - GeeksforGeeks
As in the output, we can see that we are getting False because there's a newline character (\n) in x, whereas in y...
Read more >Built-in Types — Python 3.11.1 documentation
Some operations are supported by several object types; in particular, ... that returns False or a __len__() method that returns zero, when called...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks, ill make some time in the next few days to look at this closely. I starred and cloned the repo.
I think the next step here is to open an issue with coveragepy and see if they have advise. I recall the SQLite database recently added but I vaguely recall that being considered private and not something I would wanna rely on.
The cobertura format last time I tried to investigate it is not terribly well documented.
but Ned is typically pretty helpful and he may have some ideas or thoughts.