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.
You can also check the entire project and display the results along with other warnings.
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.
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.
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.
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.
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.
You can apply fixes using the Fix all auto-correctable RuboCop offenses context menu command.
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 | Weak Warning |
Warning | Warning |
Error | Error |