Skip to main content

dpp_rules/lint/
types.rs

1//! Shared lint finding types.
2
3use alloc::string::String;
4
5/// How strongly a lint finding should be read. Never blocking either way —
6/// the distinction is tone, not gating. Lints are informative only.
7#[derive(Debug, Clone, Copy, PartialEq, Eq)]
8pub enum LintSeverity {
9    /// A data point that is very likely a mistake (e.g. a unit-conversion
10    /// mismatch between two fields describing the same physical quantity).
11    Warning,
12    /// A softer signal — plausible but worth a second look (e.g. a claim
13    /// with no supporting field, or a value near a physically wide bound).
14    Notice,
15}
16
17/// A single plausibility finding. Phrased as a question, never a verdict —
18/// callers should render `message` as-is.
19#[derive(Debug, Clone, PartialEq)]
20pub struct LintFinding {
21    /// Stable machine-readable code, e.g. `"battery.energy_capacity_mismatch"`.
22    pub code: &'static str,
23    /// camelCase field locator this finding is primarily about.
24    pub field: &'static str,
25    pub severity: LintSeverity,
26    /// Human-readable finding, phrased as a question.
27    pub message: String,
28}