Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to filter report #79

Merged
merged 16 commits into from Mar 4, 2019

simplify loop code

  • Loading branch information...
Raynos committed Mar 1, 2019
commit 3b8bf755bdec7cb478fe8a724f5651fef3cb1139
Copy path View file
@@ -90,14 +90,9 @@ function filterReport (report, options) {

if (options.filterCompliance) {
for (const pkg of report) {
let hasComplianceFailure = false
for (const score of pkg.scores) {
if (score.group === 'compliance' && !score.pass) {
hasComplianceFailure = true
break
}
}

let hasComplianceFailure = pkg.scores.some(

This comment has been minimized.

Copy link
@juliangruber

juliangruber Mar 3, 2019

Member
Suggested change
let hasComplianceFailure = pkg.scores.some(
const hasComplianceFailure = pkg.scores.some(
s => s.group === 'compliance' && !s.pass
)
if (hasComplianceFailure) {
out.push(pkg)
}
@@ -106,22 +101,12 @@ function filterReport (report, options) {

if (options.filterSecurity) {
for (const pkg of report) {
let hasSecurityFailure = false
if (!pkg.failures) {
continue
}
for (const failure of pkg.failures) {
if (failure.group === 'security' && (
failure.severity === 'LOW' ||
failure.severity === 'MEDIUM' ||
failure.severity === 'HIGH' ||
failure.severity === 'CRITICAL'
)) {
hasSecurityFailure = true
break
}
}

let hasSecurityFailure = pkg.failures.some(

This comment has been minimized.

Copy link
@juliangruber

juliangruber Mar 3, 2019

Member
Suggested change
let hasSecurityFailure = pkg.failures.some(
const hasSecurityFailure = pkg.failures.some(
f => f.group === 'security' && f.severity !== 'NONE'
)
if (hasSecurityFailure) {
out.push(pkg)
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.