Skip to content

Commit

Permalink
Fix Invalid Array Length error when severity_threshold exceeded
Browse files Browse the repository at this point in the history
  • Loading branch information
frankgrimes97 committed Aug 30, 2024
1 parent f17494a commit 34440ae
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,11 @@ async function run(): Promise<void> {
}
}
if (vulnidColorized.length > 0 && vulnsevColorized.length > 0) {
const pkgTxt = `${chalk.magenta(v.PkgName)}${new Array(40 - chalk.magenta(v.PkgName).length).join(' ')}`;
const vulnidTxt = `${vulnidColorized}${new Array(40 - vulnidColorized.length).join(' ')}`;
const vulnsevTxt = `${vulnsevColorized}${new Array(30 - vulnsevColorized.length).join(' ')}`;
const pkgTextPadding = Math.max(40 - v.PkgName.length, 0);
const pkgTxt = `${chalk.magenta(v.PkgName)}${new Array(pkgTextPadding).join(' ')}`;
const vulnidTxtPadding = Math.max(40 - v.VulnerabilityID.length, 0);
const vulnidTxt = `${vulnidColorized}${new Array(vulnidTxtPadding).join(' ')}`;
const vulnsevTxtPadding = Math.max(30 - v.Severity.length, 0);
res.unhealthyMsg = `${pkgTxt} ${vulnidTxt} ${vulnsevTxt} ${v.Title}`;
isUnhealthy = true;
}
Expand Down

0 comments on commit 34440ae

Please sign in to comment.