Expand description
The declarative rule data model.
A rule is the atomic unit the engine consumes: an identity (id,
language, severity, message), a rule block describing what to
match (the atomic tier: pattern snippet, kind, or regex), and an
optional fix describing how to rewrite it. Relational/composite
matching (#2833) and where/transform (#2834) extend this model;
this module is the atomic-tier surface they build on.
Structs§
- Comparison
- A numeric/string comparison for a
Constraint. - Constraint
- A
wherepredicate on a captured metavar. Exactly one ofregex/comparison/pattern/resolves_to/typeis set. - Replace
Op - Regex find/replace transform op.
- Resolved
Binding Constraint - A Harn resolved-binding predicate for
Constraint::resolves_to. - Rule
- A single declarative rule.
- Rule
Node - The atomic-tier matcher. Exactly one of
pattern/kind/regexmust be set on a node that carries one;RuleNode::atomicresolves it. - Substring
Op - Character-slice transform op. Indices are 0-based char offsets; a negative or omitted bound clamps to the string end.
- Transform
- A metavar transform: read
source, apply exactly one operation, bind the result under a new metavar name (the map key).
Enums§
- Applicability
- Whether a fix may be auto-applied (clippy/ESLint
machine-applicable) or is opt-in only (suggestion). - Atomic
Matcher - The resolved, exactly-one atomic matcher.
- Convert
Op - Case-conversion transform op.
- Rule
Kind - What flavor of work a rule performs, derived from its shape rather than
declared: a rule with a
fixis a codemod; one with amessagebut nofixis a lint; a bare matcher is a search. - Safety
- How risky a rule’s
fixis, mapped onto Burin’s edit-safety taxonomy. Ordered least → most dangerous; the codemod runner auto-applies only the two safest tiers (seeSafety::applicability). - Severity
- Diagnostic severity. Mirrors the
harn-lintvocabulary so findings can flow into the same reporting surface. - StopBy
- How far a relational op (
inside/has/follows/precedes) walks the tree looking for a match. - Stop
Keyword - The keyword forms of
StopBy.