Expand description
YAML linter with rich diagnostics
This crate provides a comprehensive YAML linting engine with:
- Precise error location tracking (line, column, byte offset)
- Rich diagnostic messages with source context
- Pluggable rule system for extensibility
- Multiple output formats (text, JSON, SARIF)
§Examples
use fast_yaml_linter::{Linter, TextFormatter, Formatter};
let yaml = r#"
name: John
age: 30
"#;
let linter = Linter::with_all_rules();
let diagnostics = linter.lint(yaml).unwrap();
let formatter = TextFormatter::new();
let output = formatter.format(&diagnostics, yaml);
println!("{}", output);Re-exports§
pub use formatter::Formatter;pub use formatter::TextFormatter;
Modules§
- comment_
parser - Comment detection and parsing utilities.
- config
- Rule configuration types and builders.
- formatter
- Diagnostic output formatters.
- rules
- Lint rules and rule registry.
- source
- Source code analysis and position mapping.
- tokenizer
- Flow collection tokenizer for identifying YAML syntax tokens.
Structs§
- Context
Line - A single line of source context.
- Diagnostic
- A diagnostic message with location and context.
- Diagnostic
Builder - Builder for creating diagnostics.
- Diagnostic
Code - Unique identifier for a diagnostic.
- Diagnostic
Context - Source code context for diagnostics.
- Line
Metadata - Pre-computed metadata about a line for efficient access.
- Lint
Config - Configuration for the linter.
- Lint
Context - Shared caching layer for linting operations.
- Linter
- The main linter.
- Location
- A position in the source file.
- Source
Context - Extracts source code context for diagnostics.
- Span
- A span of text in the source file.
- Suggestion
- A suggested fix for a diagnostic.