Last active
August 25, 2020 14:17
-
-
Save JeffreyMFarley/52aa1ce6398595aadf10247b05ed4113 to your computer and use it in GitHub Desktop.
Find Duplicated Javascript code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
files=frontend/src/static/js | |
pmd cpd --language ecmascript --minimum-tokens 25 --files "$files" --format csv \ | |
| sed "1s/.*/lines,tokens,occurrences,L1,F1,L2,F2,L3,F3,L4,F4/" \ | |
| sed "s|$(pwd)/$files|.|g" \ | |
> dups.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
But what if the identical blocks of code are rearranged?
This will appear as, say, 10 blocks of 90+ tokens, but you know that most of the file is copied
The cycle is: