apostlion
apostlion

Reputation: 720

How measure percent difference in codebase?

Task at hand — I have three versions of some code, developed by different coders, one “parent” and two “child”, and need to calculate, which one is closer to the parent one.

Size of code at hand prohibits from manually counting diff's, and I failed to see any aggregate similarity stats in popular diffmerge tools I've tried.

Hao shot web^H^H^H^H^H^H^H acquire the single percent “similarity” number?

Thanks.

Upvotes: 2

Views: 471

Answers (2)

elifiner
elifiner

Reputation: 7575

Perhaps you can use a Copy-Paste detector tool such as http://pmd.sourceforge.net/cpd.html. I haven't used it personally but it seems to be able to generate statistics.

Upvotes: 1

Peter Stuifzand
Peter Stuifzand

Reputation: 5104

You could count the lines of the diff. On Linux you would do:

diff -r parent child1 | wc -l

diff -r parent child2 | wc -l

This way you get a rough difference in lines of code.

Upvotes: 3

Related Questions