fix: Correct coverage calculation to return 0% for untested issues
Previously, coverage analysis was incorrectly using keywords from all existing tests, causing false positives where untested issues showed coverage percentages instead of 0%. Changes: - Only count tests specifically related to the analyzed issue - Return 0% coverage when no issue-specific tests exist - Maintain accurate coverage calculation for tested issues This ensures that Issue #3 correctly shows 0.0% coverage instead of 33.3%, while Issue #11 still correctly shows 100.0% coverage. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -353,8 +353,15 @@ class CoverageAnalyzer:
|
|||||||
|
|
||||||
# Get all covered keywords
|
# Get all covered keywords
|
||||||
covered_keywords = set()
|
covered_keywords = set()
|
||||||
|
issue_related_tests = []
|
||||||
for test in existing_tests:
|
for test in existing_tests:
|
||||||
covered_keywords.update(test.coverage_keywords)
|
if test.related_issue: # Only count tests specifically for this issue
|
||||||
|
covered_keywords.update(test.coverage_keywords)
|
||||||
|
issue_related_tests.append(test)
|
||||||
|
|
||||||
|
# If no issue-specific tests found, coverage should be 0%
|
||||||
|
if not issue_related_tests:
|
||||||
|
return 0.0
|
||||||
|
|
||||||
# Check coverage for each requirement
|
# Check coverage for each requirement
|
||||||
for requirement in requirements:
|
for requirement in requirements:
|
||||||
|
|||||||
Reference in New Issue
Block a user