Skip to content

Commit 0b0535e

Browse files
authored
fix: generate correct sarif for scan result without vulns (#68)
1 parent 062c8a8 commit 0b0535e

File tree

4 files changed

+5248
-312
lines changed

4 files changed

+5248
-312
lines changed

src/sarif.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export function generateSARIFReport(data: Report, groupByPackage: boolean) {
5353
fs.writeFileSync("./sarif.json", JSON.stringify(sarifOutput, null, 2));
5454
}
5555

56-
function vulnerabilities2SARIF(data: Report, groupByPackage: boolean) {
56+
export function vulnerabilities2SARIF(data: Report, groupByPackage: boolean) {
5757
let rules: SARIFRule[] = [];
5858
let results: SARIFResult[] = [];
5959

@@ -63,10 +63,6 @@ function vulnerabilities2SARIF(data: Report, groupByPackage: boolean) {
6363
[rules, results] = vulnerabilities2SARIFRes(data)
6464
}
6565

66-
if (!rules.length || !results.length) {
67-
return {};
68-
}
69-
7066
const runs = [{
7167
tool: {
7268
driver: {

0 commit comments

Comments
 (0)