-
Notifications
You must be signed in to change notification settings - Fork 7
Clone Repair Example
Josh Buedel edited this page Oct 28, 2013
·
2 revisions
Here's the basic case of clone detection. Two identical methods, where a repair can be done by replacing one method with a call to the
Note the Resharper squigglies telling us something is up. Passing the mouse over either method name brings up a tooltip identifying the method as a clone of the other.
Placing the cursor on the squigglies prompts you with a quick fix…
…and invoking it…
…replaces the body of the clone with a call to the original. That’s automated clone repair! Use Resharper's inline method refactoring on Bar() to complete the removal.
At this point Agent Ralph's clone detection and repair is limited to whole methods that differ only by
- Names of local variables and parameters.
- Literal values (strings and numbers) that can be converted to parameters.