-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
Allow programmatic usage #38
Comments
for now you can use program interface, but it is little bit poor, will add this request to plans |
The second argument in the |
It would be also nice to be able to remove files, so you can compare the duplication results of two different versions of your code files. Example: var Detector = require('jscpd').Detector;
var detector = new Detector();
// add files of version 1
detector.addFile('foo.js', 'console.log("hello world")');
detector.addFile('bar.js', 'console.log("hello world")');
detector.addFile('baz.js', 'console.log("hello world")');
var resultOfVersion1 = detector.run();
// apply changes for version 2
detector.addFile('bar.js', 'console.log("changed file")');
detector.removeFile('baz.js');
// don’t add 'foo.js' because it didn’t change
var resultOfVersion2 = detector.run();
console.log('Your code duplication increased/decreased by:', compareResults(resultOfVersion1, resultOfVersion2), 'percent'); |
https://github.com/kucherenko/jscpd/blob/master/docs/api.md New version of jscpd released and powerful API there |
Hi,
I would like to use
jscpd
programmatically where I can provide the file content instead of lettingjscpd
reading the file from the file-system.Background of this is, that I want to check files retrieved via the github API.
The API could look like this:
The text was updated successfully, but these errors were encountered: