Expand description
Deterministic patch planning helpers for lint fixes.
This module intentionally keeps the API small and explicit:
plan_fixes()selects compatible fixes and records blocked reasons.apply_edits()applies byte-range replacements end-to-start.- protected range helpers mark SQL comments/string literals and template tags.
Structs§
- Blocked
Fix - Edit
- A single text replacement in byte offsets
[start_byte, end_byte). - Fix
- A fix proposal, potentially containing multiple edits.
- Plan
Result - Protected
Range - Byte range that should not be changed by automatic fix application.
Enums§
- Blocked
Reason - FixApplicability
- How safe it is to apply a fix automatically.
- Protected
Range Kind - Why a range is protected from automatic edits.
Functions§
- apply_
edits - Apply edits to source by processing from end to start.
- apply_
fixes - Apply a set of fixes to the source.
- derive_
protected_ ranges - Derive protected ranges from SQL comments/string literals and template tags.
- overlapping_
edit_ pairs - Return overlapping edit index pairs
(left, right). - plan_
fixes - Plan fixes deterministically and collect blocked reasons.
- protected_
ranges_ from_ templates - Derive protected ranges for Jinja-style templated spans.
- protected_
ranges_ from_ tokenizer - Derive protected ranges by tokenizing SQL and collecting comment + string tokens.
- sort_
edits_ deterministically - Sort edits in deterministic order.
- sort_
fixes_ deterministically - Sort fixes in deterministic planning order.
- touched_
protected_ ranges - Return protected ranges touched by the provided edits.