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. "<metric> <value> exceeds limit <limit>",
with values 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.
Trait Implementations§
Source§impl Clone for OffenderRecord
impl Clone for OffenderRecord
Source§fn clone(&self) -> OffenderRecord
fn clone(&self) -> OffenderRecord
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OffenderRecord
impl Debug for OffenderRecord
Source§impl<'de> Deserialize<'de> for OffenderRecord
impl<'de> Deserialize<'de> for OffenderRecord
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for OffenderRecord
impl PartialEq for OffenderRecord
Source§fn eq(&self, other: &OffenderRecord) -> bool
fn eq(&self, other: &OffenderRecord) -> bool
self and other values to be equal, and is used by ==.