jscpd

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

Version

0.6.22

Runtime

Node.js Versions

Supported Languages

C C++ C# CoffeeScript CSS Go HTML Java JavaScript Kotlin Objective-C PHP Python Ruby Scala Swift TypeScript

Official Documentation

https://github.com/kucherenko/jscpd

YAML Configuration

jscpd:

  • input:

    Patterns to include in execution and reports.

  • ignore:

    Patterns to exclude from execution and reports.

  • auto-fix:

    N/A

  • config-file:

    Alias of --config option.

  • machine:

    • cpu:

      Amount of CPU. The default machine has 0.25 CPU with 960 MiB RAM.

  • options:

    Below is the list of options that are supported:

    -l, --min-lines NUMBER min size of duplication in code lines
    -t, --min-tokens NUMBERmim size of duplication in code tokens
    -c, --config FILE      path to config file
    -f, --files STRING     glob pattern for find code
    -e, --exclude STRING   directory to ignore
        --skip-comments    skip comments in code
    -b, --blame BOOLEAN    blame authors of duplications (get information
                           about authors from git)
        --verbose          show full info about copies
    -p, --path PATH        path to code
    
  • thresholds:

    • num-issues:

      No tool specific severity levels are available.

  • experimental:

    • incremental:

      N/A

      Note: The incremental analysis cannot be supported for jscpd. This is because unchanged files also need to be compared with changed ones.

YAML Examples

  • With default options:

    inspecode:
      jscpd: default
    
  • With custom machine:

    inspecode:
      jscpd:
        machine:
          cpu: 1.5 # 1.5 CPU, 5760 MiB RAM
    
  • With custom options:

    inspecode:
      jscpd:
        options:
          --path: my_project/
    
  • With a configuration file:

    inspecode:
      jscpd:
        config-file: test/.cpd.yaml
    

    The above configuration is equivalent to:

    inspecode:
      jscpd:
        options:
          --config: test/.cpd.yaml
    

Configuration File Detection

If no configuration files are specified via config-file or options field, Inspecode first lets jscpd to find configuration files in your repository.

In addition, if jscpd cannot find any configuration files, Inspecode also walks the file tree in lexical order in your repository to find a configuration file named .cpd.yaml or .cpd.yml and specifies the file first found to jscpd automatically via --config option.

Note: Inspecode ignores specific configuration files while searching. See Configuration > Tool Configuration > Field: config-file for detail.

If the configuration file detected by Inspecode is not the one you want to use or you do not want to use any configuration files, you can disable Inspecode from detecting configuration files by explicitly setting an empty string to config-file field like below:

inspecode:
  jscpd:
    config-file: ""

results matching ""

    No results matching ""