Skip to content

Commit

Permalink
Add better error handling for wrong diff format
Browse files Browse the repository at this point in the history
  • Loading branch information
ewjoachim committed Sep 26, 2023
1 parent 08f2d84 commit a3cf05c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion coverage_comment/coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ def parse_diff_output(diff: str) -> dict[pathlib.Path, list[int]]:
current_file = pathlib.Path(line.removeprefix(added_filename_prefix))
continue
if line.startswith("@@"):
assert current_file
if current_file is None:
raise ValueError(f"Unexpected diff output format: \n{diff}")

Check warning on line 292 in coverage_comment/coverage.py

View workflow job for this annotation

GitHub Actions / Run tests & display coverage

This line has no coverage
lines = parse_line_number_diff_line(line)
result.setdefault(current_file, []).extend(lines)
continue
Expand Down

0 comments on commit a3cf05c

Please sign in to comment.