Expand description
scan --fix: apply the rewrite template of autofix-safe rules in place.
The detection pass never touches rewrite. This module compiles each
autofixable rule with its rewrite as the ast-grep fix, matches the source
directly (so it can re-match a mutated buffer and reach a fix point), and
applies the resulting edits. Findings that detection would suppress – inside
test code, disabled inline, or recorded in the baseline – are never
rewritten, mirroring the scanner’s own filters.
Structs§
- FileFix
- The rewrite of one file: kept only when the content actually changed.
- FixReport
- Outcome of a
--fixrun over one or more paths.
Functions§
- fix_
paths - Apply the autofix-safe rewrites over
paths. - fix_
snippet - Apply a single rule’s autofix rewrite to an in-memory snippet, to a fix
point. Used by
slopguard testto validatetests.should_fix: no baseline, no test-path filtering, no inline-disable directives are consulted. Returns the snippet unchanged when the rule is not autofixable.