I build my project via grunt. I want to add grunt-jscpd task there. I couldn't run it via grunt. I created next .cpd.yaml file in the same directory where placed Gruntfile.js:
#.cpd.yaml
path:
- src/main/webapp/js/accounts/
languages:
- javascript
exclude:
- "**/node_modules/**"
When I run next commant "jscpd --languages js" from the directory where placed Gruntfile.js, jscpd works correctly and I see result:
info: Files search time: duration=58ms
info: Scaning 74 files for duplicates...
info: Scaning for duplicates time: duration=1674ms
info: Scaning... done!
info: Start report generation...
info: Found 7 exact clones with 120 duplicated lines in 10 files
...
3.54% (120 lines) duplicated lines out of 3393 total lines of code.
But when I run it via grunt, jscpd doesn't check my code (I run "grunt jscpd" command). Here result of it:
Running "jscpd:js" (jscpd) task
[Function: jscpd]
Used config from ../cm-html/.cpd.yaml
Scaning... done!
Found 0 exact clones with 0 duplicated lines in 0 files
100.00% (0 lines) duplicated lines out of 0 total lines of code.
Here my grunt task:
jscpd: {
js: {
path: '../cm-html',
exclude: ['../cm-html/src/main/webapp/js/lib/**']
}
},
How I can run it via grunt correctly?
You can use this plugin for grunt - https://github.com/mazerte/grunt-jscpd
grunt.initConfig({
jscpd: {
javascript: {
path: 'lib/js/'
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.