danielstjules / jsinspect

Detect copy-pasted and structurally similar code
MIT License
3.56k stars 128 forks source link

Ability to define files to report #68

Open jalooc opened 6 years ago

jalooc commented 6 years ago

What I would love to see in this great lib is the ability to define what files to report.

I don't mean what we already have under the ignore option, let me explain on an example: In my CI, on some feature-branch, I would like to inspect only the files that were altered in that branch. I could run jsinspect with ignore option, passing the list of files returned from git diff, but then jsinspect wouldn't find files that have code similar to files that were unchanged.

So one solution that came to my mind would be to add an option like reportOnly. In that case I wouldn't use the ignore option (so that all the repo would be analysed), but I would get errors only for repetitions that occurred in the files passed to reportOnly (== at least one of the files containing a repetition would be on that list).