A Ruby static code analyzer and formatter, based on the community Ruby style guide.
jonas054 and bbatsov [#6492] Auto-correct chunks of comments
One common reason for `rubocop -a` to be slow is that individual corrections
create new offenses for the next iteration of the inspect/autocorrect
loop. Perhaps the worst problem is posed by `Layout/CommentIndentation` when it
fixes only the last comment line in a large multi-line inline comment. Then we
must go through the loop as many times as there are lines in that multi-line

This change improves the situation a lot, but I think it's too early to close
the issue. More improvements can probably be made before we're satisfied.
Latest commit f78f034 Nov 18, 2018
Failed to load latest commit information.
.circleci Test with JIT compiler on latest Ruby Nov 8, 2018
.github Fix link URL in Pull Request template Nov 7, 2018
assets Change organization URL to rubocop-hq May 31, 2018
bin Add `bin/setup` script to bin dir Jun 17, 2018
config [Fix #3301] Consider the scope of local variables in Style/InfiniteLoop Nov 11, 2018
exe Move bindir from bin direcotry to exe directory May 22, 2018
lib [#6492] Auto-correct chunks of comments Nov 18, 2018
logo [Fix #578] Add a logo Sep 4, 2014
manual Remove extraneous backtick in node_pattern.md Nov 12, 2018
relnotes Cut 0.60 Oct 26, 2018
spec [#6492] Auto-correct chunks of comments Nov 18, 2018
tasks We want the runner to not exit when done Oct 31, 2018
.editorconfig Add an `.editorconfig` file (#3748) Dec 1, 2016
.gitattributes Change merge driver for CHANGELOG.md to resolve conflict problem Oct 11, 2016
.gitignore Ignore .ruby-version file in git management Jan 17, 2018
.rspec Specify `--require spec_helper` in .rspec Mar 1, 2017
.rubocop.yml [Fix #5973] Add Style/IpAddresses cop Jun 19, 2018
.rubocop_todo.yml Remove unneeded $stderr capturing Sep 11, 2018
.simplecov Generate code coverage report on all spec runs Sep 11, 2018
.yardopts Hide void return of methods in YARD documentation Jun 10, 2013
CHANGELOG.md [#6492] Auto-correct chunks of comments Nov 18, 2018
CONTRIBUTING.md Use https whenever possible Nov 7, 2018
Gemfile Generate code coverage report on all spec runs Sep 11, 2018
LICENSE.txt Bump license year for 2018 Jan 11, 2018
README.md Use https whenever possible Nov 7, 2018
Rakefile Generate code coverage report on all spec runs Sep 11, 2018
appveyor.yml Documentation checks only need to run once Sep 12, 2018
mkdocs.yml Changes to MkDocs / ReadTheDocs Oct 21, 2018
readthedocs.yml Tell Read the Docs to build downloadable docs (#5563) Feb 16, 2018
rubocop.gemspec Update unicode-display_width version to 1.4.0 Sep 28, 2018


Gem Version CircleCI Status AppVeyor Status Coverage Status Code Climate Inline docs SemVer

Patreon Liberapay OpenCollective OpenCollective

RuboCop Logo

Role models are important.
-- Officer Alex J. Murphy / RoboCop

RuboCop is a Ruby static code analyzer and code formatter. Out of the box it will enforce many of the guidelines outlined in the community Ruby Style Guide.

RuboCop is extremely flexible and most aspects of its behavior can be tweaked via various configuration options.

Apart from reporting problems in your code, RuboCop can also automatically fix some of the problems for you.


Please consider supporting financially its ongoing development.


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.60.0', require: false


Just type rubocop in a Ruby project's folder and watch the magic happen.

$ cd my/cool/ruby/project
$ rubocop

Official manual

You can read a ton more about RuboCop in its official manual.


RuboCop supports the following Ruby implementations:

  • MRI 2.2+
  • JRuby 9.0+

The Rails cops support the following versions:

  • Rails 4.0+


Here's a list of RuboCop's core developers:


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.


Here's a list of all the people who have contributed to the development of RuboCop.

I'm extremely grateful to each and every one of them!

If you'd like to contribute to RuboCop, please take the time to go through our short contribution guidelines.

Converting more of the Ruby Style Guide into RuboCop cops is our top priority right now. Writing a new cop is a great way to dive into RuboCop!

Of course, bug reports and suggestions for improvements are always welcome. GitHub pull requests are even better! :-)


While RuboCop is free software and will always be, the project would benefit immensely from some funding. Raising a monthly budget of a couple of thousand dollars would make it possible to pay people to work on certain complex features, fund other development related stuff (e.g. hardware, conference trips) and so on. Raising a monthly budget of over $5000 would open the possibility of someone working full-time on the project which would speed up the pace of development significantly.

We welcome both individual and corporate sponsors! We also offer a wide array of funding channels to account for your preferences (although currently Open Collective is our preferred funding platform).

If you're working in a company that's making significant use of RuboCop we'd appreciate it if you suggest to your company to become a RuboCop sponsor.

You can support the development of RuboCop via Salt, Patreon, Liberapay, and Open Collective.

Open Collective Backers

Support us with a monthly donation and help us continue our activities. [Become a backer]

Open Collective Sponsors

Become a sponsor and get your logo on our README on GitHub with a link to your site. [Become a sponsor]


RuboCop's changelog is available here.


Copyright (c) 2012-2018 Bozhidar Batsov. See LICENSE.txt for further details.