Do tools exist which automatically find copy-and-p

2020-02-21 07:16发布

Are there tools out there which could automatically find copy-and-paste code among a set of files?

I was thinking of writing a script for this, which would just search for equal strings, but such script would find mostly irrelevant equalities. (Such as private final static ...).

4条回答
不美不萌又怎样
2楼-- · 2020-02-21 07:50
疯言疯语
4楼-- · 2020-02-21 08:01

Our CloneDR is a tool for finding exact and near-miss blocks of code constructed by copy and paste activities. It can handle systems of millions of lines of code.

It uses precise language grammars to pick out language structures (identifiers, expressions, statements, blocks, functions, classes, packages, ...) that have been copied, and to determine the points of variation across the sets of clones (any of those structures can be parameters!)

CloneDR operates on a wide variety of languages: C, C++, C#, Java, PHP, COBOL, Python, Ada, Fortran, EGL and visual basic (VBScript, VB6, VB.net).

The website has a number of sample clone detection reports from a variety of those languages.

This product is available for evaluation on http://www.semanticdesigns.com. Other open source alternatives are Simian and PMD CPD

查看更多
▲ chillily
5楼-- · 2020-02-21 08:05

CloneDigger for Python and Java.

查看更多
登录 后发表回答