Installation

RuboCop’s installation is pretty standard:

$ gem install rubocop

If you’d rather install RuboCop using bundler, don’t require it in your Gemfile:

gem 'rubocop', require: false

RuboCop’s development is moving at a very rapid pace and there are often backward-incompatible changes between minor releases (since we haven’t reached version 1.0 yet). To prevent an unwanted RuboCop update you might want to use a conservative version locking in your Gemfile:

gem 'rubocop', '~> 0.87.1', require: false
You can check out our progress on the road to version 1.0 here. You can also help us get there faster! :-)
A Modular RuboCop

Originally RuboCop bundled cops focused on performance and Ruby on Rails, but those were extracted into their own gems eventually:

  • the performance cops were extracted in rubocop-performance and were removed from the main gem in 0.68

  • the Ruby on Rails cops were extracted in rubocop-rails and were removed from the main gem in 0.72

You’ll need to install those gems separately if you’d like to use them. See this article for more details.

Additionally, RuboCop’s AST logic was extracted to rubocop-ast in RuboCop 0.84. While this change is transparent to RuboCop’s users (rubocop-ast is a runtime dependency of rubocop), it’s good to be aware that you can leverage RuboCop’s AST node extensions and AST node pattern matching outside of RuboCop.