Skip to content

Commit

Permalink
fix(parseable): add support for more resolves on update/install action
Browse files Browse the repository at this point in the history
Add support for multiple resolves on the same update/install action. Re 
comment: it seems not to be true.

See https://npm.community/t/1419
  • Loading branch information
larsgw committed Aug 15, 2018
1 parent 3194e50 commit 1c6156b
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions reporters/parseable.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,18 @@ const report = function (data, options) {
l.recommendation = recommendation.cmd
l.breaking = recommendation.isBreaking ? 'Y' : 'N'

// TODO: Verify: The advisory seems to repeat and be the same for all the 'resolves'. Is it true?
const advisory = data.advisories[action.resolves[0].id]
l.sevLevel = advisory.severity
l.severity = advisory.title
l.package = advisory.module_name
l.moreInfo = `https://nodesecurity.io/advisories/${advisory.id}`
l.path = action.resolves[0].path

accumulator[advisory.severity] += [action.action, l.package, l.sevLevel, l.recommendation, l.severity, l.moreInfo, l.path, l.breaking]
action.resolves.forEach((resolution) => {
const advisory = data.advisories[resolution.id]

l.sevLevel = advisory.severity
l.severity = advisory.title
l.package = advisory.module_name
l.moreInfo = `https://nodesecurity.io/advisories/${advisory.id}`
l.path = resolution.path

accumulator[advisory.severity] += [action.action, l.package, l.sevLevel, l.recommendation, l.severity, l.moreInfo, l.path, l.breaking]
.join('\t') + '\n'
}) // forEach resolves
}

if (action.action === 'review') {
Expand Down

0 comments on commit 1c6156b

Please sign in to comment.