thoughtbot / factory_bot_rails

Factory Bot ♥ Rails
https://thoughtbot.com/services/ruby-on-rails
MIT License
3.07k stars 369 forks source link

Fix standardrb violations #482

Open sarahraqueld opened 3 months ago

sarahraqueld commented 3 months ago

Fixes https://github.com/thoughtbot/factory_bot_rails/issues/474

Problem

Standard is failing:

spec/support/macros/define_constant.rb:10:40: Style/ArgumentsForwarding: Use anonymous block arguments forwarding (&).
spec/support/macros/define_constant.rb:11:52: Style/ArgumentsForwarding: Use anonymous block arguments forwarding (&).
spec/support/macros/define_constant.rb:20:32: Style/ArgumentsForwarding: Use anonymous block arguments forwarding (&).
spec/support/macros/define_constant.rb:25:43: Style/ArgumentsForwarding: Use anonymous block arguments forwarding (&).

Running standardrb --fix changes &block to &, however, this only works for ruby >= 3.2.

Since we still support Ruby 3.0, this change introduces these errors:

SyntaxError:

  /home/runner/work/factory_bot_rails/factory_bot_rails/spec/support/macros/define_constant.rb:10: syntax error, unexpected ')', expecting local variable or method
  ...ne_model(name, columns = {}, &)
  ...                              ^
sarahraqueld commented 1 month ago

Ideas on how to fix this:

Remove support for Ruby 3.0 Find a way to make Standard support both versions (& and &block)

sarahraqueld commented 1 month ago

Yay! 🎉

oops, you approved the wrong PR, I think you meant to approve this one https://github.com/thoughtbot/factory_bot_rails/pull/489 :D

smaboshe commented 1 month ago

Yay! 🎉

oops, you approved the wrong PR, I think you meant to approve this one #489 :D

Oops! 😅 ... Thank you for taking care of this!