Skip to main content

Module model

Module model 

Source
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 where predicate on a captured metavar. Exactly one of regex / comparison / pattern / resolves_to / type is set.
ReplaceOp
Regex find/replace transform op.
ResolvedBindingConstraint
A Harn resolved-binding predicate for Constraint::resolves_to.
Rule
A single declarative rule.
RuleNode
The atomic-tier matcher. Exactly one of pattern / kind / regex must be set on a node that carries one; RuleNode::atomic resolves it.
SubstringOp
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).
AtomicMatcher
The resolved, exactly-one atomic matcher.
ConvertOp
Case-conversion transform op.
RuleKind
What flavor of work a rule performs, derived from its shape rather than declared: a rule with a fix is a codemod; one with a message but no fix is a lint; a bare matcher is a search.
Safety
How risky a rule’s fix is, mapped onto Burin’s edit-safety taxonomy. Ordered least → most dangerous; the codemod runner auto-applies only the two safest tiers (see Safety::applicability).
Severity
Diagnostic severity. Mirrors the harn-lint vocabulary 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.
StopKeyword
The keyword forms of StopBy.