Socket
Socket
Sign inDemoInstall

snyk-gradle-plugin

Package Overview
Dependencies
Maintainers
1
Versions
141
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

snyk-gradle-plugin - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

.eslintrc

82

lib/gradle-dep-parser.js

@@ -10,3 +10,3 @@ var cloneDeep = require('clone-deep');

var depArray = createTree(
data.lines, data.omittedDeps, { from: [from] });
data.lines, data.omittedDeps, {from: [from]});
fillOmittedDependencies(depArray, data.omittedDeps);

@@ -20,50 +20,50 @@ var depTree = convertNodeArrayToObject(depArray);

var lines = text.split('\n')
.filter(function (element) {
.filter(function (element) {
// filter out stuff that isn't dependencies
return element.indexOf('\\---') !== -1 ||
return element.indexOf('\\---') !== -1 ||
element.indexOf('+---') !== -1 ||
element === '';
})
.reduce(function (acc, element) {
})
.reduce(function (acc, element) {
// only return the first configuration, in case there are multiple
if (acc.done) {
return acc;
}
if (element === '') {
if (acc.length > 0) {
acc.done = true;
if (acc.done) {
return acc;
}
if (element === '') {
if (acc.length > 0) {
acc.done = true;
}
return acc;
}
acc.push(element);
return acc;
}
acc.push(element);
return acc;
}, [])
.filter(function (element) {
}, [])
.filter(function (element) {
// filter out FAILED dependencies
return element.match(/ FAILED$/) === null;
})
.map(function (element) {
return element.match(/ FAILED$/) === null;
})
.map(function (element) {
// remove all hierarchy markings, but keep the hierarchy structure
element = element
.replace(/\|/g, ' ') // remove pipe symbol
.replace(/\\/g, '+') // convert all prefixes to '+---'
.replace(/\+\-\-\-/g, ' ') // remove all prefixes
.replace(/ /g, ' '); // convert each 5 spaces to 1 space
// update the element with its resolved version, if exists
var elementParts = element.split(' -> ');
if (elementParts.length > 1) {
element = element.replace(/[^:]*$/, elementParts[1]);
}
// mark omitted dependencies for later review,
// and remove the '(*)' at the end of the element
var omitStarSplit = element.split(' (*)');
if (omitStarSplit.length > 1) {
element = omitStarSplit[0];
var parts = element.split(':');
// omittedDeps key is 'groupId:artifactId' (without the version)
omittedDeps[parts[0].trim() + ':' + parts[1]] = true;
}
element = element
.replace(/\|/g, ' ') // remove pipe symbol
.replace(/\\/g, '+') // convert all prefixes to '+---'
.replace(/\+\-\-\-/g, ' ') // remove all prefixes
.replace(/ /g, ' '); // convert each 5 spaces to 1 space
// update the element with its resolved version, if exists
var elementParts = element.split(' -> ');
if (elementParts.length > 1) {
element = element.replace(/[^:]*$/, elementParts[1]);
}
// mark omitted dependencies for later review,
// and remove the '(*)' at the end of the element
var omitStarSplit = element.split(' (*)');
if (omitStarSplit.length > 1) {
element = omitStarSplit[0];
var parts = element.split(':');
// omittedDeps key is 'groupId:artifactId' (without the version)
omittedDeps[parts[0].trim() + ':' + parts[1]] = true;
}
return element;
});
return element;
});
return {

@@ -82,3 +82,3 @@ lines: lines,

function getElementAsObject(element, parentElement) {
function getElementAsObject(element) {
if (!element) {

@@ -85,0 +85,0 @@ return null;

@@ -9,7 +9,7 @@ module.exports = {

return text.split('\n')
.map(trim)
.filter(function (line) {
return line && line.length > ext.length &&
.map(trim)
.filter(function (line) {
return line && line.length > ext.length &&
line.substr(line.length - ext.length, ext.length) === ext;
});
});
}

@@ -16,0 +16,0 @@ return [];

@@ -18,44 +18,55 @@ var os = require('os');

function inspect(root, targetFile, options) {
if (!options) { options = { dev: false }; }
return getPackage(root, targetFile, options)
.then(function (pkg) {
if (!options) {
options = {dev: false};
}
var command = getCommand(root, targetFile);
var args = buildArgs(root, targetFile, options.args);
return getPackage(root, command, args)
.then(function (pkg) {
// opt-in with `jars` or `localjars` flag
if (options.jars || options.localjars) {
return getJarList(root, targetFile, options)
.then(function (jars) {
if (jars && jars.length) { pkg.jars = jars; }
return pkg;
});
}
return pkg;
})
.then(function (pkg) {
return {
plugin: {
name: 'bundled:gradle',
runtime: 'unknown',
},
package: pkg,
};
});
if (options.jars || options.localjars) {
return getJarList(root, targetFile, options)
.then(function (jars) {
if (jars && jars.length) {
pkg.jars = jars;
}
return pkg;
});
}
return pkg;
})
.then(function (pkg) {
return {
plugin: {
name: 'bundled:gradle',
runtime: 'unknown',
},
package: pkg,
};
})
.catch(function (error) {
error.message = error.message + '\n\n' +
'Please make sure that `' + command + ' ' + args.join(' ') +
'` executes successfully on this project.\n\n' +
'If the problem persists, collect the output of `' +
command + ' ' + args.join(' ') + '` and contact support@snyk.io\n';
throw error;
});
}
function getPackage(root, targetFile, options) {
return subProcess.execute(
getCommand(root, targetFile),
buildArgs(root, targetFile, options.args),
{ cwd: root })
.then(function (result) {
var packageName = path.basename(root);
var packageVersion = '0.0.0';
var from = packageName + '@' + packageVersion;
var depTree = depParser.parse(result, from);
return {
dependencies: depTree,
name: packageName,
version: packageVersion,
packageFormatVersion: packageFormatVersion,
from: [from],
};
});
function getPackage(root, command, args) {
return subProcess.execute(command, args, {cwd: root})
.then(function (result) {
var packageName = path.basename(root);
var packageVersion = '0.0.0';
var from = packageName + '@' + packageVersion;
var depTree = depParser.parse(result, from);
return {
dependencies: depTree,
name: packageName,
version: packageVersion,
packageFormatVersion: packageFormatVersion,
from: [from],
};
});
}

@@ -71,4 +82,4 @@

args,
{ cwd: root })
.then(jarParser.parse);
{cwd: root})
.then(jarParser.parse);
}

@@ -75,0 +86,0 @@

var childProcess = require('child_process');
module.exports.execute = function (command, args, options) {
var spawnOptions = { shell: true };
var spawnOptions = {shell: true};
if (options && options.cwd) {

@@ -14,8 +14,12 @@ spawnOptions.cwd = options.cwd;

var proc = childProcess.spawn(command, args, spawnOptions);
proc.stdout.on('data', function (data) { stdout = stdout + data; });
proc.stderr.on('data', function (data) { stderr = stderr + data; });
proc.stdout.on('data', function (data) {
stdout = stdout + data;
});
proc.stderr.on('data', function (data) {
stderr = stderr + data;
});
proc.on('close', function (code) {
if (code !== 0) {
return reject(stdout || stderr);
return reject(new Error(stdout || stderr));
}

@@ -22,0 +26,0 @@ resolve(stdout || stderr);

@@ -14,7 +14,7 @@ {

"scripts": {
"test": "npm run lint && npm run test-functional && npm run test-system",
"lint": "jscs `find ./lib -name '*.js'` -v && jscs `find ./test -name '*.js'` -v",
"test-functional": "tap `find ./test/functional -name '*.test.js'`",
"test-system": "tap --timeout=300 `find ./test/system -name '*.test.js'`",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
"test": "npm run lint && npm run test-functional",
"lint": "eslint -c .eslintrc lib test",
"test-functional": "tap -R spec ./test/functional/*.test.js",
"test-system": "tap -R spec ./test/system/*.test.js",
"semantic-release": "semantic-release"
},

@@ -24,6 +24,6 @@ "author": "snyk.io",

"devDependencies": {
"jscs": "^3.0.7",
"semantic-release": "^6.3.6",
"eslint": "^4.11.0",
"semantic-release": "^15",
"sinon": "^2.4.1",
"tap": "^10.3.2",
"tap": "^12.0.1",
"tap-only": "0.0.5"

@@ -34,3 +34,3 @@ },

},
"version": "1.3.0"
}
"version": "1.3.1"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc