# RuboCop

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/help/ruby/2026.3/llms.txt).

RubyMine supports integration with [RuboCop](https://github.com/rubocop-hq/rubocop) and enables you to fix its offenses right inside the IDE, for example, in the code editor.

![RuboCop offense](https://resources.jetbrains.com/help/img/idea/2026.3/rubocop_editor_offense.png)

You can also check the entire project and display all RuboCop warnings in a single report.

If necessary, you can enable the [Standard](https://github.com/testdouble/standard) wrapper and use it for analyzing project sources.

## Install RuboCop/Standard gems

The RuboCop inspection is enabled in RubyMine by default and requires the 'rubocop' gem to be installed in the [project’s interpreter](configuring-language-interpreter.html). If this gem is not installed, RubyMine will suggest doing this.

![Install Rubocop](https://resources.jetbrains.com/help/img/idea/2026.3/rubocop_error.png)

If you want to use Standard to analyze your project, add the 'standard' gem to your `Gemfile` and [install it](using-the-bundler.html#install_gems_local).

## Configure linting and formatting with RuboCop and Standard

RubyMine allows you to control how RuboCop and Standard are applied in your project through a set of five mutually exclusive linting and formatting modes.

Selecting a mode ensures that your project uses a consistent workflow for both linting and formatting, avoiding conflicts between the tools.

Procedure:

1. Go to `Settings | Tools | RuboCop`.

![RuboCop Linting and Formatting Modes](https://resources.jetbrains.com/help/img/idea/2026.3/rubocop_modes_settings.png)

2. In the Linting and Formatting section, select one of the following five modes:

* Default: RuboCop performs inspections only; RubyMine handles formatting.

* Standard linting: Uses Standard gem for linting only; formatting remains with RubyMine.

* Standard on save: Runs Standard linting and formatting automatically on save.

* RuboCop server mode: Uses RuboCop in server mode for improved performance; requires RuboCop ≥1.31. Not supported on Windows or JRuby.

* RuboCop on save: Runs `rubocop -a` on save outside server mode; automatically fixes all auto-correctable issues.

## Configure RuboCop inspections

To enable or disable in-editor highligiting for RuboCop inspections, do the following:

Procedure:

1. Open the Settings dialog `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Meta+Comma` (TextMate), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)).

2. Go to the `Editor | Inspections` page and enable/disable the RuboCop inspection under `Ruby | Gems and gem management`.

![Enable Standard](https://resources.jetbrains.com/help/img/idea/2026.3/rubocop_inspections_settings.png)

3. (Optional) Configure how RuboCop severities map to inspection severities in the Severities mapping group.

By default, RubyMine maps RuboCop [severities](https://rubocop.readthedocs.io/en/latest/configuration/#severity) and [inspection severities](configuring-inspection-severities.html) in the following way:

| RuboCop severity | Inspection severity |
| --- | --- |
| Refactor, Convention  | Weak Warning |
| Warning | Warning |
| Error, Fatal  | Error |

To change a severity mapping, expand the list for the respective severity and select the required option.

![Severity mappings](https://resources.jetbrains.com/help/img/idea/2026.3/rubocop_settings_severity.png)

## Fix RuboCop offenses in the editor

When RuboCop inspections are enabled, RubyMine highlights its offenses in the code editor. To see the warning description and fix it, do the following:

Procedure:

1. Place the caret at the highlighted area and press `Ctrl+F1` (Windows), `⌘ F1` (macOS), `⌘ F1` (IntelliJ IDEA Classic (macOS)), `⌘ F1` (macOS System Shortcuts), `Ctrl+F1` (XWin), `Ctrl+F1` (GNOME), `Ctrl+1` (KDE), `Ctrl+F1` (Emacs), `Ctrl+F1` (Sublime Text), `⌘ F1` (Sublime Text (macOS)), `Ctrl+F1` (Visual Studio), `Ctrl+F1` (Visual Studio (macOS)), `Meta+F1` (TextMate), `Ctrl+F1` (NetBeans), `Ctrl+F1` (Eclipse), `⌘ F1` (Eclipse (macOS)).

![RuboCop warning in the editor](https://resources.jetbrains.com/help/img/idea/2026.3/rubocop_editor_offense.png)

2. To fix the offense, press `Alt+Enter` (Windows), `⌥ ⏎` (macOS), `⌥ ⏎` (IntelliJ IDEA Classic (macOS)), `⌥ ⏎` (macOS System Shortcuts), `Alt+Enter` (XWin), `Alt+Enter` (GNOME), `Alt+Enter` (KDE), `Alt+Enter` (Emacs), `Alt+Enter` (Sublime Text), `⌥ ⏎` (Sublime Text (macOS)), `Alt+Enter` (Visual Studio), `⌥ ⏎` (Visual Studio (macOS)), `Alt+Enter` (TextMate), `Alt+Enter` (NetBeans), `Ctrl+1` (Eclipse), `⌘ 1` (Eclipse (macOS)). You can fix all suggested offenses in a file, or you can apply only specific fixes by a class offense or cop department.

![Fix RuboCop offense](https://resources.jetbrains.com/help/img/idea/2026.3/rubocop_editor_fix_offenses.png)

## Run Rubocop inspection

RubyMine enables you to find RuboCop offenses for the entire project by running a corresponding [inspection](code-inspection.html). To do this, follow the steps below:

Procedure:

1. Press `Ctrl+Alt+Shift+I` (Windows), `⌘ ⌥ ⇧ I` (macOS), `⌘ ⌥ ⇧ I` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ ⇧ I` (macOS System Shortcuts), `Ctrl+Alt+Shift+I` (XWin), `Ctrl+Alt+Shift+I` (GNOME), `Ctrl+Alt+Shift+I` (KDE), `Ctrl+Alt+Shift+I` (Emacs), `Ctrl+Alt+Shift+I` (Sublime Text), `⌘ ⌥ ⇧ I` (Sublime Text (macOS)), `Ctrl+Alt+Shift+I` (Visual Studio), `⌘ ⌥ ⇧ I` (Visual Studio (macOS)), `Meta+Alt+Shift+I` (TextMate), `Ctrl+Alt+Shift+I` (NetBeans), `Ctrl+Alt+Shift+I` (Eclipse), `⌘ ⌥ ⇧ I` (Eclipse (macOS)) or go to `Code  | Analyze Code | Run Inspection by Name…` in the main menu.

2. In the popup, find RuboCop and press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (TextMate), `Enter` (NetBeans), `Enter` (Eclipse), `⏎` (Eclipse (macOS)).

3. In the Run 'RuboCop' dialog, specify the scope of files that you want to analyze. If necessary, enable Use 'standard' gem. Click OK.

4. Wait until RubyMine analyzes your project. In the Inspection Results tool window, you can explore RuboCop offenses and fix auto-correctable ones using the Fix all auto-correctable RuboCop offenses button.

![RuboCop inspection results](https://resources.jetbrains.com/help/img/idea/2026.3/rubocop_inspection_by_name_results.png)

You can also explore individual files and apply specific fixes by a class offense or cop department.

![RuboCop inspection results](https://resources.jetbrains.com/help/img/idea/2026.3/rubocop_inspection_by_name_results_specific.png)

## RuboCop Configuration files

RuboCop allows you to customize its behavior through configuration files. RubyMine automatically detects `.rubocop.yml` file and uses it to run the inspection. Alternatively, you can specify a custom configuration file for the inspection.

### .rubocop.yml

RubyMine takes into account all settings specified in the [.rubocop.yml](https://rubocop.readthedocs.io/en/stable/configuration/) file. For example, if you disable some checks for a specified cop department, the [editor](#code_editor) will not show corresponding offenses. Moreover, these offenses won't be shown in the [RuboCop inspection](#code_inspections) report.

> **Note:**
> Some RuboCop checks depend on the Ruby interpreter version. Make sure that the [target
> Ruby version](http://rubocop.readthedocs.io/en/latest/configuration/#setting-the-target-ruby-version) configured for the RuboCop is the same as the Ruby interpreter [specified for a project](configuring-language-interpreter.html).

### Custom RuboCop configuration

To specify a custom RuboCop configuration file:

Procedure:

1. In the Settings dialog (`Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Meta+Comma` (TextMate), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))), select `Tools | Rubocop`.

2. Specify the configuration file in the Config file field.

![Select configuration file](https://resources.jetbrains.com/help/img/idea/2026.3/rubocop_select_config_file.png)

If no configuration file is selected, the inspection runs using `.rubocop.yml` if present in the project. Otherwise, RubyMine uses the default settings.

## How to: Run RuboCop for the opened file with custom options

Sometimes it is necessary to run RuboCop for the currently opened file with custom options. For example, this can be useful when RuboCop inspections [are disabled](#disable_rubocop), or you want to assign a [shortcut](configuring-keyboard-and-mouse-shortcuts.html) for a specific RuboCop action.

In this example, we'll show how to use RuboCop as an [external tool](configuring-third-party-tools.html) to correct layout offenses in the currently opened file.

Procedure: Create a custom RuboCop action

1. In the Settings dialog (`Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Meta+Comma` (TextMate), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))), select Tools | External Tools.

2. Click ![the Add button](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.add.svg) and specify the following settings:

![The Edit Tool dialog](https://resources.jetbrains.com/help/img/idea/2026.3/rubocop_external_tool_example.png)

* Name: The menu command that will be displayed in the RubyMine interface (the Tools menu and context menus).

* Group: The name of the group to which the command belongs. You can select an existing group or type the name of a new group.

* Program: The name of the RuboCop executable.

* Arguments: The arguments passed to the executable file, as you would specify them on the command line. Here we use `-x` RuboCop option to run only layout cops for the current file.

* Working directory: The path to the current working directory from which the tool is executed.

3. Click OK to add the tool and then apply the changes.

4. (Optional) Assign a shortcut for the created action.   In the Settings dialog (`Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Meta+Comma` (TextMate), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))), select Keymap, find the External Tool action under the RuboCop node and specify a shortcut.

![Configure shortcut](https://resources.jetbrains.com/help/img/idea/2026.3/rubocop_external_tool_configure_shortcut.png)

Procedure: Run a custom RuboCop action

* To run the created RuboCop action, go to the `Tools` main menu or use the context menu of a file.

![Run custom action](https://resources.jetbrains.com/help/img/idea/2026.3/rubocop_external_tool_run_action.png)

When the command runs, its output is displayed in the Run tool window.

![Custom action output](https://resources.jetbrains.com/help/img/idea/2026.3/rubocop_external_tool_run_action_output.png)

## See also

### Procedures

[Code inspections](code-inspection.html) [Intention actions](intention-actions.html)

### External Links

[RuboCop](http://rubocop.readthedocs.io/en/latest/)

