Similar code detector

Posted by Let_Me_Be on Stack Overflow See other posts from Stack Overflow or by Let_Me_Be
Published on 2012-06-06T10:23:24Z Indexed on 2012/06/06 10:40 UTC
Read the original article Hit count: 123

Filed under:
|
|
|

I'm search for a tool that could compare source codes for similarity.

We have a very trivial system right now that has huge amount of false positives and the real positives can easily get buried in them.

My requirements are:

  • reasonably small amount of false positives
  • good detection rate (yeah these are going against each other)
  • ideally with a more complex output than just a single value
  • usable for C (C99) and C++ (C++03 and optimally C++11)
  • still maintained
  • usable for comparing two source files against each other
  • usable in non-interactive mode

EDIT:

To avoid confusion, the following two code snippets are identical and should be detected as such:

for (int i = 0; i < 10; i++) { bla; }

int i; while (i < 10) { bla; i++; }

The same here:

int x = 10; y = x + 5;

int a = 10; y = a + 5;

© Stack Overflow or respective owner

Related posts about c++

Related posts about c