Posts Tagged ‘Feature’

What’s mining: search for duplicates in Ruby

Wednesday, September 16th, 2009

Hi all,

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

What’s mining: surround selected text

Wednesday, March 18th, 2009

One small but handy thing that you’ve been asking for is the ability to quickly surround the selected text with quotes, single quotes, parentheses, etc. with a single key.

We just did it for quotes! And will also add parentheses before the next EAP build, later this week. More will come later.

Apart from that it should be mentioned that RubyMine has nice “Surround With” feature that allows surrounding pieces of code with other, more complex constructs. Try it: Ctrl+Alt+T / ⌥⌘T

We are listening carefully. So, if you want something, let us know. Here is how you can do it.