Expand description
Git integration for the PR gate. Computes changed files (working tree +
staged + optionally vs a base ref) and changed line ranges so findings
can be attributed introduced-vs-inherited at line granularity (parsed from
git diff --unified=0), with file-level as the fallback.
Functions§
- changed_
files - Return the set of changed file paths (relative to
root), orNoneif this isn’t a git repo / git is unavailable. Includes unstaged, staged, untracked, and (ifbaseis given) everything changed since the merge-base withbase. - changed_
lines - Added/modified line ranges per file (relative paths) from
git diff --unified=0, combining unstaged + staged + (ifbase) the base range, plus whole-file ranges for untracked files.Noneif not a git repo. Enables line-level introduced-vs-inherited attribution. - file_
churn - Per-file churn = number of commits that touched each file (relative paths).
Noneif not a git repo. Used for churn×complexity hotspot ranking. - line_
is_ changed - Whether
lineoffinding_pathfalls in a changed range fromchanged_lines. - path_
is_ changed - Whether a finding path (possibly absolute or
./-prefixed) is in the changed set (which holds paths relative toroot).