Closed prayeshshah closed 2 years ago
Can you please give a little more context on this please?
What Ruby version do you use? What bundler version?
Do you install with bundle
or with gem install
? Are you using the latest versions of Bundler and RubyGems?
When using Rails 7.0, Active Support should use 7.0. And RuboCop Rails accepts Rails 4.2 and newer. So, RuboCop Rails can use Active Support 7.0 (Rails 7.0) with Ruby 2.7 and newer.
Ruby 2.7 or newer is required to use RuboCop Rails with Rails 7.0. Can you confirm that?
@pirj I'm using ruby v2.6.6
Bundler version is 1.17.3. And we used the gem install
Sure @pirj. We're using GitHub Actions with the Reviewdog plugin to run RuboCop for each PRs. Reviewdog spins up a container and tries installing Ruby v2.6.6 which it picks up from our project's .ruby-version
. In out RuboCop config file (.rubocop.yml
), we've specified rubocop-rails
as a dependency. The version of rubocop-rails
we've specified in the GitHub actions workflow config file is v2.11.
rubocop-rails
v2.11 has a dependency on activesupport
>= 4.2.0. Initially, it was picking up some old version of activesupport
, but since Rails released v7, it's picking up activesupport
v7.0 now. But activesupport
v7.0 has specified Ruby >= 2.7 in its gemspec file. Which is where it fails.
@koic We're on Rails 5.2 BTW.
But activesupport v7.0 has specified Ruby >= 2.7 in its gemspec file. Which is where it fails.
This sounds like a Bundler's issue. It should not resolve to activesupport
7.0 if the current Ruby version (2.6.6) does not meet the requirements to support it.
Can you understand in the logs what Bundler version is used? RSpec in its internal CI tests, e.g. explicitly updates RubyGems and Bundler to the latest versions. I can only recommend doing the same if Reviewdog allows for such tuning.
There is nothing we can do on our side to prevent this dependency resolution issue.
Might be related https://github.com/rubygems/rubygems/issues/3870
@pirj My initial thought was that rubocop-rails
shouldn't just suggest activesupport >= 4.2.0
, and instead it should do something like activesupport >= 4.2.0, < 7.0
. But now that you've mentioned it, it does make sense that this might be a dependency resolution issue from either Bundler or from the gem
command.
Thanks for such a quick response BTW, you guys are doing an awesome job!
Bundler version is 1.17.3
This may be the problem. I suggest you to switch to Bunder 2, preferrably the latest version of it.
@koic I don't have permissions to close this, would you?
I'm running into the same error as reported with Ruby 2.6.x but we are already on Bundler 2 for reviewdog. @prayeshshah @radiantshaw were you able to workaround the issue?
@javierjulio Yes. What we did was specify in the GitHub action config to just use Ruby v2.7
. And that solved the issue.
@radiantshaw great, thank you! I just did the same now and it works. Appreciate it!
We experience this problem ourselves, too 😄 https://app.circleci.com/pipelines/github/rubocop/rubocop-rails/1463/workflows/4757f75a-69cc-4953-8ceb-8059d9ee543b/jobs/9541
Found a bundler issue https://github.com/rubygems/bundler/issues/6471 and fix https://github.com/rubygems/bundler/pull/6728.
The recommendation remains: use the latest bundler 2.x
rubocop-rails
has a dependency onactivesupport >= 4.2.0
. So after the latest Rails 7 release, it's trying to installactivesupport-7.0.0
. Butactivesupport-7.0.0
has a minimum Ruby dependency of version >=2.7 So, if you're using Ruby <2.7, the gem installation fails.Note: We're using
rubocop-rails
in a style check Github action. So, it tries to install the latestactivesupport-7.0.0
on the specified ruby version in.ruby-version
which in our case is v2.6.6 and fails.Expected behavior
Gem installation should not fail for Ruby versions < 2.7
Actual behavior
Steps to reproduce the problem
gem install rubocop-rails
RuboCop version
NA
Co-authored by: @radiantshaw