Skip to main content

Module fix_engine

Module fix_engine 

Source
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§

BlockedFix
Edit
A single text replacement in byte offsets [start_byte, end_byte).
Fix
A fix proposal, potentially containing multiple edits.
PlanResult
ProtectedRange
Byte range that should not be changed by automatic fix application.

Enums§

BlockedReason
FixApplicability
How safe it is to apply a fix automatically.
ProtectedRangeKind
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.