1.86.0Updated Apr 6, 2026

rubocop

Working on RuboCop is often fun, but it also requires a great deal of time and energy.

Risk score32
1.86.02026-03-23
Release notes

New features

  • #15000: Display ZJIT usage when running under LSP. ([@koic][])
  • #14961: Add AllowedParentClasses option to Style/EmptyClassDefinition. ([@hammadkhan][])
  • #14977: Support AllowedReceivers for Style/HashLookupMethod. ([@koic][])

Bug fixes

  • #15015: Fix Style/ConcatArrayLiterals autocorrect deleting code for percent literals with interpolation. ([@bbatsov][])
  • #14897: Detect constant reassignment after class/module definition in Lint/ConstantReassignment. ([@ydakuka][])
  • #11829: Fix false negatives for Lint/DuplicateMethods when duplicate methods are defined in anonymous classes and modules not assigned to a constant. ([@Darhazer][])
  • #14988: Fix false negative in Style/RedundantParentheses when redundant parentheses around range literals in block body. ([@koic][])
  • #14916: Fix false positive for Layout/MultilineMethodCallIndentation when method chain is inside a hash pair value passed to a multiline chained method call. ([@ydakuka][])
  • #15010: Fix a false positive for Lint/DuplicateMethods when modules blocks are passed as method arguments. ([@5hun-s][])
  • #15028: Fix a false positive for Lint/DuplicateMethods when the same method is defined in different anonymous module blocks passed to a no-receiver call (e.g. stub_const). ([@Darhazer][])
  • #15021: Fix false positives in Layout/EmptyLineAfterGuardClause when using a guard clause followed by a multi-line guard clause with raise, fail, return, break, or next. ([@koic][])
  • #15001: Fix false positives in Layout/RedundantLineBreak when setting InspectBlocks: true and using rescue or ensure in the block. ([@koic][])
  • #14997: Fix false positives in Style/FileOpen when assigning File.open to an instance variable, class variable, global variable, or constant. ([@koic][])
  • #15019: Fix false positives in Lint/DuplicateMethods when the same method is defined in anonymous module blocks passed to different receivers. ([@koic][])
  • #14987: Complete ERB and Haml autocorrection in a single run. ([@alpaca-tc][])
  • #15039: Fix incorrect autocorrect in Style/IfWithSemicolon when return with value is in the else branch. ([@koic][])
  • #14930: Fix incorrect autocorrection for Style/IfUnlessModifier when multiple if/unless modifier forms are on the same line inside a collection. ([@ydakuka][])
  • #14985: Fix incorrect autocorrection in Lint/SafeNavigationChain when chaining a method call after safe navigation in the if branch of a ternary. ([@koic][])
  • #15009: Fix infinite loop in Layout/EndAlignment when end is followed by || or &&. ([@koic][])
  • #14981: Fix spurious warning "does not support Safe/SafeAutoCorrect parameter" when those parameters are set for cops that don't have them in their default configuration. ([@dduugg][])
  • #15043: Fix an error for Lint/UselessDefaultValueArgument when fetch without a receiver is inside a fetch block. ([@koic][])
  • #15034: Fix incorrect autocorrection in Style/IfWithSemicolon when using single-line unless / ; / end. ([@koic][])
  • #15015: Fix Style/NonNilCheck autocorrect for receivers containing spaces. ([@bbatsov][])
  • #15015: Fix Style/RaiseArgs to allow anonymous keyword forwarding (raise Ex.new(**)). ([@bbatsov][])
  • #14890: Fix a false positive for Lint/RedundantCopDisableDirective when a rubocop:disable comment is used to suppress Lint/EmptyWhen, Lint/EmptyConditionalBody, Lint/EmptyInPattern, or Style/SymbolProc. ([@eugeneius][])
  • #15015: Fix false negative in Style/RedundantPercentQ for %q strings with interpolation-like syntax. ([@bbatsov][])
  • #14984: Fix Style/AndOr adding unnecessary parentheses around return without arguments. ([@eugeneius][])
  • #14945: Support files with multiple modifiers in Lint/UselessConstantScoping. ([@h-lame][])
  • #15015: Fix Style/TrailingMethodEndStatement to detect singleton methods (def self.foo). ([@bbatsov][])
  • #10822: Don't store results in cache if there are warnings. ([@jonas054][])

Changes

  • #14718: Allow setting MaxFilesInCache to false to entirely disable cache pruning. ([@byroot][])
  • #14989: Make Lint/RedundantSafeNavigation aware of safe navigation in conditional true branch. ([@koic][])
  • #15041: Remove mcp gem from runtime dependencies. ([@koic][])

RuboCop Logo


Ruby Style Guide Gem Version CI Discord

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.


Patreon OpenCollective OpenCollective Tidelift

Working on RuboCop is often fun, but it also requires a great deal of time and energy.

Please consider financially supporting its ongoing development.

Installation

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

See our versioning policy for further details.

Quickstart

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.

Documentation

You can read a lot more about RuboCop in its official docs.

Compatibility

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.

Readme Badge

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.

Ruby Style Guide

Ruby Style Guide

Here are the Markdown snippets for the two badges:

[![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)
[![Ruby Style Guide](https://img.shields.io/badge/code_style-community-brightgreen.svg)](https://rubystyle.guide)

Team

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

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.

Contributors

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! :-)

Funding

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 GitHub Sponsors, Patreon, PayPal, Open Collective and Tidelift .

[!NOTE]

If doing a sponsorship in the form of donation is problematic for your company from an accounting standpoint, we'd recommend the use of Tidelift, where you can get a support-like subscription instead.

Open Collective for Individuals

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

Open Collective for Organizations

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

Release Notes

RuboCop's release notes are available here.

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

Compare versions

Pick two releases with changelog notes to review the changes.

Only releases with available changelog notes are listed here.

Select two versions to compare changes.