Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tool to find copy/pasted code? [closed]

Today I found tons of copy/paste code inside of if statements with one or two words changed. I changed the 35line beast into a 5 line easy to understand code.

I'm sure I'll find more of that in the codebase. Is there a tool I can use to find them? Its all in .NET written in C#


1 Answers

I have run into the same issues and I use Visual Studio 2012's "Analyze Solution for Code Clones" in the "Analyze" menu. Often times it's not even a "cut and paste" job, but people adding their own methods to the code base without first checking to see if that code was already written. Sometimes it's a bunch of boilerplate code that could be abstracted with a generic or functional approach, too. (So, you have my sympathy!) Click here for more information on MSDN.

like image 55
Jim D'Angelo Avatar answered Sep 17 '25 13:09

Jim D'Angelo