diffguard-domain
Pure rule-domain logic for diffguard.
This crate performs rule compilation, line evaluation, preprocessing, directory override resolution, and inline suppression handling. It contains no process, filesystem, or environment I/O.
Public Modules
rules- compileRuleConfigtoCompiledRule, detect languagesevaluate- evaluateInputLinestreams against compiled rulespreprocess- best-effort comment/string masking by languageoverrides- compile and resolve per-directory rule overridessuppression- parsediffguard: ignore...directives
Core Flow
use ;
use ConfigFile;
let config = built_in;
let rules = compile_rules?;
let lines = vec!;
let evaluation = evaluate_lines;
println!;
println!;
println!;
println!;
Advanced Evaluation Entrypoints
evaluate_lines_with_overrides(...)evaluate_lines_with_overrides_and_language(...)
These are used by callers that provide compiled directory overrides or a forced language override for preprocessing/rule language filtering.
Language and Preprocessing
detect_language(&Path) -> Option<&'static str>Preprocessor+PreprocessOptionsfor masking comments and/or strings
Masking is intentionally heuristic and deterministic, not a full parser.
Suppression Directives
Supported inline suppressions include:
diffguard: ignore <rule_id>diffguard: ignore-next-line <rule_id>diffguard: ignore rule1, rule2diffguard: ignore *diffguard: ignore-all
Suppressed matches are tracked in VerdictCounts.suppressed.
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.