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.
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.
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.
For Haskell, there's hlint, which proposes concrete refactorings (i.e. the resulting code), which is possible because of referential transparency.