Closed gavindidrichsen closed 3 weeks ago
A workaround would be to update rubocop
to a bersion that supports “contextual”.
Do we need to bump the dependency like we planned to here? https://github.com/rubocop/rubocop-rspec/pull/1901
Wondering why https://github.com/rubocop/rubocop-rspec/pull/1882 didn’t work? Wondering why ‘bundle install’ output is so dry https://github.com/rubocop/rubocop-rspec/actions/runs/9148652715/job/25151426029
Wondering why #1882 didn’t work? Wondering why ‘bundle install’ output is so dry https://github.com/rubocop/rubocop-rspec/actions/runs/9148652715/job/25151426029
Confirming that CI testing with the oldest RuboCop version does indeed work; see #1920.
The problem must be elsewhere.
I ran the following on local: https://github.com/puppetlabs/dependency_checker
Revert to hacks for rubocop-factory_bot and rubocop-rspec_rails
diff --git a/Gemfile b/Gemfile
index 5985c04..18d0b4a 100644
--- a/Gemfile
+++ b/Gemfile
@@ -15,6 +15,4 @@ group :test do
gem 'rubocop', '~> 1.50.0', require: false
gem 'rubocop-performance', '~> 1.16', require: false
gem 'rubocop-rspec', '~> 2.19', require: false
- gem 'rubocop-factory_bot', '!= 2.26.0', require: false
- gem 'rubocop-rspec_rails', '!= 2.29.0', require: false
end
❯ bundle exec rubocop -V
/ydah/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rubocop-1.50.2/lib/rubocop/formatter/html_formatter.rb:3: warning: base64 was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add base64 to your Gemfile or gemspec. Also contact author of rubocop-1.50.2 to add base64 into its gemspec.
Error: Property AutoCorrect of cop FactoryBot/CreateList is supposed to be a boolean and contextual is not.
Change to gem 'rubocop', '~> 1.61.0', require: false
diff --git a/Gemfile b/Gemfile
index 5985c04..2a75e86 100644
--- a/Gemfile
+++ b/Gemfile
@@ -12,9 +12,7 @@ group :test do
gem 'simplecov', require: false
gem 'simplecov-console', require: false
gem 'rspec', '~> 3.0', require: false
- gem 'rubocop', '~> 1.50.0', require: false
+ gem 'rubocop', '~> 1.61.0', require: false
gem 'rubocop-performance', '~> 1.16', require: false
gem 'rubocop-rspec', '~> 2.19', require: false
- gem 'rubocop-factory_bot', '!= 2.26.0', require: false
- gem 'rubocop-rspec_rails', '!= 2.29.0', require: false
end
❯ bundle exec rubocop -V
1.61.0 (using Parser 3.3.2.0, rubocop-ast 1.31.3, running on ruby 3.3.0) [arm64-darwin23]
- rubocop-performance 1.21.0
- rubocop-rspec 2.31.0
I have not yet figured out why this happens but at least v1.61 or higher seems to solve it.
Having the same issue setting to 1.61 does not fix the issue.
Can the problem solved by upgrading to rubocop-rspec v3.0.1?
v3.0.1 appears to have fixed it all.
I checked it, and it seems fixed 👍🏻
The latest versions of rubocop-factory_bot and rubocop-respec_rails are causing rubocop-rspec to break with something like the following:
Manually correcting the above gems fixes the issue, e.g.,
Given this repository as an example, puppetlabs/dependency_checker, I can see from the Gemspec.lock the rubocop-rspec seems to be pulling the above dependencies in.
Excluding the lates versions as below fixes the issue: