fast_yaml_linter/lib.rs
1//! YAML linter with rich diagnostics
2//!
3#![forbid(unsafe_code)]
4//!
5//! This crate provides a comprehensive YAML linting engine with:
6//! - Precise error location tracking (line, column, byte offset)
7//! - Rich diagnostic messages with source context
8//! - Pluggable rule system for extensibility
9//! - Multiple output formats (text, JSON, SARIF)
10//!
11//! # Examples
12//!
13//! ```
14//! use fast_yaml_linter::{Linter, TextFormatter, Formatter};
15//!
16//! let yaml = r#"
17//! name: John
18//! age: 30
19//! "#;
20//!
21//! let linter = Linter::with_all_rules();
22//! let diagnostics = linter.lint(yaml).unwrap();
23//!
24//! let formatter = TextFormatter::new();
25//! let output = formatter.format(&diagnostics, yaml);
26//! println!("{}", output);
27//! ```
28
29mod context;
30mod diagnostic;
31mod linter;
32mod location;
33mod severity;
34
35pub mod comment_parser;
36pub mod config;
37pub mod formatter;
38pub mod rules;
39pub mod source;
40pub mod tokenizer;
41
42pub use context::{LineMetadata, LintContext, SourceContext};
43pub use diagnostic::{
44 ContextLine, Diagnostic, DiagnosticBuilder, DiagnosticCode, DiagnosticContext, Suggestion,
45};
46pub use formatter::{Formatter, TextFormatter};
47pub use linter::{LintConfig, LintError, Linter};
48pub use location::{Location, Span};
49pub use severity::Severity;
50
51#[cfg(feature = "json-output")]
52pub use formatter::JsonFormatter;
53
54#[cfg(feature = "sarif-output")]
55pub use formatter::SarifFormatter;