My last post addressed the popular rubygem rubocop
, its lack of SemVer (Semantic Versioning) adherence, and introduced a new set of gems aimed at mitigating build failures due to ill-advised rubocop
upgrades.
But switching to this new paradigm would require each project to manage the version of rubocop-ruby*_*
that matches the oldest Ruby they intend to support, and this would also mean polluting .rubocop.yml
with a Ruby version specific string, like
inherit_gem:
rubocop-ruby2_4: rubocop.yml
We need to level up the solution one more time.
What if we could leverage rubygems
and bundler
abilities to resolve dependencies, and just keep it at one sigle gem, which would only update when there is little to no risk.
We could name this gem rubocop-lts
.
It would follow SemVer, and each major version step would signify one version of Ruby being dropped. It would have a static RuboCop config which would load the underlying config from rubocop-ruby*_*
that matches the ruby, resulting in zero code changes outside bumping the major version in the gemfile when you go to upgrade Ruby. It will handle knowing which version of RuboCop is right.
The inherit_gem
lines won't change no matter what version of Ruby, or RuboCop, you are pegged to.
inherit_gem:
rubocop-lts: rubocop-lts.yml
What if this new gem materialized before your very eyes?
I'm working on it over here! Please join me! The intial releases are all complete, and ready to use.
Top comments (0)