in common/output.ts [75:104]
export function parseSarif(path: string, text: 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 problemDescriptions: ProblemDescriptor[] = []
if (run.results?.length) {
title = `${run.results.length} ${getProblemPlural(
run.results.length
)} found by `
problemDescriptions = run.results
.filter(
result =>
result.baselineState !== 'unchanged' &&
result.baselineState !== 'absent'
)
.map(result => parseResult(result, rules))
.filter((a): a is ProblemDescriptor => a !== null && a !== undefined)
}
const name = run.tool.driver.fullName || 'Qodana'
title += name
return {
title,
text: text,
summary: title,
problemDescriptions
}
}