Skip to main content

Module lint

Module lint 

Source
Expand description

AST surface that harn-lint consumes to enforce .harn.prompt drift-prevention rules (#1669).

The template parser and AST are otherwise internal — exposing a shallow read-only view through this module keeps the lint crate free of template-engine internals while still giving rules enough structure to walk conditionals, sections, and includes.

Structs§

IfBranch

Enums§

ConditionShape
Coarse classification of an {{ if expr }} condition. The lint rules don’t need to evaluate or fully reconstruct expressions — just enough structure to detect the two failure patterns called out in #1669:
IdentityField
LintConstruct
One lintable construct, materialized in source order so rules can reason about counts (e.g. branch-explosion) and individual call sites (e.g. provider-identity comparisons).

Functions§

parse
Parse a template source string into a flat list of lintable constructs (conditionals + sections). Returns Err when the template doesn’t parse — callers should surface the underlying validate_template_syntax error to the user before linting.