Skip to main content

to_sarif

Function to_sarif 

Source
pub fn to_sarif(report: &Report) -> String
Available on crate feature sarif only.
Expand description

Render report as a SARIF 2.1.0 document.

ยงExample

use dev_report::{CheckResult, Report, Severity};

let mut r = Report::new("crate", "0.1.0").with_producer("dev-bench");
r.push(CheckResult::fail("oops", Severity::Error).with_detail("explodes"));

let sarif = dev_report::sarif::to_sarif(&r);
assert!(sarif.contains("\"version\": \"2.1.0\""));
assert!(sarif.contains("\"ruleId\": \"oops\""));