Search code examples
c++code-analysis

How can I compare similar codebases?


We have several C++ projects that were built from the same codebase. There's a lot of similarities and common code between them but they were developed independently; source was not shared in any way. Classes and files will have been renamed even if the underlying code hasn't changed and individual lines will have been tweaked, changed and replaced.

I'd like to be able to compare the different codebases and find out how much of the code is still the same. It can be fairly high level - % of code that is the same is fine. I also need to be able to automate this process.

Is there a tool that I can run on the codebases and get some sort of report/assessment of how much is common?


Solution

  • I don't have much experience with this sort of thing, but it made me think back to my school days when our University would run everyones code through a program to find cheaters. This brought me to the following link:

    Source Code Similarity Detection

    It names some open source and commercial software that should meet your needs.