簡體   English   中英

我如何從grunt運行jscpd

[英]How I can run jscpd from grunt

我通過咕build建立我的項目。 我想在那里添加grunt-jscpd任務。 我無法通過咕unt聲運行它。 我在放置Gruntfile.js的同一目錄中創建了下一個.cpd.yaml文件:

#.cpd.yaml
path:
  - src/main/webapp/js/accounts/
languages:
  - javascript
exclude:
  - "**/node_modules/**"

當我從放置Gruntfile.js的目錄中運行下一個命令“ jscpd --languages js”時,jscpd可以正常工作,並且看到結果:

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.

但是當我通過grunt運行它時,jscpd不會檢查我的代碼(我運行“ grunt jscpd”命令)。 結果如下:

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.

這是我的艱巨任務:

jscpd: {
        js: {
            path: '../cm-html',
            exclude: ['../cm-html/src/main/webapp/js/lib/**']
        }
    },

如何通過grunt正確運行它?

您可以將此插件用於grunt- https://github.com/mazerte/grunt-jscpd

grunt.initConfig({
  jscpd: {
    javascript: {
      path: 'lib/js/'
    }
  }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM