RuboCop

Web Sitehttps://github.com/bbatsov/rubocop
LanguageRuby

Getting Started

To start using RuboCop, enable it in repository setting.

If you want customization, use standard RuboCop config files, rubocop.yml.

Versioning

If your Gemfile.lock contains dependency to RuboCop, SideCI uses the locked version. Otherwise, SideCI assumes you are using the latest version of RuboCop.

RuboCop often introduces incompatibilities on its configuration, and we strongly recomment having it in your Gemfile.lock.

Default Configuration

SideCI uses our recommended configuration if your repository does not have .rubocop.yml. The configuration is available as a RubyGem called MeowCop.

Configuration via sideci.yml

Example settings for RuboCop under rubocop.

linter:
  rubocop:
    gems:
      - foo_gem
    options:
      config: .myrubocop.yml
      rails: false

gems

This option controls RuboCop plugins or configuration gems. These will be installed when analyzing. However, you do not have to use this option when you use following gems because SideCI checks your Gemfile.lock and installs them automatically.

(In no particular order)
meowcop, onkcop, deka_eiwakun, forkwell_cop, cookstyle, rubocop-rails, salsify_rubocop,
otacop, unasukecop, sanelint, hint-rubocop_style, rubocop-salemove, mad_rubocop, unifacop,
ws-style, rubocop-config-umbrellio, pulis, rubocop-github, ezcater_rubocop,
rubocop-rspec, rubocop-verbose, rubocop-cask, rubocop-thread_safety

If you would like to use gems which are not lited above, you need to use gems option like below:

linter:
  rubocop:
    gems:
      - rubocop-rspec
      - meowcop
      - bar_gem

Furthermore, you need to put all RuboCop's plugin gems when you use gems option. Available gems in the option are required that these are registered rubygems.org. If these gems are private gems, you cannot get analysis results.

And you should specify listed gems versions by Gemfile.lock or sideci.yml In Gemfile.lock case, you should add gems to Gemfile, execute bundle install and commit Gemfile.lock to your git repository. In sideci.yml case, you should specify gems versions in `gems` field. For example:

linter:
  rubocop:
    gems:
      - name: rubocop-rspec
        version: 1.19.0
      - name: meowcop
        version: 1.13.0
      - name: bar_gem
        version: 1.0.3

options

This option controls command line options given to rubocop.

config

This option controls a configuration file. RuboCop uses your .rubocop.yml on root directory of your project by default. Thus you need not use this option when you have named the file .rubocop.yml. But if your .rubocop.yml has been put in a directory except for root directory, you should use this option like below:

linter:
  rubocop:
    options:
      config: lint_yml/.rubocop.yml

rails

This option controls whether to run Rails Cops. If it is omitted, SideCI automatically determines whether to run Rails Cops or not.

This option is used for the case that you would like SideCI not to run Rails Cops even though your project is a Ruby on Rails project.

linter:
  rubocop:
    options:
      rails: false