Skip to main content

annotate_diff

Function annotate_diff 

Source
pub fn annotate_diff(diff: &str) -> String
Expand description

Render a unified diff with new-side line numbers in a left column.

A reviewer’s finding is scored by its line, within crate::review_score::LINE_WINDOW. Asking a model to derive a line number from @@ -a,b +c,d @@ spends budget on arithmetic it is bad at and turns a correct finding into a miss — which would be measured as the reviewer failing to see the defect rather than failing to count. So the arithmetic is done here, where it is exact.

Removed lines carry no new-side number and are marked -, so the model can still see what was replaced without being able to cite a line that no longer exists.