Skip to main content

plumb_core/
lib.rs

1//! # plumb-core
2//!
3//! Core types and the deterministic rule engine for Plumb.
4//!
5//! This crate is the foundation every other Plumb crate builds on. It
6//! defines the public [`Violation`] shape, the [`Rule`] trait, the
7//! [`Config`] schema, and the in-memory [`PlumbSnapshot`] type that rule
8//! engines evaluate.
9//!
10//! ## Determinism invariants
11//!
12//! `plumb-core` must produce byte-identical output across runs. The crate
13//! forbids `std::time::SystemTime::now` and `std::time::Instant::now` via
14//! `clippy::disallowed_methods`, never logs to stdout or stderr, and uses
15//! deterministic iteration order everywhere ([`indexmap`] instead of
16//! [`std::collections::HashMap`] for any observable output).
17//!
18//! See `docs/local/prd.md` §9 for the full invariant list.
19
20#![forbid(unsafe_code)]
21#![deny(missing_docs)]
22#![deny(clippy::print_stdout, clippy::print_stderr)]
23#![deny(clippy::unwrap_used, clippy::expect_used)]
24
25pub mod config;
26pub mod engine;
27pub mod report;
28pub mod rules;
29pub mod snapshot;
30pub mod telemetry;
31
32pub use config::{Config, IgnoreRule};
33pub use engine::{RunReport, apply_ignores, run, run_many, run_report};
34pub use report::{
35    Confidence, Fix, FixKind, Rect, RunId, Severity, ViewportKey, Violation, ViolationSink,
36};
37pub use rules::{Rule, RuleMetadata, builtin_rule_metadata, register_builtin};
38pub use snapshot::{PlumbSnapshot, SnapshotCtx, TextBox};