Skip to main content

Module sarif

Module sarif 

Expand description

SARIF 2.1.0 emitter for hotspot results — Behavioral SARIF taxonomy (spec §5.4).

Rule CODELORE-HOTSPOT: properties.tags includes “behavioral” and “hotspot” security-severity proxy: (100 − cognitive_health) / 10 partialFingerprints for stable identity across CI runs.

Constants§

SARIF_SCHEMA_URL
SARIF 2.1.0 JSON schema URL. All emitters (including the diff emitter in codelore-cli) reference this constant so that a future URL change only needs to be made in one place.
TOOL_INFO_URI
Canonical project homepage. Surfaces in every SARIF report’s tool.driver.informationUri — GitHub Code Scanning links the driver name in the tool-details panel here. Shared with the diff SARIF emitter via codelore_lib::output::sarif::TOOL_INFO_URI.

Functions§

diff_finding_hash
The partialFingerprints.diffFinding/v1 value for a codelore diff result: sha256("<rule>|<path>|<discriminant>").
evidence_attachments
Wrap pre-built evidence location objects into the two SARIF attachment shapes GitHub reads: codeFlows (each location wrapped in {"location": …} inside a single threadFlow) and relatedLocations (the plain location array). Returns (codeFlows, relatedLocations).
evidence_location
Build one evidence-commit location object: a physicalLocation whose artifactLocation.uri is the percent-encoded path (leading / trimmed, per RFC 3986 §4.1 so Code Scanning accepts the URI), plus the caller’s message. When with_region is set the location carries region.startLine = 1 — the diff emitter anchors evidence at line 1 because it has no per-commit line span; the check emitter omits the region entirely.
primary_location_line_hash
The partialFingerprints.primaryLocationLineHash value for a finding at path under repo_root: sha256("<repo_root>|<path>").
write_check_sarif
Emit a SARIF 2.1.0 document for quality-gate violations to w.
write_clone_coupling_sarif
Emit a SARIF 2.1.0 document for live clone-coupling findings.
write_clones_sarif
Emit a SARIF 2.1.0 document for clone families to w.
write_hotspots_sarif
Emit a SARIF 2.1.0 document for rows to w.