🦾 RuboCop LTS
The RuboCop LTS family of gems is the distillation of more than 20 years of my own Ruby expertise and source code diving, built on the shoulders of the expertise of many others — rubocop, standard, rubocop-gradual and others are runtime dependencies — not reinventing any wheels here); organizing that expertise into per-Ruby-version sets of configurations. Yes, I typed those emdashes, and wrote this entire README myself without AI — ctrl-shift-u-2014.
PROJECT DOCUMENTATION
- 🌱 Convention > Configuration
- 🌱 Releases
- 🌱 How to Upgrade Ruby (1.8 to 3.2)!
- 👩💻 Org Health
- ✨ Installation
- 🔧 Usage
- ⚡️ Contributing
- 🌈 Contributors
- 📄 License
- 🤝 Code of Conduct
- 📌 Versioning
This README
This Branch 🌳
This README is for the even release of rubocop-lts supporting Ruby >= 3.2.
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-lts-rspec (which loads
rubocop-rspec,rubocop-rspec-extra,rubocop-env, andrubocop-factory_bot)
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
Project Health 👩💻
| Gem Name | Version | Downloads | CI | Activity |
|---|---|---|---|---|
rubocop-lts |
||||
rubocop-ruby1_8 |
||||
rubocop-ruby1_9 |
||||
rubocop-ruby2_0 |
||||
rubocop-ruby2_1 |
||||
rubocop-ruby2_2 |
||||
rubocop-ruby2_3 |
||||
rubocop-ruby2_4 |
||||
rubocop-ruby2_5 |
||||
rubocop-ruby2_6 |
||||
rubocop-ruby2_7 |
||||
rubocop-ruby3_0 |
||||
rubocop-ruby3_1 |
||||
rubocop-ruby3_2 |
Installation ✨
Install the gem and add to the application's Gemfile by executing:
$ bundle add rubocop-lts -r false
NOTE: If you are using Rails remove the -r false,
so the Railtie will load and rake tasks will be loaded automatically.
If bundler is not being used to manage dependencies, install the gem by executing:
$ gem install rubocop-lts
Or add this line to your application's Gemfile:
gem "rubocop-lts", "~> 24.0", require: false
And then execute:
$ bundle
Usage with RuboCop
In your .rubocop.yml do the following:
🔥 Delete the following line 🔥
inherit_from: .rubocop_todo.yml
You can probably 🔥 delete 🔥 most of the other lines too. This tool is anti-bike-shedding. You no longer need to worry about the rules!
🔥 Any of the following configs are no longer needed 🔥
require:
- 'betterlint'
- 'rubocop-md'
- 'rubocop-packaging'
- 'rubocop-performance'
- 'rubocop-rake'
- 'rubocop-rspec'
- 'rubocop-rails'
- 'rubocop-thread_safety'
- 'rubocop/gradual/patch'
- 'standard'
- 'standard-custom'
- 'standard-performance'
- 'standard-rails'
- 'standard-rubocop-lts'
AllCops:
NewCops: enable
DisplayCopNames: true
TargetRubyVersion: X.X
Then pick one of the following to add!
if Ruby with RSpec
inherit_gem:
rubocop-lts: rubocop-lts.yml # for the ruby + rspec
# NOTE: this is the default, and as such, is equivalent to:
# rubocop-lts: config/ruby_rspec.yml
if just Ruby (without RSpec)
inherit_gem:
rubocop-lts: config/ruby.yml
if Rails with RSpec
inherit_gem:
rubocop-lts: config/rails_rspec.yml
if just Rails (without RSpec)
inherit_gem:
rubocop-lts: config/rails.yml
if rubygem with RSpec
inherit_gem:
rubocop-lts: config/rubygem_rspec.yml
if just rubygem (without RSpec)
inherit_gem:
rubocop-lts: config/rubygem.yml
Load Rake Tasks
NOTE: On Rails it is automatic, via Railtie, so you can skip this.
In a non-Rails environment add the following to your Rakefile:
require "rubocop/lts"
Rubocop::Lts.install_tasks
This will load the rubocop_gradual rake task, and alias it as rubocop.
Dependabot Noise Reduction
Add the following to .github/dependabot.yml if you use Github Actions.
ignore:
- dependency-name: "rubocop-lts"