question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

False negatives for function calls splitted along multiple lines

See original GitHub issue

Hi, 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).

Zrzut ekranu 2022-01-17 o 12 33 36 Zrzut ekranu 2022-01-17 o 12 33 49
$ 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:open
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Bachmann1234commented, Jan 17, 2022

Thanks, ill make some time in the next few days to look at this closely. I starred and cloned the repo.

1reaction
Bachmann1234commented, Jan 22, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found