Code duplication in javascript

Is there any tool to detect duplicate code in JavaScript? I tried the "PMD Duplicate code detector", but it does not support the .js extension.

+5
source share
4 answers

You can use JS Inspect to detect copied and structurally similar code, it also supports*.js

Installation

npm install -g jsinspect

Run

jsinspect -t 50 ./path/to/src
+2
source

I would recommend looking at this stream (also on stackoverflow): Javascript source code analysis (in particular duplication check)

0
source

IDE . IntelliJ, IDE 2 :

  • Inline: , .
  • : Analyze- > Locate Duplicates.., .
0

npm install -g jscpd

jscpd ./path/to/code

( , , html : jscpd -r html./path/to/code)

:

  • JSinspect , .ts .tsx(jscpd 150+
  • InteliJ IDE ( ), , , WebStorm .
0

Source: https://habr.com/ru/post/1770265/


All Articles