Expand description
Analysis engine for pedant: IR extraction, capability detection, and style checks.
pedant-core provides the core analysis pipeline without CLI dependencies.
It presents two surfaces over one module tree, selected by feature.
The substrate is present in every configuration. It answers factual
questions about source text: ir extracts facts, capabilities resolves
them to capabilities, and hash, pattern, and workspace support
them. No substrate entry point accepts policy input.
The judgment surface sits behind the checks feature, which is on by
default. It answers acceptability questions and owns every type whose shape
is determined by an opinion: the check catalog, the gate rules engine, check
configuration, violations, and the orchestrating lint entry points. A
consumer that wants facts without opinions takes default-features = false.
semantic is a third, orthogonal axis. It combines with either surface, and
enabling checks does not enable it.
§Quick start
use pedant_core::capabilities::detect_capabilities;
use pedant_core::ir::extract;
use pedant_types::Capability;
let syntax = syn::parse_file("use std::fs;").expect("source parses");
let ir = extract("example.rs", &syntax, None);
let profile = detect_capabilities(&ir, None);
assert_eq!(profile.findings[0].capability, Capability::FileRead);Re-exports§
pub use analysis_result::AnalysisResult;pub use check_config::CheckConfig as Config;pub use check_config::ConfigFile;pub use check_config::GateConfig;pub use check_config::GateRuleOverride;pub use check_config::NamingCheck;pub use check_config::PatternCheck;pub use check_config::PatternOverride;pub use checks::ALL_CHECKS;pub use checks::CheckInfo;pub use gate::GateInputSummary;pub use gate::GateRuleInfo;pub use gate::GateSeverity;pub use gate::GateVerdict;pub use gate::all_gate_rules;pub use gate::evaluate_gate_rules;pub use lint::LintError;pub use lint::analyze;pub use lint::analyze_build_script;pub use lint::analyze_build_script_with_shape;pub use lint::analyze_with_build_script;pub use lint::analyze_with_shape;pub use lint::determine_analysis_tier;pub use lint::discover_build_script;pub use lint::discover_crate_root;pub use lint::discover_workspace_root;pub use lint::lint_file;pub use lint::lint_str;pub use violation::CheckRationale;pub use violation::Violation;pub use violation::ViolationType;pub use violation::lookup_rationale;pub use workspace::WorkspaceMemberError;pub use workspace::resolve_workspace_members;pub use ir::semantic::FunctionAnalysisSummary;pub use ir::semantic::SemanticContext;pub use ir::semantic::SemanticFileAnalysis;
Modules§
- analysis_
result - Violations + capabilities produced by a single analysis run.
- capabilities
- Path-based capability detection over extracted IR facts.
- check_
config .pedant.tomlschema, loading, and per-path override resolution.- checks
- Check catalog: metadata, rationale, and the
ViolationTypeenum. - gate
- Security gate rules that fire on suspicious capability combinations. Gate rules engine: evaluates capability profiles and data flows against security rules.
- hash
- SHA-256 hashing of source contents for attestation.
- ir
- Intermediate representation extracted from the AST in one pass.
- json_
format - JSON serialization for machine-readable violation output.
- lint
- High-level analysis entry points and error types.
- pattern
- Glob and wildcard matching for AST node text and file paths.
- project
- Whole-workspace structural checks over the file tree and Cargo metadata.
- style
- Style checks that consume IR facts and produce violations.
- violation
- The
Violationtype, display formatting, and check rationale. - workspace
- Cargo workspace member expansion helpers shared by CLI consumers.
Structs§
- Parse
Error - Alias for
syn::Error, used by consumers that parse source themselves. Error returned when a Syn parser cannot parse the input tokens.