gulp-jscpd

Gulp plugin for the copy/paste detector jscpd

Usage no npm install needed!

<script type="module">
  import gulpJscpd from 'https://cdn.skypack.dev/gulp-jscpd';
</script>

README

gulp-jscpd

Maintenance Status NPM version Build Status Dependency Status Coverage Status Code Climate

Gulp plugin for the copy/paste detector jscpd.

Installation

$ npm install gulp-jscpd

Usage

var gulp  = require('gulp');
var jscpd = require('gulp-jscpd');

gulp.task('jscpd', function() {
  return gulp.src('**/*.js')
    .pipe(jscpd({
      'min-lines': 10,
      verbose    : true
    }));
});

Options

min-lines

Type: Number

Min size of duplication in code lines, default to 5.

min-tokens

Type: Number

Min size of duplication in code tokens, default to 70.

reporter

Type: String

Reporter name or path to the custom reporter, default to xml.

languages

Type: Array

List of languages which scan for duplicates, default to ['javascript', 'typescript', 'jsx', 'haxe', 'coffeescript', 'ruby', 'php', 'python', 'css', 'java', 'csharp', 'go', 'clike', 'htmlmixed'].

output

Type: String

Path to report XML file, default to null (no report file).

verbose

Type: Boolean

Show full info about copies, default to false.

debug

Type: Boolean

Show debug information (options list and selected files), default to false.

silent

Type: Boolean

Don't print a report summary, default to false.

failOnError

Type: Boolean

Don't throw an error in case of duplicated occurrences (useful for CI), default to true.

Tests

Run tests using mocha

$ npm test

Code Coverage

Output a code coverage report in coverage.html

$ npm run coverage

Code Style

Check the code style with JSCS

$ npm run checkstyle

License

gulp-jscpd is licensed under the MIT License.