---
NOTE: You might be interested in [`rubocop-lts`](https://github.com/rubocop-lts/rubocop-lts#-how-to-untie-gorgons-knot) which sits as a higher level than this gem, and can keep pace with whatever version of Ruby you happen to be on.
| Gem Name | Version | Downloads | CI | Activity |
|------------------------------|-------------------------------------|----------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
| [`rubocop-lts`][⛳️lts-gh] | [![Gem Version][⛳️lts-vi]][⛳️lts-g] | [![Total DL][🖇️lts-dti]][⛳️lts-g] [![DL Rank][🏘️lts-rti]][⛳️lts-g] | [![Current][🚎lts-cwfi]][🚎lts-cwf] | [![Open Issues][📗lts-ioi]][📗lts-io] [![Closed Issues][🚀lts-ici]][🚀lts-ic] [![Open PRs][💄lts-poi]][💄lts-po] [![Closed PRs][👽lts-pci]][👽lts-pc] |
| [`rubocop-ruby2_6`][⛳️26-gh] | [![Gem Version][⛳️26-vi]][⛳️26-g] | [![Total DL][🖇️26-dti]][⛳️26-g] [![DL Rank][🏘️26-rti]][⛳️26-g] | [![Current][🚎26-cwfi]][🚎26-cwf] [![Heads][🖐26-hwfi]][🖐26-hwf] [![Legacy][🧮26-lwfi]][🧮26-lwf] | [![Open Issues][📗26-ioi]][📗26-io] [![Closed Issues][🚀26-ici]][🚀26-ic] [![Open PRs][💄26-poi]][💄26-po] [![Closed PRs][👽26-pci]][👽26-pc] |
[⛳️lts-vi]: http://img.shields.io/gem/v/rubocop-lts.svg
[🖇️lts-dti]: https://img.shields.io/gem/dt/rubocop-lts.svg
[🏘️lts-rti]: https://img.shields.io/gem/rt/rubocop-lts.svg
[🚎lts-cwf]: https://github.com/rubocop-lts/rubocop-lts/actions/workflows/current.yml
[🚎lts-cwfi]: https://github.com/rubocop-lts/rubocop-lts/actions/workflows/current.yml/badge.svg
[🖐lts-hwf]: https://github.com/rubocop-lts/rubocop-lts/actions/workflows/heads.yml
[🖐lts-hwfi]: https://github.com/rubocop-lts/rubocop-lts/actions/workflows/heads.yml/badge.svg
[🧮lts-lwf]: https://github.com/rubocop-lts/rubocop-lts/actions/workflows/legacy.yml
[🧮lts-lwfi]: https://github.com/rubocop-lts/rubocop-lts/actions/workflows/legacy.yml/badge.svg
[📗lts-io]: https://github.com/rubocop-lts/rubocop-lts/issues
[📗lts-ioi]: https://img.shields.io/github/issues-raw/rubocop-lts/rubocop-lts
[🚀lts-ic]: https://github.com/rubocop-lts/rubocop-lts/issues?q=is%3Aissue+is%3Aclosed
[🚀lts-ici]: https://img.shields.io/github/issues-closed-raw/rubocop-lts/rubocop-lts
[💄lts-po]: https://github.com/rubocop-lts/rubocop-lts/pulls
[💄lts-poi]: https://img.shields.io/github/issues-pr/rubocop-lts/rubocop-lts
[👽lts-pc]: https://github.com/rubocop-lts/rubocop-lts/pulls?q=is%3Apr+is%3Aclosed
[👽lts-pci]: https://img.shields.io/github/issues-pr-closed/rubocop-lts/rubocop-lts
[⛳️lts-g]: https://rubygems.org/gems/rubocop-lts
[⛳️lts-gh]: https://github.com/rubocop-lts/rubocop-lts
[⛳️26-vi]: http://img.shields.io/gem/v/rubocop-ruby2_6.svg
[🖇️26-dti]: https://img.shields.io/gem/dt/rubocop-ruby2_6.svg
[🏘️26-rti]: https://img.shields.io/gem/rt/rubocop-ruby2_6.svg
[🚎26-cwf]: https://github.com/rubocop-lts/rubocop-ruby2_6/actions/workflows/current.yml
[🚎26-cwfi]: https://github.com/rubocop-lts/rubocop-ruby2_6/actions/workflows/current.yml/badge.svg
[🖐26-hwf]: https://github.com/rubocop-lts/rubocop-ruby2_6/actions/workflows/heads.yml
[🖐26-hwfi]: https://github.com/rubocop-lts/rubocop-ruby2_6/actions/workflows/heads.yml/badge.svg
[🧮26-lwf]: https://github.com/rubocop-lts/rubocop-ruby2_6/actions/workflows/legacy.yml
[🧮26-lwfi]: https://github.com/rubocop-lts/rubocop-ruby2_6/actions/workflows/legacy.yml/badge.svg
[📗26-io]: https://github.com/rubocop-lts/rubocop-ruby2_6/issues
[📗26-ioi]: https://img.shields.io/github/issues-raw/rubocop-lts/rubocop-ruby2_6
[🚀26-ic]: https://github.com/rubocop-lts/rubocop-ruby2_6/issues?q=is%3Aissue+is%3Aclosed
[🚀26-ici]: https://img.shields.io/github/issues-closed-raw/rubocop-lts/rubocop-ruby2_6
[💄26-po]: https://github.com/rubocop-lts/rubocop-ruby2_6/pulls
[💄26-poi]: https://img.shields.io/github/issues-pr/rubocop-lts/rubocop-ruby2_6
[👽26-pc]: https://github.com/rubocop-lts/rubocop-ruby2_6/pulls?q=is%3Apr+is%3Aclosed
[👽26-pci]: https://img.shields.io/github/issues-pr-closed/rubocop-lts/rubocop-ruby2_6
[⛳️26-g]: https://rubygems.org/gems/rubocop-ruby2_6
[⛳️26-gh]: https://github.com/rubocop-lts/rubocop-ruby2_6
# Rubocop::Ruby26
See the intro [blog post](https://dev.to/pboling/rubocop-ruby-matrix-gems-nj)!
This gem requires no other gems. It depends on `rubocop`, but does not `require 'rubocop'`.
Awareness of `rubocop`'s lack of [SemVer][semver] adherence isn't evenly dispersed in the Ruby community.
The RuboCop team [has reasons](https://github.com/semver/semver/issues/317)
for [not following SemVer](https://github.com/rubocop/rubocop/issues/4243).
NOTE: They think they are following SemVer,
but their interpretation differs from mine, and seems to differ from the
[intent of SemVer's creator][major-versions-not-sacred].
If you need to run `rubocop` from command line in an older version of Ruby, you've come to the right place.
The purpose of this gem is to constrain the `rubocop` dependency of a project in
a [SemVer compliant][semver]
(Semantic Versioning, [Major Versions are Not Sacred][major-versions-not-sacred])
way that aligns with the the desired minimum compatible/supported Ruby version.
## Ruby Version Support
Adding this gem will facilitate the best practice of adding a `~> ` version constrained `rubocop` dependency, while
minimizing the risk of a rubocop minor / patch upgrade breaking the build. See the
official [compatibility matrix][rubocop-support-matrix] for `rubocop`.
### Three Guarantees
This gem will install a version of `rubocop` which will
**install** on (1), **run** on (2), and **analyze code** (3) intended to support any version of Ruby >= 2.7.
Any change to any of those three abilities would require a major version bump.
Each [spring `rubocop` drops][rubocop-support-matrix] the ability to **install** and **run** `rubocop` on an EOL'd Ruby.
Eventually `rubocop` will drop the ability to **analyze code** intended to support an EOL'd Ruby,
as they already have for Ruby 1.8 and 1.9.
When the `rubocop` team makes _any_ of these changes they
[only bump the minor version][rubocop-versioning] of RuboCop,
in violation of SemVer ([they disagree][rubocop-release-policy]).
In other words, RuboCop intentionally does not bump the major version when they drop
_analysis_, _runtime_, or _installation_ support for a given version of Ruby.
This is a primary _raison d’être_ for this project.
To get a better understanding of how SemVer is intended to work read this article from the creator of SemVer:
- ["Major Version Numbers are Not Sacred"][major-versions-not-sacred]
[rubocop-support-matrix]: https://docs.rubocop.org/rubocop/compatibility.html#support-matrix
[rubocop-versioning]: https://docs.rubocop.org/rubocop/versioning.html
[rubocop-release-policy]: https://docs.rubocop.org/rubocop/versioning.html#release-policy
[major-versions-not-sacred]: https://tom.preston-werner.com/2022/05/23/major-version-numbers-are-not-sacred.html
### A Gem Family
The `rubocop-lts` series of gems has a version supporting any version of Ruby you need.
They can be used as development dependencies for libraries or applications.
- [`rubocop-ruby1_9`][rr19]
- [Still supporting Ruby 1.8?][what1_8]
- [`rubocop-ruby2_0`][rr20]
- [`rubocop-ruby2_1`][rr21]
- [`rubocop-ruby2_2`][rr22]
- [`rubocop-ruby2_3`][rr23]
- [`rubocop-ruby2_4`][rr24]
- [`rubocop-ruby2_5`][rr25]
- [`rubocop-ruby2_6`][rr26]
- [`rubocop-ruby2_7`][rr27]
- [`rubocop-ruby3_0`][rr30]
- [`rubocop-ruby3_1`][rr31]
[rr19]: https://gitlab.com/rubocop-lts/rubocop-ruby1_9
[rr20]: https://gitlab.com/rubocop-lts/rubocop-ruby2_0
[rr21]: https://gitlab.com/rubocop-lts/rubocop-ruby2_1
[rr22]: https://gitlab.com/rubocop-lts/rubocop-ruby2_2
[rr23]: https://gitlab.com/rubocop-lts/rubocop-ruby2_3
[rr24]: https://gitlab.com/rubocop-lts/rubocop-ruby2_4
[rr25]: https://gitlab.com/rubocop-lts/rubocop-ruby2_5
[rr26]: https://gitlab.com/rubocop-lts/rubocop-ruby2_6
[rr27]: https://gitlab.com/rubocop-lts/rubocop-ruby2_7
[rr30]: https://gitlab.com/rubocop-lts/rubocop-ruby3_0
[rr31]: https://gitlab.com/rubocop-lts/rubocop-ruby3_1
[what1_8]: https://gitlab.com/rubocop-lts/rubocop-ruby1_9#what-about-ruby-18
[rubocop-matrix]: https://github.com/rubocop/rubocop/blob/master/docs/modules/ROOT/pages/compatibility.adoc#support-matrix
## 🗿 Stable
All releases of this gem are stable releases.
We do not release new versions for every release of `rubocop`.
A typical release cycle for a gem in the `rubocop-lts` family is roughly every six months,
though eventually analysis support for an old version of Ruby will be dropped .
When that happens releases of the `rubocop-lts` gem for that version of Ruby will (mostly) cease.
The first version is `1.0.1` (1.0.0 was yanked due to accidentally requiring Ruby 3.1, failing the whole purpose of this project 🥳).
## ✨ Installation
Install the gem and add to the application's Gemfile by executing:
$ bundle add rubocop-ruby2_6 -r false
If bundler is not being used to manage dependencies, install the gem by executing:
$ gem install rubocop-ruby2_6
## 🔧 Usage
The following is optional. We'll discuss why you might want to do this after you see what it does.
Add to the top of your project's `.rubocop.yml` configuration file:
```yaml
inherit_gem:
rubocop-ruby2_6: rubocop.yml
```
This has the same effect as you declaring the following in your `.rubocop.yml`:
```yaml
AllCops:
# remove if already present in your `.rubocop.yml` to gain the full benefit of this gem!
TargetRubyVersion: 2.6
NewCops: enable
```
Let's talk about these settings.
### TargetRubyVersion
Allowing this gem to manage the target ruby version means you can switch to a different gem within the family when you upgrade to the next version of Ruby, and have nothing else to change. A single line in the `Gemfile`, and you are done.
### NewCops: enable
You may not use this setting in your project yet. Upgrades to the latest RuboCop can include all kinds of changes, including removing support for the version of Ruby your project uses, or adding a cop that may not work with some of your syntax (e.g. [some use cases of 'module_function`](https://github.com/rubocop/rubocop/issues/5953#issuecomment-805921993)). Accepting new cops arriving in a new version of RuboCop can feel risky, especially when it doesn't follow SemVer.
But this gem shoehorns rubocop into SemVer... so `NewCops` is now safe(r)! If you use a dependency greening tool like GitHub's `dependabot`, or the excellent alternatives [depfu](https://depfu.com/), and [`renovate`](https://www.whitesourcesoftware.com/free-developer-tools/renovate/), then you can see the effect of a minor / major version bumpin your CI Build!
## Development
After checking out the repo, run `bin/setup` to install dependencies.
Then, run `rake spec` to run the tests w/ coverage,
or `bin/rake` to run tests w/ coverage, and linting.
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
## ⚡️ Contributing
See [CONTRIBUTING.md][contributing]
## 🌈 Contributors
[![Contributors](https://contrib.rocks/image?repo=rubocop-lts/rubocop-ruby2_6)]("https://github.com/rubocop-lts/rubocop-ruby2_6/graphs/contributors")
Made with [contributors-img](https://contrib.rocks).
## 📄 License
The gem is available as open source under the terms of
the [MIT License][license] [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)][license-ref].
See [LICENSE][license] for the official [Copyright Notice][copyright-notice-explainer].
Project Logos (rubocop-ruby2_6)
See [docs/images/logo/README.txt][project-logos]
Organization Logo (rubocop-semver)
Author: [Yusuf Evli][org-logo-author]
Source: [Unsplash][org-logo-source]
License: [Unsplash License][org-logo-license]
[project-logos]: https://github.com/rubocop-lts/rubocop-ruby2_6/blob/main/docs/images/logo/README.txt
[org-logo-author]: https://unsplash.com/@yusufevli
[org-logo-source]: https://unsplash.com/photos/yaSLNLtKRIU
[org-logo-license]: https://unsplash.com/license
### © Copyright
* Copyright (c) 2022 - 2023 [Peter H. Boling][peterboling] of [Rails Bling][railsbling]
[copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
## 🤝 Code of Conduct
Everyone interacting in the Rubocop::Ruby26 project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/rubocop-lts/rubocop-ruby2_6/blob/main/CODE_OF_CONDUCT.md).
## 📌 Versioning
This library aims to adhere to [Semantic Versioning 2.0.0][semver]. Violations of this scheme should be reported as
bugs. Specifically, if a minor or patch version is released that breaks backward compatibility, a new version should be
immediately released that restores compatibility. Breaking changes to the public API will only be introduced with new
major versions.
As a result of this policy, you can (and should) specify a dependency on this gem using
the [Pessimistic Version Constraint][pvc] with two digits of precision.
For example:
```ruby
spec.add_dependency "rubocop-ruby2_6", "~> 1.1"
```
[copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
[gh_discussions]: https://github.com/rubocop-lts/rubocop-ruby2_6/discussions
[conduct]: https://github.com/rubocop-lts/rubocop-ruby2_6/blob/main/CODE_OF_CONDUCT.md
[contributing]: https://github.com/rubocop-lts/rubocop-ruby2_6/blob/main/CONTRIBUTING.md
[security]: https://github.com/rubocop-lts/rubocop-ruby2_6/blob/main/SECURITY.md
[license]: https://github.com/rubocop-lts/rubocop-ruby2_6/blob/main/LICENSE.txt
[license-ref]: https://opensource.org/licenses/MIT
[semver]: http://semver.org/
[pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
[railsbling]: http://www.railsbling.com
[peterboling]: http://www.peterboling.com
[aboutme]: https://about.me/peter.boling
[angelme]: https://angel.co/peter-boling
[coderme]:http://coderwall.com/pboling
[followme-img]: https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow
[tweetme]: http://twitter.com/galtzo
[documentation]: https://rubydoc.info/github/rubocop-lts/rubocop-ruby2_6/main
[source]: https://github.com/rubocop-lts/rubocop-ruby2_6/
[actions]: https://github.com/rubocop-lts/rubocop-ruby2_6/actions
[issues]: https://github.com/rubocop-lts/rubocop-ruby2_6/issues
[climate_maintainability]: https://codeclimate.com/github/rubocop-lts/rubocop-ruby2_6/maintainability
[climate_coverage]: https://codeclimate.com/github/rubocop-lts/rubocop-ruby2_6/test_coverage
[codecov_coverage]: https://codecov.io/gh/rubocop-lts/rubocop-ruby2_6
[code_triage]: https://www.codetriage.com/rubocop-lts/rubocop-ruby2_6
[blogpage]: http://www.railsbling.com/tags/rubocop-ruby2_6/
[rubygems]: https://rubygems.org/gems/rubocop-ruby2_6
[chat]: https://gitter.im/rubocop-lts/rubocop-ruby2_6?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
[maintenancee_policy]: https://guides.rubyonrails.org/maintenance_policy.html#security-issues
[liberapay_donate]: https://liberapay.com/pboling/donate
[gh_sponsors]: https://github.com/sponsors/pboling