IntelliJ IDEA 2017.3 Help

RuboCop

Important note

There is no IntelliJ IDEA's implementation of RuboCop. IntelliJ IDEA only executes the RuboCop installed by the users, reads the output and visualizes it in the editor.

Prerequisites

To make use of the RuboCop, make sure that the following prerequisites are met:

  • You are working with IntelliJ IDEA version 2017.1 or higher.
  • The gem rubocop is installed.

Using the RuboCop inspection

The RuboCop inspection is enabled by default. If your project SDK has the rubocop gem installed, then you’ll immediately see the results of this inspection in the Editor, in the same way as the other IntelliJ IDEA inspections.

Otherwise, IntelliJ IDEA suggests to install the missing gem to your project's SDK and enable this inspection:

rubocop inspection

The banner shows only once per project. If you don’t want to use RuboCop in your project, just skip this notification.

To switch off RuboCop inspections, open Settings/Preferences dialog, open the page Inspections and then uncheck the inspection RuboCop:

rubocop inspection off

RuboCop runs through the main menu commands Code | Inspect Code and Code | Run Inspection by Name, which is pretty handy if one wants to find all the code style offenses in an application.

IntelliJ IDEA can autocorrect the entire files using RuboCop, and fix errors by a cop department. You can discover new options by showing new intention actions (Alt+Enter).

Last modified: 6 March 2018

See Also