master
John Lauer Honest DRC/ERC reports: derive counts from native findings, exit 5 on error findings, ERC coordinate-scale check, load… fa1d9ce 1mo ago
//! Honest reading of native `kicad-cli` DRC / ERC JSON.
//!
//! Three jobs, all pure functions over bytes the caller already holds:
//!
//! - [`summary`]: the documented COUNT POLICY. kicad-cli's JSON carries no
//!   precomputed totals, so callers that look for `errors` / `count` keys
//!   print zeros next to real violations (adom/service-kicad#3). Counts are
//!   derived from every native finding collection, by severity, and a DRC /
//!   ERC pass is stated explicitly and separately from HTTP success.
//! - [`erc_scale`]: an input-relative sanity check for ERC item positions.
//!   KiCad 10.0's `ERC_REPORT::WriteJsonReport` builds its units provider
//!   with `pcbIUScale` (1e6 IU/mm) while the schematic is stored at
//!   `schIUScale` (1e4 IU/mm), so JSON positions come out 100x too small
//!   (adom/service-kicad#2). The check reports the factor; nothing is
//!   rescaled.
//! - [`sexpr`]: a tiny s-expression reader used both for the scale check and
//!   for diagnosing files kicad-cli refuses with a bare "Failed to load".
pub mod erc_scale;
pub mod sexpr;
pub mod summary;

pub use erc_scale::{check_erc_scale, ScaleCheck};
pub use sexpr::{diagnose, Node};
pub use summary::{Hint, ReportKind, Summary};