Jump to >

RuboCop

New in version 3.0.

The RuboCop tool will check Ruby source code for any coding errors, or any formatting not in compliance with the community Ruby style guide.

Supported File Types

The following are supported by this tool.

  • Ruby: *.rb

Installation

This tool requires that both Ruby and the rubocop command line tool are installed on the system running the Review Bot worker.

If Ruby is installed, rubocop can be installed by running:

$ gem install rubocop

It may also be available in your system’s package manager.

Configuration

RuboCop Location

If the rubocop command is in a non-standard location, and can’t be found in Review Bot’s PATH environment variable, then you’ll need to specify the path in the Review Bot worker config file:

exe_paths = {
    'rubocop': '/path/to/rubocop',
}

You will need to restart the Review Bot worker after making this change.

Enabling RuboCop in Review Board

First, you’ll need to add a Review Bot configuration in Review Board (see Tool Configurations).

The following configuration options are available:

Except (optional):

A comma-separated list of cops or departments that will be excluded from any checks.

This is equivalent to rubocop --except=....