Comments (4)
for now you can use program interface, but it is little bit poor, will add this request to plans
from jscpd.
The second argument in the addFile
method be the contents of the file, right? Then maybe rename it to something more generic to make it clear this is not reading a file, but expecting a string? If it should work on large codebases, maybe instead of strings also consider a stream interface that could then either have files or any other source. Otherwise 👍 on this.
from jscpd.
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');
from jscpd.
https://github.com/kucherenko/jscpd/blob/master/docs/api.md
New version of jscpd released and powerful API there
from jscpd.
Related Issues (20)
- If the path is an absolute path, it cannot be detected HOT 6
- --format Invalid Configuration HOT 3
- "pattern" takes precedence over "ignore" HOT 2
- npmjs description not accurate
- The tokens field in duplicates is always zero HOT 1
- Adding Purescript as a supported language to jscpd
- "ignore" does not work with relative paths that don't start with a wildcard glob
- consoleFull/html reporter shows wrong code block than line number gives HOT 1
- compare a file with a directory HOT 2
- 查重
- More documentation on building, running, and debugging HOT 1
- Astro Support HOT 2
- Please add ColdFusion / CFML language support HOT 3
- Able to compare two project between them HOT 1
- Readable report with code extract HOT 1
- Sort output with respect to number of duplicate lines detected HOT 3
- PHP Multiline strings causing line number to be reported incorrectly
- Does jscpd support synchronization methods ? HOT 1
- Npm i fails during install through pre-commit hook HOT 6
- Skip files larger than a certain size HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jscpd.