Replies: 1 comment 1 reply
|
Hi, thanks for your question. The suggested diff-ing strategy of providing a "git diff" patch isn't as accurate and is the reason why pycobertura doesn't support it. Allow me to provide an example to illustrate. Imagine the following patch: diff --git a/example.py b/example.py
index 123abc4..89fedcb 100644
--- a/example.py
+++ b/example.py
@@ -5,11 +5,14 @@ def process_data(data):
processed = [item.strip() for item in data if item]
print(f"Processed data: {processed}")
- # Validate the processed data
- validate_data(processed)
+ # Ensure data meets new quality standards
+ if not all(item.isalpha() for item in processed):
+ raise ValueError("Processed data contains invalid characters")
- return processed
+ return {"processed": processed, "count": len(processed)}What might go unnoticed is that the function This is why "pycobertura diff" exists: other diff coverage tools using the "git diff" strategy cannot highlight dead code. They only report the coverage status of each line within the patch. On the other hand, pycobertura truly diffs whole coverage reports to find all changes in coverage throughout the code base, not only within the scope of the patch. I hope this helps you understand why we don't implement this feature. |
Uh oh!
There was an error while loading. Please reload this page.
Hi,
With the "diff" command, pycobertura needs 2 separate source folders. Would it be possible to implement this feature with a git diff file, as the cobertura-diff-coverage does ?
All reactions