---
NOTE: You might be interested in [`rubocop-lts`][rlts] 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`][⛳️ini-gh] | [![Gem Version][⛳️ini-vi]][⛳️ini-g] | [![Total DL][🖇️ini-dti]][⛳️ini-g] [![DL Rank][🏘️ini-rti]][⛳️ini-g] | [![Current][🚎ini-cwfi]][🚎ini-cwf] [![Heads][🖐ini-hwfi]][🖐ini-hwf] | [![Open Issues][📗ini-ioi]][📗ini-io] [![Closed Issues][🚀ini-ici]][🚀ini-ic] [![Open PRs][💄ini-poi]][💄ini-po] [![Closed PRs][👽ini-pci]][👽ini-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
[⛳️ini-vi]: http://img.shields.io/gem/v/rubocop-ruby2_6.svg
[🖇️ini-dti]: https://img.shields.io/gem/dt/rubocop-ruby2_6.svg
[🏘️ini-rti]: https://img.shields.io/gem/rt/rubocop-ruby2_6.svg
[🚎ini-cwf]: https://github.com/rubocop-lts/rubocop-ruby2_6/actions/workflows/current.yml
[🚎ini-cwfi]: https://github.com/rubocop-lts/rubocop-ruby2_6/actions/workflows/current.yml/badge.svg
[🖐ini-hwf]: https://github.com/rubocop-lts/rubocop-ruby2_6/actions/workflows/heads.yml
[🖐ini-hwfi]: https://github.com/rubocop-lts/rubocop-ruby2_6/actions/workflows/heads.yml/badge.svg
[🧮ini-lwf]: https://github.com/rubocop-lts/rubocop-ruby2_6/actions/workflows/legacy.yml
[🧮ini-lwfi]: https://github.com/rubocop-lts/rubocop-ruby2_6/actions/workflows/legacy.yml/badge.svg
[📗ini-io]: https://github.com/rubocop-lts/rubocop-ruby2_6/issues
[📗ini-ioi]: https://img.shields.io/github/issues-raw/rubocop-lts/rubocop-ruby2_6
[🚀ini-ic]: https://github.com/rubocop-lts/rubocop-ruby2_6/issues?q=is%3Aissue+is%3Aclosed
[🚀ini-ici]: https://img.shields.io/github/issues-closed-raw/rubocop-lts/rubocop-ruby2_6
[💄ini-po]: https://github.com/rubocop-lts/rubocop-ruby2_6/pulls
[💄ini-poi]: https://img.shields.io/github/issues-pr/rubocop-lts/rubocop-ruby2_6
[👽ini-pc]: https://github.com/rubocop-lts/rubocop-ruby2_6/pulls?q=is%3Apr+is%3Aclosed
[👽ini-pci]: https://img.shields.io/github/issues-pr-closed/rubocop-lts/rubocop-ruby2_6
[⛳️ini-g]: https://rubygems.org/gems/rubocop-ruby2_6
[⛳️ini-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 configures many gems for you:
- rubocop
- rubocop-gradual
- rubocop-md
- rubocop-rake
- rubocop-shopify
- rubocop-thread_safety
- standard
- standard-performance (incl. rubocop-performance)
- standard-custom
- standard-rubocop-lts (ruby version-specific rules)
And optionally, if you are using RSpec:
- rubocop-rspec
And optionally, if you are building a RubyGem:
- rubocop-packaging
And optionally, if you are building a Rails app:
- standard-rails (incl. rubocop-rails)
- betterlint
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].
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 its desired minimum compatible/supported Ruby version.
Secondary purpose is to provide default configurations for a bevy of RuboCop-related plugins.
## 💎 Ruby Version Support
This gem facilitates equivalent of adding a `~> ` version constrained `rubocop`(-ish +more) dependency,
thus minimizing the risk of a rubocop minor / patch upgrade breaking the build.
### What's that you say?
This gem will install a suite of tools that will **analyze & lint code** intended to support any version of Ruby >= 2.0.
This gem helps insulate projects from RuboCop churn by enshrining many conventions
that have been shown over years to reduce problems.
#### Background
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.9. RuboCop has never run properly on Ruby 1.8.
This gem, via [standard (Standard Ruby)][standardrb], allows RuboCop to analyze Ruby 2.6 code,
by turning off certain rules that only apply to later Rubies.
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
[standardrb]: https://github.com/standardrb/standard
### 👪 A Gem Family
The `rubocop-lts` family of gems has a version supporting any version of Ruby you need.
They can be used as development dependencies for libraries or applications.
- [`rubocop-lts`][rlts]
- [`standard-rubocop-lts`][stdrlts]
- [`rubocop-ruby1_8`][rr18]
- [`rubocop-ruby1_9`][rr19]
- [`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]
- [`rubocop-ruby3_2`][rr32]
[rlts]: https://github.com/rubocop-lts/rubocop-lts#-how-to-untie-gorgons-knot
[stdrlts]: https://github.com/rubocop-lts/standard-rubocop-lts
[rr18]: https://gitlab.com/rubocop-lts/standard-rubocop-lts
[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
[rr32]: https://gitlab.com/rubocop-lts/rubocop-ruby3_2
## 🗿 Stable
All releases of this gem are stable releases.
We do not release new versions for every release of `rubocop`,
as this gem is tied to [standard (Standard Ruby)][standardrb].
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.
## ✨ 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
## 🔧 Basic Usage
If you are using Rails, building a Rubygem, or not using RSpec, see ["Advanced Usage"](#advanced-usage).
Otherwise, if you using this in plain Ruby _and_ RSpec, you can add to the top of your project's `.rubocop.yml` configuration file:
```yaml
inherit_gem:
rubocop-ruby2_6: rubocop.yml
```
Among _many_ other settings, this has the effect of declaring the following:
```yaml
AllCops:
NewCops: enable
```
Let's talk about these settings. (TODO: Document some of the other settings!)
### ⚙️ `NewCops: enable`
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, under the watchful eye of [standard (Standard Ruby)][standardrb]... 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 bump in your CI Build!
## Advanced Usage
### Linting Ruby + RSpec
```yaml
inherit_gem:
rubocop-ruby2_6: rubocop-lts/ruby_rspec.yml
# Note: technically the above is the same as the "Basic Usage" below, so if specificity is not your jam:
# rubocop-ruby2_6: rubocop.yml
```
### Linting Ruby w/o RSpec
```yaml
inherit_gem:
rubocop-ruby2_6: rubocop-lts/ruby.yml
```
### Linting Rails + RSpec
```yaml
inherit_gem:
rubocop-ruby2_6: rubocop-lts/rails_rspec.yml
```
#### Linting Rails w/o RSpec
```yaml
inherit_gem:
rubocop-ruby2_6: rubocop-lts/rails.yml
```
#### Linting a RubyGem + RSpec
```yaml
inherit_gem:
rubocop-ruby2_6: rubocop-lts/rubygem_rspec.yml
```
#### Linting a RubyGem w/o RSpec
```yaml
inherit_gem:
rubocop-ruby2_6: rubocop-lts/rubygem.yml
```
## 💻 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`.
### 🚀 Release Instructions
See [CONTRIBUTING.md][contributing].
## ⚡️ 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][license-img]][license-ref].
See [LICENSE.txt][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-lts)
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]
## 🤝 Code of Conduct
Everyone interacting in this project's codebases, issue trackers, [chat rooms][🏘chat] and mailing lists is expected to follow the [code of conduct][🤝conduct].
[🤝conduct]: https://gitlab.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", "~> 2.0"
```
[aboutme]: https://about.me/peter.boling
[actions]: https://github.com/rubocop-lts/rubocop-ruby2_6/actions
[angelme]: https://angel.co/peter-boling
[blogpage]: http://www.railsbling.com/tags/rubocop-ruby2_6/
[codecov_coverage]: https://codecov.io/gh/rubocop-lts/rubocop-ruby2_6
[code_triage]: https://www.codetriage.com/rubocop-lts/rubocop-ruby2_6
[🏘chat]: https://gitter.im/rubocop-lts/community
[climate_coverage]: https://codeclimate.com/github/rubocop-lts/rubocop-ruby2_6/test_coverage
[climate_maintainability]: https://codeclimate.com/github/rubocop-lts/rubocop-ruby2_6/maintainability
[copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
[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
[devto]: https://dev.to/galtzo
[documentation]: https://rubydoc.info/github/rubocop-lts/rubocop-ruby2_6/main
[followme]: https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow
[gh_discussions]: https://github.com/rubocop-lts/rubocop-ruby2_6/discussions
[gh_sponsors]: https://github.com/sponsors/pboling
[issues]: https://github.com/rubocop-lts/rubocop-ruby2_6/issues
[liberapay_donate]: https://liberapay.com/pboling/donate
[license]: LICENSE.txt
[license-ref]: https://opensource.org/licenses/MIT
[license-img]: https://img.shields.io/badge/License-MIT-green.svg
[peterboling]: http://www.peterboling.com
[pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
[railsbling]: http://www.railsbling.com
[rubygems]: https://rubygems.org/gems/rubocop-ruby2_6
[security]: https://github.com/rubocop-lts/rubocop-ruby2_6/blob/main/SECURITY.md
[semver]: http://semver.org/
[source]: https://github.com/rubocop-lts/rubocop-ruby2_6/
[tweetme]: http://twitter.com/galtzo