It is always a pleasure to tell about new features! This time I’m glad to announce a brand new one that is coming in next RubyMine 1.5 EAP — “Locate duplicates”. It is another useful tool in RubyMine’s code analysis arsenal. Everyone has once faced with copy-paste problem: when you don’t use a refactoring such as extract method/module/variable for some reason but just do copy&paste. Your code begins to “smell”.
Locate duplicates is a helpful feature designed to assist you in writing safe, fast and error-free code.
Use Code | Locate Duplicates menu item to start it. You’ll see the Code Duplication Analysis Settings dialog where you can tune the intelligibility of the search.
Local variables, Fields, Methods, Literals can be anonymized. Do not show duplicates simpler than and Anonymize uncommon subexpressions simpler than options operate with some heuristic values complexity of found fragments of code. These thresholds are used to cut off obvious duplicates like local variables, field etc. You can change them later, but the defaults should fit pretty good for a start.
Results of this search are shown in a familiar diff view with code fragments to inspect the results.
You are welcome to try this in coming EAP build.
-JetBrains RubyMine Team