Role models are important.
-- Officer Alex J. Murphy / RoboCop
RuboCop is a Ruby static code analyzer (a.k.a. linter
) and code formatter. Out of the box it
will enforce many of the guidelines outlined in the community Ruby Style
Guide. Apart from reporting the problems discovered in your code,
RuboCop can also automatically fix many of them for you.
RuboCop is extremely flexible and most aspects of its behavior can be tweaked via various configuration options.
Working on RuboCop is often fun, but it also requires a great deal of time and energy.
Please consider financially supporting its ongoing development.
RuboCop's installation is pretty standard:
gem install rubocop
If you'd rather install RuboCop using bundler
, add a line for it in your
Gemfile
(but set the require
option to false
, as it is a standalone tool):
gem 'rubocop', require: false
RuboCop is stable between minor 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
:
gem 'rubocop', '~> 1.77', require: false
See our versioning policy for further details.
Just type rubocop
in a Ruby project's folder and watch the magic happen.
cd my/cool/ruby/project
rubocop
Tip
You can also use this magic in your favorite editor with RuboCop's built-in LSP server.
You can read a lot more about RuboCop in its official docs.
RuboCop officially supports the following runtime Ruby implementations:
- MRI 2.7+
- JRuby 9.4+
It targets Ruby 2.0+ for code analysis.
See the compatibility documentation for further details.
If you use RuboCop in your project, you can include one of these badges in your readme to let people know that your code is written following the community Ruby Style Guide.
Here are the Markdown snippets for the two badges:
[](https://github.com/rubocop/rubocop)
[](https://rubystyle.guide)
Here's a list of RuboCop's core developers:
- Bozhidar Batsov (author & head maintainer)
- Jonas Arvidsson
- Yuji Nakayama (retired)
- Evgeni Dzhelyov (retired)
- Ted Johansson
- Masataka Kuwabara (retired)
- Koichi Ito
- Maxim Krizhanovski
- Benjamin Quorning
- Marc-André Lafortune
- Daniel Vandersluis
See the team page for more details.
RuboCop's logo was created by Dimiter Petrov. You can find the logo in various formats here.
The logo is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.