Eliminating code duplication in a single file

Posted by Jon on Stack Overflow See other posts from Stack Overflow or by Jon
Published on 2010-02-02T04:31:40Z Indexed on 2010/03/24 22:43 UTC
Read the original article Hit count: 449

Sadly, a project that I have been working on lately has a large amount of copy-and-paste code, even within single files. Are there any tools or techniques that can detect duplication or near-duplication within a single file? I have Beyond Compare 3 and it works well for comparing separate files, but I am at a loss for comparing single files.

Thanks in advance.

Edit:

Thanks for all the great tools! I'll definitely check them out.

This project is an ASP.NET/C# project, but I work with a variety of languages including Java; I'm interested in what tools are best (for any language) to remove duplication.

© Stack Overflow or respective owner

Related posts about code-duplication

Related posts about refactoring