Credence.Syntax
(credence v0.6.0)
Copy Markdown
Syntax phase — fixes code that won't parse.
Only runs when Sourceror.parse_string/1 fails. Delegates to rules
implementing Credence.Syntax.Rule behaviour.
Rules are discovered automatically and run in priority order (lower first), with module name as tiebreaker for determinism.
Summary
Functions
@spec analyze( String.t(), keyword() ) :: [Credence.Issue.t()]
@spec fix_with_trace( String.t(), keyword() ) :: {String.t(), [{module(), non_neg_integer()}]}
Like fix/2, but also returns a list of {rule_module, issue_count} tuples
for every rule that actually fired and was applied.
Every step is logged via Logger.debug with [credence_fix] prefix:
rule name, whether the source changed, and a before/after diff of the
lines that were modified. If the source already parses, the pipeline
is skipped entirely.