Skip to content

Conversation

@tnir
Copy link
Contributor

@tnir tnir commented Sep 23, 2025

Background

With Ruby 3.4 on local development, due to unnecessary pinning RuboCop to 1.50.2 (#1385), we cannot use RuboCop with no tweaks as follows:

/src/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/rubocop-1.50.2/exe/rubocop:14: warning: benchmark was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.5.0.
You can add benchmark to your Gemfile or gemspec to silence this warning.
/src/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/rubocop-1.50.2/lib/rubocop/formatter/html_formatter.rb:3: warning: base64 was loaded from the standard library, but is not part of the default gems starting from Ruby 3.4.0.
You can add base64 to your Gemfile or gemspec to silence this warning.
bundler: failed to load command: rubocop (/src/.rbenv/versions/3.4.6/bin/rubocop)
/src/.rbenv/versions/3.4.6/lib/ruby/3.4.0/bundled_gems.rb:82:in 'Kernel.require': cannot load such file -- base64 (LoadError)
        from /src/.rbenv/versions/3.4.6/lib/ruby/3.4.0/bundled_gems.rb:82:in 'block (2 levels) in Kernel#replace_require'
        from /src/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/rubocop-1.50.2/lib/rubocop/formatter/html_formatter.rb:3:in '<top (required)>'
        from /src/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/rubocop-1.50.2/lib/rubocop/formatter.rb:18:in 'Kernel#require_relative'
        from /src/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/rubocop-1.50.2/lib/rubocop/formatter.rb:18:in '<module:Formatter>'
        from /src/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/rubocop-1.50.2/lib/rubocop/formatter.rb:5:in '<module:RuboCop>'
        from /src/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/rubocop-1.50.2/lib/rubocop/formatter.rb:3:in '<top (required)>'
        from /src/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/rubocop-1.50.2/lib/rubocop.rb:705:in 'Kernel#require_relative'
        from /src/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/rubocop-1.50.2/lib/rubocop.rb:705:in '<top (required)>'
        from /src/.rbenv/versions/3.4.6/lib/ruby/3.4.0/bundled_gems.rb:82:in 'Kernel.require'
        from /src/.rbenv/versions/3.4.6/lib/ruby/3.4.0/bundled_gems.rb:82:in 'block (2 levels) in Kernel#replace_require'
        from /src/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/rubocop-1.50.2/exe/rubocop:15:in '<top (required)>'
        from /src/.rbenv/versions/3.4.6/bin/rubocop:25:in 'Kernel#load'
        from /src/.rbenv/versions/3.4.6/bin/rubocop:25:in '<top (required)>'
        from /src/.rbenv/versions/3.4.6/lib/ruby/3.4.0/bundler/cli/exec.rb:59:in 'Kernel.load'
        from /src/.rbenv/versions/3.4.6/lib/ruby/3.4.0/bundler/cli/exec.rb:59:in 'Bundler::CLI::Exec#kernel_load'
        from /src/.rbenv/versions/3.4.6/lib/ruby/3.4.0/bundler/cli/exec.rb:23:in 'Bundler::CLI::Exec#run'
        from /src/.rbenv/versions/3.4.6/lib/ruby/3.4.0/bundler/cli.rb:452:in 'Bundler::CLI#exec'
        from /src/.rbenv/versions/3.4.6/lib/ruby/3.4.0/bundler/vendor/thor/lib/thor/command.rb:28:in 'Bundler::Thor::Command#run'
        from /src/.rbenv/versions/3.4.6/lib/ruby/3.4.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in 'Bundler::Thor::Invocation#invoke_command'
        from /src/.rbenv/versions/3.4.6/lib/ruby/3.4.0/bundler/vendor/thor/lib/thor.rb:538:in 'Bundler::Thor.dispatch'
        from /src/.rbenv/versions/3.4.6/lib/ruby/3.4.0/bundler/cli.rb:35:in 'Bundler::CLI.dispatch'
        from /src/.rbenv/versions/3.4.6/lib/ruby/3.4.0/bundler/vendor/thor/lib/thor/base.rb:584:in 'Bundler::Thor::Base::ClassMethods#start'
        from /src/.rbenv/versions/3.4.6/lib/ruby/3.4.0/bundler/cli.rb:29:in 'Bundler::CLI.start'
        from /src/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/bundler-2.6.9/exe/bundle:28:in 'block in <top (required)>'
        from /src/.rbenv/versions/3.4.6/lib/ruby/3.4.0/bundler/friendly_errors.rb:117:in 'Bundler.with_friendly_errors'
        from /src/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/bundler-2.6.9/exe/bundle:20:in '<top (required)>'
        from /src/.rbenv/versions/3.4.6/bin/bundle:25:in 'Kernel#load'
        from /src/.rbenv/versions/3.4.6/bin/bundle:25:in '<main>'

RuboCop may be run in the latest version of Ruby anywhere (local, CI etc.) as RuboCop 1.30+ supports to analyze Ruby 2.0+ code target.

Changes

  • Update .rubocop_todo.yml by rubocop --auto-gen-config.
  • One existing offense (see below) is fixed by --autocorrect.
Offenses:

ext/mysql2/extconf.rb:116:13: C: [Correctable] Style/RedundantParentheses: Don't use parentheses around a logical expression.
elsif (mc = (with_config('mysql-config') || Dir[GLOB].first))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

36 files inspected, 1 offense detected, 1 offense autocorrectable

- Update .rubocop_todo.yml by `rubocop --auto-gen-config`.
- One offense is fixed by `--autocorrect`.
- Update .github/workflows/rubocop.yml to use Ruby 3.4,
  and actions/checkout@v5.
- Update Gemfile to use the latest RuboCop (1.80.2).

Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
@sodabrew sodabrew merged commit 387e13a into brianmario:master Oct 9, 2025
13 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants