I need a tool to find duplicates or similar blocks of text in a singular text file or set of text files

后端 未结 6 1316
甜味超标
甜味超标 2021-02-06 13:49

I want to automate moving duplicate or similar C code into functions.

This must work under Linux.

6条回答
  •  一整个雨季
    2021-02-06 14:01

    A subset of your problem: Detecting duplicate code:

    Try: PMD

    Duplicate code can be hard to find, especially in a large project. But PMD's Copy/Paste Detector (CPD) can find it for you! CPD has been through three major incarnations:

    • First we wrote it using a variant of Michael Wise's Greedy String Tiling algorithm (our variant is described here)
    • Then it was completely rewritten by Brian Ewins using the Burrows-Wheeler transform
    • Finally, it was rewritten by Steve Hawkins to use the Karp-Rabin string matching algorithm.

    ...

    Note that CPD works with Java, JSP, C, C++, Fortran and PHP code.

提交回复
热议问题