Skip to main content

Module edit_problems

Module edit_problems 

Source
Expand description

Every problem an editor round trip can leave behind, and the repair tix can apply to each one (tix #1506).

The old flow ended with a run_editor that re-parsed the temp copy and threw the diagnostic away, so the caller could only report file not valid after edit and the real parse error never reached the user. This module is the replacement: run_editor no longer validates (its job is to run the editor), and the callers classify what came back here, where each problem carries the diagnostic and — where tix can do so safely — a machine-applicable fix.

The taxonomy is deliberately small and closed:

kindsourceautomatic fix
history_not_firsta tix lint history findingmove the section to the top of the body
unknown_keya tix lint unknown_key findingdeclare the key in [custom_attributes]
duplicate_keya YAML duplicate-field parse errordrop the later duplicate, keep the first
retired_links_keya tix lint retired_links_key findingremove the key
missing_titlean empty title: after the editrestore the pre-edit title
history_entrya hand-edited ## History linenone — reopen the editor
invalid_valueany other tix lint findingnone — reopen the editor
unparsablea frontmatter that will not parsenone — reopen the editor

Every problem carries a proposal, even when the only honest proposal is “reopen the editor on the retained copy and fix it by hand”. A problem with no proposal would be a dead end, which is exactly what this ticket exists to remove.

Structs§

EditProblem
One classified problem, with the diagnostic and the way out.

Enums§

EditFix
A machine-applicable repair.
EditProblemKind
What kind of post-edit problem this is.

Functions§

for_lint_findings
Classify the findings of a tix lint pass over the edited file.
for_parse_error
Classify a failed Issue::parse.
missing_title
A titleless issue’s problem, with the pre-edit title as the fix when there is one to restore.