Skip to content

Commit

Permalink
fix: generate correct sarif for scan result without vulns
Browse files Browse the repository at this point in the history
  • Loading branch information
tembleking committed Feb 12, 2025
1 parent 062c8a8 commit 3fed416
Show file tree
Hide file tree
Showing 4 changed files with 5,248 additions and 312 deletions.
6 changes: 1 addition & 5 deletions src/sarif.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function generateSARIFReport(data: Report, groupByPackage: boolean) {
fs.writeFileSync("./sarif.json", JSON.stringify(sarifOutput, null, 2));
}

function vulnerabilities2SARIF(data: Report, groupByPackage: boolean) {
export function vulnerabilities2SARIF(data: Report, groupByPackage: boolean) {
let rules: SARIFRule[] = [];
let results: SARIFResult[] = [];

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

if (!rules.length || !results.length) {
return {};
}

const runs = [{
tool: {
driver: {
Expand Down
Loading

0 comments on commit 3fed416

Please sign in to comment.