Skip to content
/ jscpd Public
forked from kucherenko/jscpd

Copy/paste detector for JavaScript and CoffeeScript code

Notifications You must be signed in to change notification settings

webdizz/jscpd

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Copy/paste detector for JavaScript and CoffeeScript code

jscpd is a tool for detect copy/past "design pattern" in JavaScript and CoffeeScript code.

Status

Dependency Status Build Status Coverage Status Bitdeli Badge

NPM

Installation

npm install jscpd -g

Usage

jscpd --path my_project/ --languages js,coffee #scan for js and coffee files for duplicates

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

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

or

If you have file .cpd.yaml in your directory

#.cpd.yaml
path:
  - fixtures/
languages:
  - js
  - coffee
exclude:
  - "**/*.min.js"
  - "**/*.mm.js"

and run jscpd command, you will check code for duplicates according config from .cpd.yaml

or

# coffeescript
jscpd = require('jspd')
result = jscpd::run
	path: 'my/project/folder'
	files: '**/*.js'
	exclude: ['**/*.min.js', '**/node_modules/**']

Please see the minimatch documentation for more details.

Deprecated style:

jscpd --ignore node_modules/ --coffee

Options:

  • -l, --min-lines [NUMBER] min size of duplication in code lines (Default is 5)

  • -t, --min-tokens [NUMBER] mim size of duplication in code tokens (Default is 70)

  • -f, --files [STRING] glob pattern for find code

  • -e, --exclude [STRING] directory to ignore

  • -g, --languages [STRING] list of languages which scan for duplicates, separated with coma (Default is "js,coffee")

  • -o, --output [PATH] path to report xml file

  • --verbose    show full info about copies
    
  • -p, --path [PATH] path to code (Default is /home/apk/workspace/tmp/jscpd)

  • -v, --version Display the current version

  • -h, --help Display help and usage details

  • -i, --ignore [PATH] directory to ignore (deprecated, use -e instant of this)

  • -c, --coffee [BOOLEAN] is CoffeeScript code (deprecated, use --languages for set source languages)

About

Copy/paste detector for JavaScript and CoffeeScript code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published