pub struct OffenderRecord {
pub path: PathBuf,
pub function: Option<String>,
pub start_line: u32,
pub end_line: u32,
pub start_col: Option<u32>,
pub metric: String,
pub value: f64,
pub limit: f64,
pub severity: Severity,
}Expand description
One metric-threshold violation, language-agnostic and format-agnostic.
Paths are stored as PathBuf so output writers can decide how to
surface non-UTF-8 components (skip, replace, or fail) rather than
silently lossy-converting.
Fields§
§path: PathBufSource file the violation was reported against.
function: Option<String>Function or method name; None for file-level violations.
start_line: u32First line covered by the violation (1-based).
end_line: u32Last line covered by the violation (1-based, inclusive).
start_col: Option<u32>Optional starting column (1-based).
metric: StringMetric identifier, e.g. "cyclomatic", "loc.lloc",
"halstead.volume".
value: f64Observed metric value.
limit: f64Configured threshold the value exceeded.
severity: SeveritySeverity assigned by the threshold engine.
Implementations§
Source§impl OffenderRecord
impl OffenderRecord
Sourcepub fn default_message(&self) -> String
pub fn default_message(&self) -> String
Default human-readable message used by formats that do not carry
their own templating. Renders "<metric> <value> exceeds limit <limit>" for higher-is-worse metrics and "<metric> <value> falls below limit <limit>" for the lower-is-worse mi.* family
(#698) — the breach phrasing must match the direction the
metric_catalog records, or an MI
offender (value below the limit) reads as “exceeds” in
Checkstyle / Clang / MSVC / SARIF output. An unknown metric id
falls back to the higher-is-worse phrasing.
Values are formatted via MessageMetric: integer fast-path for
safe integers, six-decimal rounding for non-integer finites,
"NaN" / "inf" / "-inf" for non-finite values. The Display
adapter writes directly into the format buffer, so this builds
one String per call rather than three.