Tips to show similarities in files

后端 未结 3 1829
误落风尘
误落风尘 2021-02-15 17:38

In a project, I found some css files that \"smell\" like there are copy-pasted rules in them.

I wonder what are your strategies for detecting copy-paste stuff in files.

3条回答
  •  温柔的废话
    2021-02-15 18:24

    Our Semantic Designs CloneDR is a tool that detects copy-paste-edit blocks of code, for many languages: C, C++, Java, C++, COBOL, ECMAScript, PHP, VB6, VB.net, ...

    It does using language-accurate parsers to build abstract syntax trees, corresponding to exact program structures, which are then compared for similarity. This means it is not confused in any way by whitespace, formmatting, comments, or even different "spelling" of literals (e.g., 3.14159 is the same as .00314150E3).

    It generates a report that shows exactly how the blocks of code are similar, and precisely how they vary. You can see sample reports at the link.

提交回复
热议问题