Skip to main content

Module linter

Module linter 

Source
Expand description

Core types for the lint engine: rule definitions, error reporting, and fix proposals.

This module contains the fundamental abstractions used by both native Rust rules (in src/rules/) and WASM plugin rules:

  • LintRule — trait that every rule implements
  • LintError — a single diagnostic produced by a rule
  • Severity — error vs. warning classification
  • Fix — an auto-fix action attached to a diagnostic
  • Linter — collects rules and runs them against a parsed config

Structs§

Fix
Represents a fix that can be applied to resolve a lint error
FixApplyResult
Result of applying fixes to content, with detailed counts.
LintError
A single lint diagnostic produced by a rule.
Linter
Container that holds LintRules and runs them against a parsed config.

Enums§

Severity
Severity level of a lint diagnostic.

Constants§

RULE_CATEGORIES
Display-ordered list of rule categories for UI output.

Traits§

LintRule
A lint rule that can be checked against a parsed nginx configuration.

Functions§

apply_fixes_to_content
Apply fixes to content string.
apply_fixes_to_content_detailed
Apply fixes to content string, reporting skipped fixes.
compute_line_starts
Compute the byte offset of the start of each line (1-indexed).
normalize_line_fix
Convert a line-based Fix into an offset-based one using precomputed line starts.
run_rule
Run a single rule, dispatching to LintRule::check_shared with one lazily-created Arc<Config> for rules that want a shared handle, and to LintRule::check otherwise.
run_rule_with_content
Like run_rule, but additionally dispatches to LintRule::check_with_content for rules that want raw content, so those rules don’t have to re-read the file from disk when the caller already has it in memory. Falls back to run_rule’s dispatch policy otherwise.