How to Upgrade Ruby
🦾 RuboCop LTS - Rules for Rubies: Rubocop + Standard + Betterlint + Shopify + Gradual
💡 See the intro blog post!
The RuboCop LTS family of gems is the distillation of almost 20 years of my own Ruby expertise and source code diving, built on the shoulders of the expertise of many others; organizing that expertise into per-Ruby-version sets of configurations.
Although the situation has improved somewhat, it remains unsafe to upgrade RuboCop, or Standard, in a project that supports EOL Rubies.
I hope it helps others avoid some of the challenges I’ve had with library maintenance, and supporting decade-old mission-critical applications.
Avoid bike-shedding, use rubocop-lts
in every project, and
let it manage your linting complexity!
If the rubocop-lts
stack of libraries has helped you, or your organization,
please support my efforts by making a donation, or becoming a sponsor.
How To Upgrade Ruby (or, How To Untie Gorgon’s Knot 🪢)
📝 The ruby specific versions, e.g. rubocop-ruby1_8
, or rubocop-ruby3_2
,
can be used if you won’t be upgrading ruby.
Your Ruby is | Your Gemfile has | Ruby version for linting | Your Gemfile.lock gets | Your .rubocop.yml needs: |
---|---|---|---|---|
1.8.x |
gem "rubocop-lts", "~> 0.1" |
'>= 2.7' |
rubocop-ruby1_8 |
inherit_gem:\n rubocop-lts: rubocop-lts.yml |
⬆️ to 1.9.x |
gem "rubocop-lts", "~> 2.1" |
'>= 2.7' |
rubocop-ruby1_9 |
no change |
⬆️ to 2.0.x |
gem "rubocop-lts", "~> 4.1" |
'>= 2.7' |
rubocop-ruby2_0 |
no change |
⬆️ to 2.1.x |
gem "rubocop-lts", "~> 6.1" |
'>= 2.7' |
rubocop-ruby2_1 |
no change |
⬆️ to 2.2.x |
gem "rubocop-lts", "~> 8.1" |
'>= 2.7' |
rubocop-ruby2_2 |
no change |
⬆️ to 2.3.x |
gem "rubocop-lts", "~> 10.1" |
'>= 2.7' |
rubocop-ruby2_3 |
no change |
⬆️ to 2.4.x |
gem "rubocop-lts", "~> 12.1" |
'>= 2.7' |
rubocop-ruby2_4 |
no change |
⬆️ to 2.5.x |
gem "rubocop-lts", "~> 14.1" |
'>= 2.7' |
rubocop-ruby2_5 |
no change |
⬆️ to 2.6.x |
gem "rubocop-lts", "~> 16.1" |
'>= 2.7' |
rubocop-ruby2_6 |
no change |
⬆️ to 2.7.x |
gem "rubocop-lts", "~> 18.2" |
'>= 2.7' |
rubocop-ruby2_7 |
no change |
⬆️ to 3.0.x |
gem "rubocop-lts", "~> 20.2" |
'>= 3.0' |
rubocop-ruby2_0 |
no change |
⬆️ to 3.1.x |
gem "rubocop-lts", "~> 22.1" |
'>= 3.1' |
rubocop-ruby3_1 |
no change |
⬆️ to 3.2.x |
gem "rubocop-lts", "~> 24.0" |
'>= 3.2' |
rubocop-ruby3_2 |
no change |
📼 Supporting EOL Rubies
You can only run linting when running Ruby >= 2.7. Your project can support older rubies, since Ruby code can be written that supports all versions from 1.8 to 3.X (as many popular gems do, including RSpec). There is no need to run the linter on every Ruby version. Just pick a version, and run the linter once, using a ruleset that supports older Ruby syntax, which this gem family provides.