Skip to content

Commit

Permalink
Merge pull request #35 from snyk/chore/debug
Browse files Browse the repository at this point in the history
fix: upgrade debug and skip some logging
  • Loading branch information
Amir Moualem committed Dec 19, 2019
2 parents d261c06 + 1ee77b9 commit 8ca0f2f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
6 changes: 4 additions & 2 deletions lib/filter/ignore.js
Expand Up @@ -56,8 +56,10 @@ function filterIgnored(ignore, vuln, filtered) {
}

if (pathMatch) {
debug('ignoring based on path match: %s ~= %s', path,
vuln.from.slice(1).join(' > '));
if (debug.enabled) {
debug('ignoring based on path match: %s ~= %s', path,
vuln.from.slice(1).join(' > '));
}
return true;
}

Expand Down
6 changes: 4 additions & 2 deletions lib/filter/notes.js
Expand Up @@ -44,8 +44,10 @@ function attachNotes(notes, vuln) {
if (pathMatch) {
// strip any control characters in the 3rd party reason file
var reason = rule[path].reason.replace('/[\x00-\x1F\x7F-\x9F]/u', '');
debug('adding note based on path match: %s ~= %s', path,
vuln.from.slice(1).join(' > '));
if (debug.enabled) {
debug('adding note based on path match: %s ~= %s', path,
vuln.from.slice(1).join(' > '));
}
vuln.note = 'Snyk policy in ' + rule[path].from +
' suggests ignoring this issue, with reason: ' + reason;
}
Expand Down
6 changes: 4 additions & 2 deletions lib/index.js
Expand Up @@ -93,8 +93,10 @@ function load(root, options) {

if (!ignorePolicy && Array.isArray(root)) {
return resolve(mergePolicies(root, options).then(function (res) {
debug('final policy:');
debug(JSON.stringify(res, '', 2));
if (debug.enabled) {
debug('final policy:');
debug(JSON.stringify(res, '', 2));
}
return res;
}));
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -22,7 +22,7 @@
"tap-only": "0.0.5"
},
"dependencies": {
"debug": "^3.1.0",
"debug": "^4.1.1",
"email-validator": "^2.0.4",
"js-yaml": "^3.13.1",
"lodash.clonedeep": "^4.5.0",
Expand Down

0 comments on commit 8ca0f2f

Please sign in to comment.