Rules for Rubies: Rubocop + Standard + Betterlint + Shopify + Gradual
Hi ruby style lovers. I am Peter Boling, author and maintainer of the rubocop-lts
family of ruby gems.
The migration from GitHub to GitLab is almost complete,
but for the moment the project will continue to straddle both hosts.
The blog will live here, where you are reading it, on GitLab.
New Powers
The rubocop-lts gem family has gained three new members, and a host of new powers.
Standard Ruby
One major driver was my recent (re)discovery of standard
,
and the recent improvements made to the standard ecosystem.
RuboCop Gradual
Another major driver was my recent discovery of rubocop-gradual
,
which is the best thing to happen to RuboCop since… standard?
It fixes the broken, but useful paradigm of rubocop_todo.yml
with a solution that is statistically exactly 1920x better.
Read more about that here from Evil Martians.
With that awareness in mind the tradeoffs were simply too great to continue on the current path for rubocop-lts.
Dropping EOL’d Rubies, while still supportingg EOL’d Rubies
Thus I decided to drop the EOL’d Ruby runtime support across the entire suite, and at the same time, pick up first class Ruby 1.8 analysis support (well, OK, second class, but far better than anything we’ve ever had to date). Note the difference between runtime and analysis.
Standard, again
I merged the rules I had derived for Ruby 1.8 support when applying rubocop-lts to my own gems that continue to support Ruby 1.8 (I have many of those) with the rules that Standard Ruby had discovered, resulting in the best set of Ruby 1.8 rules this side of the Lok’Groton Islands.
A New (one liner!) Config
The process of integrating my growing list of fav linters was becoming too much to apply to any project,
and I have many projects, so I needed a tool that did 97% of it for me.
Hence, standard-rubocop-lts
was born.
It provides single line RuboCop configuration,
following the pattern of “rubocoping” with legacy code in
the [Evil Martian’s article]https://dev.to/evilmartians/rubocoping-with-legacy-gme mentioned above,
for many linting tools, and it provides discrete contexts for most combos you’ll be interested in.
There’s a new single liner for each of the following types of Ruby you might be into:
- Rails Apps,
- Rails Apps that test with RSpec,
- RubyGems,
- RubyGems that test with RSpec,
- Ruby libraries (i.e. non-Rails/non-Gems), and
- Ruby libraries that test with RSpec.
New gems added to the family:
Even more Standard Linting
Thanks to the new gem standard-rubocop-lts
the Rubocop::Lts family now automatically configures many linting tools for you.