IntelliJ IDEA 2018.2 Help

RuboCop

IntelliJ IDEA supports integration with RuboCop and enables displaying its offenses right inside the IDE. For instance, you can see and fix RuboCop offenses in the code editor.

rubocop editor offense

You can also check the entire project and display the results along with other warnings.

rubocop inspection results

Prerequisites

The RuboCop inspection is enabled in IntelliJ IDEA by default and requires the RuboCop gem to be installed in the project’s SDK. If this gem is not installed, IntelliJ IDEA will suggest doing this.

rubocop error

Disabling RuboCop Inspections

To disable RuboCop inspections, invoke the Settings/Preferences dialog (Ctrl+Alt+S ), open the Editor | Inspections page and uncheck the RuboCop inspection.

rubocop settings

Note that severity settings specified for the RuboCop inspection are not in effect when displaying inspection results. See Severity Settings to learn more.

Using RuboCop in the Code Editor

When RuboCop inspections are enabled, IntelliJ IDEA displays its offenses in the code editor.

rubocop editor offense

You can use intention actions ( Alt+Enter ) to correct all suggested offenses in a file or you can apply only specific fixes by a class offense or cop department.

rubocop editor fix offenses

Using RuboCop in Code Inspections

If you want to run RuboCop inspection for an entire project, select Code | Inspect Code. The Inspections Results window will display RuboCop warnings in the Ruby group.

rubocop inspection results

You can apply fixes using the Fix all auto-correctable RuboCop offenses context menu command.

rubocop inspection results fix

Severity Settings

Note that severity settings specified for the RuboCop inspection are not in effect when displaying inspection results. IntelliJ IDEA uses the following severities for RuboCop inspections.

RuboCop Severity

IntelliJ IDEA Severity

Refactor
Convention

Weak Warning

Warning

Warning

Error
Fatal

Error

Last modified: 20 November 2018

See Also

External Links: