RubyMine 2017.2 Release Candidate: Quick-fixes for RuboCop

RubyMine 2017.2 RC (build 172.3317.60) is out. This release candidate features quick-fixes for RuboCop, and brings other minor improvements.

Since the previous major release (v2017.1) RubyMine has displayed RuboCop offenses treating and highlighting them as code inspections, but lacked an ability to autocorrect found code smells. Now we have improved that partial solution by adding proper quick-fixes:

rubocop-quick-fixes

If you press Alt+Enter, RubyMine will suggest a quick-fix for a found error, and auto-correct all errors in the file with RuboCop. So no more jumping to the terminal to fix your code with RuboCop!

By the way, RuboCop inspections and quick-fixes are now also available in scratch files.

Here are some other improvements in this build:

Download this EAP from our website.

See the release notes for the full list of improvements, and submit any issues to our bug tracker.

Join other RubyMine users and the dev team on Slack.

Cheers!

Your RubyMine Team

This entry was posted in Announcement, WhatsMining and tagged . Bookmark the permalink.

12 Responses to RubyMine 2017.2 Release Candidate: Quick-fixes for RuboCop

  1. Bruno Facca says:

    Very useful feature. Thank you!

  2. Denis says:

    What are the hotkeys for this?

  3. Rob Vitaro says:

    Is there a way to configure the Rubocop that runs within RubyMine? I would like to ignore something, but don’t know where to set that.

    • Hi Rob;
      Currently we don’t have such an opportunity, so in v2017.2 you can only fix all possible RuboCop offenses. But there’s an open discussion on Slack about how to improve that http://slack.rubymine.org/

      You can either jump to the discussion and add your comments there, or write the list of offenses that you want/don’t want to auto-correct right here, and I’ll add it to the list.

      • Below is the quote from my call for discussion about custom RuboCop quick-fixes on Slack:

        As you know, the new v2017.2 provides in-editor RuboCop quick-fixes. If you see an offense in the editor (gray-highlighted code) and hit _Alt+Enter_, RubyMine will suggest an auto-correction and fix *all offenses in a file*.
        We’d like to provide a way to *auto-correct offenses one by one*. As RuboCop can’t do that, we’ll have to implement this as a new feature in RubyMine. To do that, we need your help to choose the most important offenses that you auto-correct with RuboCop.
        *Let’s start a discussion here, and make a list of such RuboCop offenses*.

      • Rob Vitaro says:

        Appreciate the reply, thank you. Honestly, my biggest complaint is the huge number of “this line has too many characters” I see every day. It’s just distracting. Long code lines are not a problem at my company.

  4. Bruno Facca says:

    Instead of correcting offenses one by one, maybe Rubymine could allow us to configure which Robocop offenses should be displayed (and corrected). Something similar to the “code style” and “inspection” settings which are currently available. IMO that would be a better approach as different companies have different coding style guidelines so we would be able to customize Rubymine to always behave according to the guidelines we’re currently following. One example is choosing whether we’d like to use single quotes or double quotes with strings that do not contain interpolation.

    • Rob Vitaro says:

      I think this would be the perfect solution

    • Bruno Facca says:

      For now, we can customize Rubocop’s rules by editing “default.yml”, “disabled.yml” and “enabled.yml”. To find the path to these files, type the following in the command prompt: gem contents rubocop | grep “.yml”. This should work in any O.S. with Ruby installed (*nix OSs already have grep and the Ruby Windows Installer installs MinGW, which includes grep). Rails developers might want to change “Rails: Enabled: false” to true in “disabled.yml”.

  5. Steven Holloway says:

    It would be ideal if the Rubymine would honour the .rubocop file in project
    This seems like a no brainer.

Leave a Reply

Your email address will not be published. Required fields are marked *