in scan/src/annotations.ts [163:192]
export function parseSarif(path: string): Output {
const sarif: Log = JSON.parse(
fs.readFileSync(path, {encoding: 'utf8'})
) as Log
const run = sarif.runs[0]
const rules = parseRules(run.tool)
let title = 'No new problems found by '
let annotations: Annotation[] = []
if (run.results?.length) {
annotations = run.results
.filter(
result =>
result.baselineState !== 'unchanged' &&
result.baselineState !== 'absent'
)
.map(result => parseResult(result, rules))
.filter((a): a is Annotation => a !== null && a !== undefined)
title = `${annotations.length} ${getProblemPlural(
annotations.length
)} found by `
}
const name = run.tool.driver.fullName || 'Qodana'
title += name
return {
title,
text: getQodanaHelpString(),
summary: title,
annotations
}
}