Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
coderustic committed Nov 24, 2024
1 parent 84b86fd commit 1729cad
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions cover_agent/coverage/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def parse_coverage_report(self) -> Dict[str, CoverageData]:
raise ValueError(f"Unsupported JaCoCo code coverage report format: {file_extension}")
total_lines = missed + covered
coverage_percentage = (float(covered) / total_lines) if total_lines > 0 else 0.0
coverage[class_name] = CoverageData(covered=covered, missed=missed, coverage_percentag=coverage_percentage)
coverage[class_name] = CoverageData(covered_lines=[], covered=covered, missed_lines=[], missed=missed, coverage=coverage_percentage)
return coverage

def _get_file_extension(self, filename: str) -> str | None:
Expand Down Expand Up @@ -241,9 +241,8 @@ def filter_report(self, report: CoverageReport, file_pattern: str) -> CoverageRe
if file_pattern in file
}
return CoverageReport(
total_coverage=(sum(cov.covered_lines for cov in filtered_coverage.values()) /
sum(cov.covered_lines + cov.missed_lines for cov in filtered_coverage.values()))
if filtered_coverage else 0.0,
total_lines = sum(len(cov.covered_lines) + len(cov.missed_lines) for cov in filtered_coverage.values())
total_coverage = (sum(len(cov.covered_lines) for cov in filtered_coverage.values()) / total_lines) if total_lines > 0 else 0.0,
file_coverage=filtered_coverage
)

Expand Down

0 comments on commit 1729cad

Please sign in to comment.