Expand description
Style lint rules (L-codes) and the unified check entry point.
Three diagnostic layers feed check:
- syntax —
crate::parse::parseP-codes (parse-layer diagnostics) - schema —
crate::validate::validateV-codes (SurfDoc::validate()) - style — the
LintRuleimplementations in this module (L-codes)
Rule metadata (default severity, fixability, message templates) is loaded
at compile time from spec/rules.toml via include_str!. The module is
wasm-clean: no filesystem access, no clock, no randomness. The
spec_compliance integration test asserts that the implemented rule set
and the registry match exactly.
Structs§
- Applied
Fix - A fix that was applied by
apply_fixes. - Check
Report - Result of running all three diagnostic layers over a source string.
- FixOutcome
- Result of
apply_fixes/apply_fixes_once. - Lint
Config - Configuration for
check_with: per-rule severity overrides and disabled rule ids. Applies to all three layers (P/V/L codes). - Rule
Meta - Metadata for a single lint rule, loaded from
spec/rules.toml. - Skipped
Fix - A fix that was skipped by
apply_fixes.
Constants§
- EXTRA_
KNOWN_ BLOCK_ NAMES - Parser-accepted names that are deliberately NOT in
spec/blocks.toml: sub-directives (column) and aliases/renderer families the parser resolves (action-items→ tasks,deck/slide,deploy_urls,info-card). L020 must not flag these. The spec_compliance test asserts none of them is in blocks.toml — once the spec registers one, remove it from this list. - JSON_
SCHEMA_ VERSION - Version of the JSON envelope schema emitted by
report_to_json/reports_to_json— and therefore bysurf-lint check --format jsonand the wasmcheck_jsonexport, which both serialize these values. - MAX_
FIX_ ITERATIONS - Maximum number of fix → re-check passes in
apply_fixes. - PARSE_
RULE_ IDS - Rule ids emitted by the parse layer (
src/parse.rs), pinned for the registry drift test intests/spec_compliance.rs.
Traits§
- Lint
Rule - A single style-layer lint rule.
Functions§
- all_
rules - All implemented style-layer rules, in rule-id order.
- apply_
fixes - Apply every auto-fix at or below the requested
safetytier, re-runningcheckafter each pass until no applicable fix remains (fixpoint) orMAX_FIX_ITERATIONSpasses were applied. - apply_
fixes_ once - Single-pass variant of
apply_fixes: applies at most one round of non-conflicting fixes without iterating to a fixpoint. Useful for callers that want to show intermediate states (e.g. a CLI--diffmode). - apply_
fixes_ with apply_fixeswith aLintConfig: disabled rules contribute no fixes, and config-suppressed diagnostics (e.g. P005 extra values) are likewise never “fixed”. Severity overrides do not change fix behaviour.- check
- Run all three diagnostic layers (parse, validate, lint) over
input. - check_
with checkwith severity overrides and disabled rules applied.- known_
block_ names - All block names registered in
spec/blocks.toml(any status). - report_
to_ json - Per-file object of the surf-lint JSON envelope.
- reports_
to_ json - Full surf-lint JSON envelope over
(path, report)pairs: - rule_
registry - The lint rule registry, keyed by rule id (
P001,L001, …). - rule_
registry_ total meta.total_rulesdeclared inspec/rules.toml.