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 is stable between major versions, both in terms of API and cop configuration. We aim the ease the maintenance of RuboCop extensions and the upgrades between RuboCop releases. All big changes are reserved for major releases. To prevent an unwanted RuboCop update you might want to use a conservative version lock in your Gemfile:

gem 'rubocop', '~> 1.15', 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.