Skip to main content

write_clone_coupling_sarif

Function write_clone_coupling_sarif 

pub fn write_clone_coupling_sarif<W: Write>(
    rows: &[CloneCouplingRow],
    repo_root: &str,
    w: &mut W,
) -> Result<()>
Expand description

Emit a SARIF 2.1.0 document for live clone-coupling findings.

Schema per the research brief:

  • One SARIF result per (clone_group_id, file_a, file_b) pair.
  • locations[0] = higher-support_a partner (the more-frequently-changed file); locations[1] = lower partner. Matches GitHub Code Scanning’s “first location is primary” rendering convention.
  • partialFingerprints keys: cloneGroupFingerprint/v1 (AST digest) + filePairHash/v1 (sha256 of sorted file pair).
    • properties.security-severity derived from combined_score * 10 (0-10 scale per SARIF spec §3.27.17). Live clones get higher severity than the bare CODELORE-CLONE rule because the co-change signal proves this is real debt, not dead lookalike code.