Skip to main content

pedant/
lib.rs

1//! An opinionated Rust linter with special focus on AI-generated code.
2//!
3//! pedant catches patterns that compile but violate best practices: deep nesting,
4//! panic-prone calls, silenced warnings, dynamic dispatch, and mixed concerns.
5//!
6//! # Quick start
7//!
8//! ```
9//! use pedant::{lint_str, Config};
10//!
11//! let config = Config::default();
12//! let result = lint_str("fn f() { if true { if false {} } }", &config).unwrap();
13//! assert!(!result.violations.is_empty());
14//! ```
15
16/// Combined analysis result type.
17pub mod analysis_result;
18/// Capability detection via use-path and call-site analysis.
19pub(crate) mod capability_visitor;
20/// Check metadata catalog used by `--list-checks` and `--explain`.
21pub mod checks;
22/// CLI argument parsing and TOML config file loading.
23pub mod config;
24/// Source content hashing for attestation.
25pub mod hash;
26/// JSON serialization types for violation output.
27pub(crate) mod json_format;
28/// Linting entry points and error types.
29pub mod lint;
30/// Glob-style pattern matching for AST node text.
31pub mod pattern;
32/// Violation output formatting (text and JSON).
33pub mod reporter;
34/// Violation types, rationale, and the `Violation` struct.
35pub mod violation;
36/// AST visitor that performs all checks in a single pass.
37pub mod visitor;
38
39pub use analysis_result::AnalysisResult;
40pub use checks::{ALL_CHECKS, CheckInfo};
41pub use config::{Cli, ConfigFile, NamingCheck, PatternCheck, PatternOverride};
42pub use lint::{Config, LintError, lint_file, lint_str};
43pub use reporter::{OutputFormat, Reporter};
44pub use violation::{CheckRationale, Violation, ViolationType, lookup_rationale};
45pub use visitor::{CheckConfig, analyze};