rubocop / rubocop-factory_bot

Code style checking for factory_bot files.
https://docs.rubocop.org/rubocop-factory_bot
MIT License
44 stars 13 forks source link

undefined method `inject_defaults!' for RuboCop::ConfigLoader:Class with rubocop < 1.50 #89

Closed agrieser-healthie closed 8 months ago

agrieser-healthie commented 8 months ago

Per gemspec, requires rubocop ~> 1.33, but with versions below 1.50 it produces an exception:

undefined method `inject_defaults!' for RuboCop::ConfigLoader:Class

Upgrading rubocop to 1.50 or higher fixes this issue

ruby 3.2.2 Rails 6.1.7.6 factory_bot (6.4.2) factory_bot_rails (6.4.2)

pirj commented 8 months ago

I thought it was released earlier than in 1.50, but certainly not in 1.33. Our parent depends on 1.40, should we follow?

Do you use this gem without rubocop-rspec, @agrieser-healthie ?

agrieser-healthie commented 8 months ago

I have the following installed:

rubocop (1.50.0) rubocop-rails (2.17.2) rubocop-graphql (1.1.1) rubocop-rspec (2.14.2) rubocop-performance (1.15.0) rubocop-factory_bot (2.24.0)

Will be getting them updated shortly, just through I would raise the issue since I stumbled into it. Pretty sure I tried 1.40 and got the same error, I was trying to do as small an upgrade as possible to add this gem.

pirj commented 8 months ago

This gem is a dependency of rubocop-rspec since 2.22, and all cops were part of it prior to that. But in 3.0 we plan to separate them. Thanks for being an early adopter.

As for rubocop-rspec and inject_defaults I recall I couldn’t make it work.

Would you please send a PR to bump the dependency to 1.41 or whatever version of rubocop contains this, @agrieser-healthie ?

pirj commented 8 months ago

@agrieser-healthie can you please check if using rubocop-factory_bot from a bump-rubocop-version branch fixes your issue?

pirj commented 8 months ago

Or master since we’ve merged the fix