Skip to main content

run_custom_rules

Function run_custom_rules 

Source
pub fn run_custom_rules(
    enriched: &EnrichedGraph,
    root: &Path,
    config: &Config,
) -> Vec<Diagnostic>
Expand description

Run all custom rules defined in the config against the enriched graph. Custom rules are rules with a command field in [rules]. Each custom rule receives { graph, options } as JSON on stdin — the enriched graph (nodes, edges, analyses) plus the rule’s options — and emits diagnostics as newline-delimited JSON on stdout.

Expected output format per line: {“message”: “…”, “source”: “…”, “target”: “…”, “node”: “…”, “fix”: “…”}

All fields except message are optional. The rule and severity fields are set by drft from the config — the command doesn’t need to provide them.