Skip to main content

Module patch_view

Module patch_view 

Source
Expand description

Changed-line coverage: are the lines this change touches tested?

The denominator is the part that has to be right. It is the intersection of two facts already established elsewhere: the lines a patch added or modified, and the lines the run’s language adapter decided were executable. Taking the intersection means comments, blank lines and declarations are excluded because the adapter already excluded them, not because this module guessed at syntax it does not parse.

Git invocation lives at the edge, in the CLI. Everything here is a pure function of a diff and a run view, so the cases that matter – renames, deletions, comment-only changes, files absent from the recording – are testable without a repository.

Structs§

PatchFile
PatchView

Functions§

annotations
Render GitHub Actions annotations for the uncovered ranges, capped.
build
Intersect a patch with what the run measured.
changed_lines
Parse git diff --unified=0 output into the lines each file gained.
escape_message
escape_property
Escape a value for a GitHub Actions workflow command.
ranges
Collapse consecutive uncovered lines into inclusive ranges, so a block of twenty untested lines is one annotation rather than twenty.

Type Aliases§

ChangedLines
Added and modified lines per file, as a unified diff describes them.