tags:

views:

41

answers:

3

Is there a tool that will scan your code and suggest which refactoring to perform, based on duplicate code segments that it finds?

Let's say I'm specifically interested in C#/Java, but I'm open for tools in other languages as well.

+1  A: 

I haven't used it, but Clone Doctor might work for you.

kc2001
+1  A: 

For Java you have static code review tools to search for violations of a set of chosen rules, with some of the rules covering code duplication. Checkstyle has rules to find duplicate code and duplicate string literals. Another option is the PMD's Copy/Paste Detector.

These tools don't do refactoring themselves, but can help you find code that might need changes.

Kwebble
A: 

For Haskell, there's hlint, which proposes concrete refactorings (i.e. the resulting code), which is possible because of referential transparency.

Christoph