pub struct Finding {
pub check_id: String,
pub code: String,
pub severity: FindingSeverity,
pub title: String,
pub message: String,
pub location: Option<FindingLocation>,
pub evidence: Option<Value>,
pub docs_url: Option<String>,
pub fingerprint: Option<String>,
}Expand description
A finding reported by the sensor.
Findings use a (check_id, code) tuple for identity. Combined with
tool.name this forms the triple (tool, check_id, code) used for
buildfix routing and cockpit policy (e.g., ("tokmd", "risk", "hotspot")).
Fields§
§check_id: StringCheck category (e.g., “risk”, “contract”, “gate”).
code: StringFinding code within the category (e.g., “hotspot”, “coupling”).
severity: FindingSeveritySeverity level.
title: StringShort title for the finding.
message: StringDetailed message describing the finding.
location: Option<FindingLocation>Source location (if applicable).
evidence: Option<Value>Additional evidence data.
docs_url: Option<String>Documentation URL for this finding type.
fingerprint: Option<String>Stable identity fingerprint for deduplication and buildfix routing. BLAKE3 hash of (tool_name, check_id, code, location.path).
Implementations§
Source§impl Finding
impl Finding
Sourcepub fn new(
check_id: impl Into<String>,
code: impl Into<String>,
severity: FindingSeverity,
title: impl Into<String>,
message: impl Into<String>,
) -> Finding
pub fn new( check_id: impl Into<String>, code: impl Into<String>, severity: FindingSeverity, title: impl Into<String>, message: impl Into<String>, ) -> Finding
Create a new finding with required fields.
Sourcepub fn with_location(self, location: FindingLocation) -> Finding
pub fn with_location(self, location: FindingLocation) -> Finding
Add a location to the finding.
Sourcepub fn with_evidence(self, evidence: Value) -> Finding
pub fn with_evidence(self, evidence: Value) -> Finding
Add evidence to the finding.
Sourcepub fn with_docs_url(self, url: impl Into<String>) -> Finding
pub fn with_docs_url(self, url: impl Into<String>) -> Finding
Add a documentation URL to the finding.
Sourcepub fn compute_fingerprint(&self, tool_name: &str) -> String
pub fn compute_fingerprint(&self, tool_name: &str) -> String
Compute a stable fingerprint from (tool_name, check_id, code, path).
Returns first 16 bytes (32 hex chars) of a BLAKE3 hash for compactness.
Sourcepub fn with_fingerprint(self, tool_name: &str) -> Finding
pub fn with_fingerprint(self, tool_name: &str) -> Finding
Auto-compute and set fingerprint. Builder pattern.