= Installation

RuboCop's installation is pretty standard:

[source,sh]
----
$ gem install rubocop
----

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

[source,rb]
----
gem 'rubocop', require: false
----

RuboCop is stable between major versions, both in terms of API and cop configuration.
We aim to 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`:

[source,rb]
----
gem 'rubocop', '~> 1.89', require: false
----

.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 https://metaredux.com/posts/2019/05/22/a-modular-rubocop.html[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.
****
