Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions eof_fixer/fixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

def _assert_never(value: NoReturn) -> NoReturn:
"""Static-exhaustiveness guard: ty errors if any union member can reach here."""
raise AssertionError(value) # pragma: no cover
raise AssertionError(value) # pragma: no cover - ty proves every call unreachable (ADR-0002)


@dataclasses.dataclass(frozen=True)
Expand Down Expand Up @@ -72,7 +72,7 @@ def _detect_trailing(file_obj: IO[bytes]) -> _EofAction:
if remaining.startswith(sequence):
return Truncate(position + len(sequence))

raise AssertionError("unreachable") # pragma: no cover # noqa: EM101
raise AssertionError("unreachable") # noqa: EM101 # pragma: no cover - remaining is all \n/\r, so a sequence matches


def fix_file(file_obj: IO[bytes], *, check: bool) -> bool:
Expand All @@ -99,7 +99,7 @@ def fix_file(file_obj: IO[bytes], *, check: bool) -> bool:
file_obj.seek(offset)
file_obj.truncate()
return True
case _: # pragma: no cover
case _: # pragma: no cover - exhaustiveness guard; ty verifies every _EofAction is matched
_assert_never(action)


Expand Down
4 changes: 2 additions & 2 deletions tests/test_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def test_ignore_rules_come_only_from_gitignore_files_in_the_tree(tmp_path: pathl
(info / "exclude").write_text("*.log\n")
(tmp_path / "a.log").write_text("x")

def _no_subprocess(*args: object, **kwargs: object) -> None: # pragma: no cover
def _no_subprocess(*args: object, **kwargs: object) -> None: # pragma: no cover - runs only if discovery spawns one
message = f"discovery spawned a subprocess: {args} {kwargs}"
raise AssertionError(message)

Expand All @@ -125,7 +125,7 @@ def test_symlinks_are_skipped(tmp_path: pathlib.Path) -> None:
link = tmp_path / "link.txt"
try:
link.symlink_to(target)
except (OSError, NotImplementedError): # pragma: no cover
except (OSError, NotImplementedError): # pragma: no cover - only where the OS refuses symlinks
pytest.skip("symlinks not available on this platform")
result = _walk(tmp_path)
assert "target.txt" in result
Expand Down
2 changes: 1 addition & 1 deletion tests/test_fixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def test_symlink_does_not_crash(tmp_path: pathlib.Path) -> None:
link = tmp_path / "l.txt"
try:
link.symlink_to(target)
except (OSError, NotImplementedError): # pragma: no cover
except (OSError, NotImplementedError): # pragma: no cover - only where the OS refuses symlinks
pytest.skip("symlinks not available on this platform")
fixed = _names(fix_directory(tmp_path))
assert "t.txt" in fixed
Expand Down
Loading