Credence.Syntax.Rule behaviour (credence v0.4.1)

Copy Markdown

Behaviour for syntax-level rules that fix code which won't parse.

These rules work on raw source strings (no AST available). Each rule detects a known LLM syntax error pattern and can fix it.

Summary

Callbacks

Detect issues in unparseable source. Returns list of issues.

Attempt to fix the source. Returns the (possibly modified) source.

Callbacks

analyze(source)

@callback analyze(source :: String.t()) :: [Credence.Issue.t()]

Detect issues in unparseable source. Returns list of issues.

fix(source)

@callback fix(source :: String.t()) :: String.t()

Attempt to fix the source. Returns the (possibly modified) source.

priority()

@callback priority() :: integer()