Code Monkey home page Code Monkey logo

jscpd's Introduction

Stories in Ready Copy/paste detector for programming source code.

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

Supported languages
JavaScript Java
CoffeeScript C++
PHP C#
Less Python
Ruby C

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:
  - javascript
  - coffeescript
  - php
  - python
  - less
  - ruby
  - java
  - "c++src" # c++ source
  - csrc     # c source
  - csharp   # c# source
exclude:
  - "**/*.min.js"
  - "**/*.mm.js"

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

or

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

Please see the minimatch documentation for more details.

Options:

Option Type Default Description
  • -l, --min-lines | [NUMBER] | 5 | min size of duplication in code lines
  • -t, --min-tokens | [NUMBER] | 70 | mim size of duplication in code tokens
  • -f, --files | [STRING] | * | glob pattern for find code
  • -e, --exclude | [STRING] | - | directory to ignore
  • -g, --languages | [STRING] | All supported | list of languages which scan for duplicates, separated with coma
  • -o, --output | [PATH] | - | path to report xml file
  • --verbose    |           | -             | show full info about copies
    
  • -p, --path | [PATH] | Current dir | path to code
  • -d, --debug | | - | show debug information (options list and selected files)
  • -v, --version | | - | Display the current version
  • -h, --help | | - | Display help and usage details

Run tests

  npm test

Changelog

Project changelog

TODO

Project plans

License

The MIT License

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.