SARIF¶
Source files¶
codeclone/report/renderers/sarif.pycodeclone/report/document/builder.pycodeclone/report/findings.py
Design model¶
CodeClone builds SARIF from the already materialized canonical report document. It does not recompute analysis in the SARIF layer.
That means:
- finding identities come from canonical finding IDs
- severity/confidence/category data comes from canonical report payloads
- SARIF ordering remains deterministic
Path model¶
To improve IDE and code-scanning integration, SARIF uses repo-relative paths
anchored through %SRCROOT%.
Current behavior:
run.originalUriBaseIds["%SRCROOT%"]points at the scan root when knownrun.artifacts[*]enumerates referenced filesartifactLocation.uriuses repository-relative pathsartifactLocation.indexaligns locations with artifacts for stable linkingrun.invocations[*].workingDirectorymirrors the scan root URI when availablerun.automationDetails.idis unique per run
Result model¶
Current SARIF output includes:
tool.driver.rules[*]with stable rule IDs and help linksresults[*]for clone groups, dead code, design findings, and structural findingslocations[*]with primary file/line mappingrelatedLocations[*]for multi-location findingspartialFingerprints.primaryLocationLineHashfor stable per-location identity- explicit
kind: "fail"on results
Coverage Join may materialize coverage design findings only when the canonical
report already contains valid metrics.families.coverage_join facts.
Validation and tests¶
Relevant tests:
tests/test_report.pytests/test_report_contract_coverage.pytests/test_report_branch_invariants.py
Contract-adjacent coverage includes:
- reuse of the canonical report document
- stable SARIF branch invariants
- deterministic artifacts/rules/results ordering