Declare benchmark dependency so rubocop's CLI runs on Ruby 4.0 - #724
Open
jeremy wants to merge 1 commit into
Open
Declare benchmark dependency so rubocop's CLI runs on Ruby 4.0#724jeremy wants to merge 1 commit into
jeremy wants to merge 1 commit into
Conversation
benchmark is no longer a default gem in ruby 4.0, and rubocop 1.59.0's executable requires it. `bundle exec rubocop` therefore dies with a LoadError under ruby 4.0. `rake rubocop` is unaffected -- RuboCop::RakeTask loads rubocop in-process and never touches exe/rubocop -- so CI stays green while local linting is broken. rubocop dropped the require in 1.66.0, but bumping there means bumping standard in lockstep (it pins rubocop ~> 1.59.0) and absorbing new cops. Declaring the dependency fixes the break without changing the cop set.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
benchmarkstopped being a default gem in Ruby 4.0, and rubocop 1.59.0's executable requires it. Since it's declared nowhere in theGemfile,bundle exec rubocopdies on Ruby 4.0:Scope: this does not break CI
Worth being explicit, since it affects how urgent this is.
require 'benchmark'appears only in rubocop'sexe/rubocop.RuboCop::RakeTaskloads rubocop in-process and never goes through that file, sorake rubocop— and therefore therubocopCI job — passes on Ruby 4.0 today and will keep passing. What's broken is the direct CLI:bundle exec rubocop,bundle exec rubocop -a, and editor/LSP integrations that shell out to it. So this is a local-development papercut, not a red build.rubocop-minitest0.34.5 andstandard1.33.0 are unaffected — neither requiresbenchmark, andbundle exec standardrbworks as-is.Why declare the dependency rather than bump rubocop
rubocop dropped the
benchmarkrequire in 1.66.0, so a bump is the tidier long-term fix, but it isn't a one-line change here.standard1.33.0 pinsrubocop ~> 1.59.0, so rubocop can't move withoutstandardmoving too, and both landing spots cost real churn on Ruby 4.0:Style/ArgumentsForwardingoffenses inlib/sqlite3/pragmas.rb, plusStyle/EmptyElsecrashing internally on 9 sites (An error occurred while Style/EmptyElse cop was inspecting ...)..rubocop.ymlmigrated fromrequire:toplugins:for all five extensions and a decision on the newMinitest/Focuscop.Either is a reasonable follow-up, but both are a lint-config change rather than a build fix, and this repo bumps its dev pins through Dependabot anyway. Declaring the dependency restores the CLI now and changes nothing else.
benchmark0.5.0 requires Ruby >= 2.1, so it's safe across the supported matrix, and the comment notes it can be dropped once rubocop moves past 1.66.0.Verification
On Ruby 4.0.6, after the change:
The offense set is unchanged. Dumping the resolved configuration before and after (
rubocop --show-cops) gives byte-identical output modulo the absolute project path — 653 cops both ways — so no cop loading or configuration changed.Gemfile.lockis gitignored in this repo, so there's nothing to commit alongside.