Skip to main content

Crate pedant

Crate pedant 

Source
Expand description

An opinionated Rust linter with special focus on AI-generated code.

pedant catches patterns that compile but violate best practices: deep nesting, panic-prone calls, silenced warnings, dynamic dispatch, and mixed concerns.

§Quick start

use pedant::{lint_str, Config};

let config = Config::default();
let result = lint_str("fn f() { if true { if false {} } }", &config).unwrap();
assert!(!result.violations.is_empty());

Re-exports§

pub use analysis_result::AnalysisResult;
pub use checks::ALL_CHECKS;
pub use checks::CheckInfo;
pub use config::Cli;
pub use config::ConfigFile;
pub use config::NamingCheck;
pub use config::PatternCheck;
pub use config::PatternOverride;
pub use lint::Config;
pub use lint::LintError;
pub use lint::lint_file;
pub use lint::lint_str;
pub use reporter::OutputFormat;
pub use reporter::Reporter;
pub use violation::CheckRationale;
pub use violation::Violation;
pub use violation::ViolationType;
pub use violation::lookup_rationale;
pub use visitor::CheckConfig;
pub use visitor::analyze;

Modules§

analysis_result
Combined analysis result type.
checks
Check metadata catalog used by --list-checks and --explain.
config
CLI argument parsing and TOML config file loading.
hash
Source content hashing for attestation.
lint
Linting entry points and error types.
pattern
Glob-style pattern matching for AST node text.
reporter
Violation output formatting (text and JSON).
violation
Violation types, rationale, and the Violation struct.
visitor
AST visitor that performs all checks in a single pass.