Jscpd

jscpd

jscpd is a tool for detect copy/paste "design pattern" in programming source code.

Andrey Kucherenko's jscpd is a smart tool that helps use to detect copy paste code!

It supports the below langauges:

  • JavaScript
  • Java
  • CoffeeScript
  • TypeScript
  • C++
  • PHP
  • C#
  • Go
  • Python
  • Ruby
  • C
  • Less
  • CSS
  • SCSS
  • Mixed HTML

Install it: npm install -g jscpd

Usage:

1
2
3
4
5
6
7
jscpd --path my_project/ --languages javascript,coffee

jscpd -f **/*.js -e **/node_modules/**

jscpd --files **/*.js --exclude **/*.min.js --output report.xml

jscpd --files **/*.js --exclude **/*.min.js --reporter json --output report.json

If you have a .cpd.yml config file in the pwd jscpd command, you will check code for duplicates according the config.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#.cpd.yaml
path:
  - fixtures/
languages:
  - javascript
  - coffeescript
  - typescript
  - php
  - python
  - css
  - ruby
  - go
  - java
  - "c++src"    # c++ source
  - csrc        # c source
  - csharp      # c# source
  - htmlmixed   # html mixed source like knockout.js templates
exclude:
  - "**/*.min.js"
  - "**/*.mm.js"
reporter: json

GIF FTW!

jscpd-demo

Suggest a module

Comments