wspurgin / rspec-sidekiq

RSpec for Sidekiq
https://github.com/wspurgin/rspec-sidekiq
Other
663 stars 132 forks source link

Pattern matching warnings on Ruby 2.7 #226

Closed r7kamura closed 2 months ago

r7kamura commented 2 months ago

I'm using rspec-sidekiq on Ruby 2.7 and got the following warning:

Pattern matching is experimental, and the behavior may change in future versions of Ruby!

from here:

https://github.com/wspurgin/rspec-sidekiq/blob/854088b242d29229162c82d27488d3e54fe06a60/lib/rspec/sidekiq/matchers/base.rb#L126-L135

This is probably due to the fact that pattern matching is experimental in Ruby 2.7, but the following change introduced code that uses it.

Currently, rspec-sidekiq claims to support Ruby 2.7 and above, so it would be an undesirable situation for such a warning to appear on supported Ruby versions.

https://github.com/wspurgin/rspec-sidekiq/blob/854088b242d29229162c82d27488d3e54fe06a60/rspec-sidekiq.gemspec#L40

Why not either stop using this pattern matching while supporting Ruby 2.7 or stop supporting Ruby 2.7?

wspurgin commented 2 months ago

TL;DR - since you came in with a PR (thank you!) I'm fine getting rid of the warnings. But "supporting" EOL Ruby versions in my mind is about functionality working. I have 0 cares for EOL Ruby versions spouting warnings that can be suppressed already by those using the EOL Ruby versions.


Ruby 2.7 is definitely far past EOL, but I know plenty of legacy systems still use it. I don't really want to build for Ruby 2.7 to he happy.

It is just a warning about it being experimental ⚠️ and we happen to know that Ruby 3+ (thus far) support it in that form. While warnings might be annoying, "supporting" Ruby 2.7 in my mind doesn't necessitate zero warnings, just that functionality works as expected in Ruby 2.7.

FWIW, These warnings can be suppressed already with -W:no-experimental or with Warning[:experimental] = false

All that said, I'm agnostic to pattern matching anyway. It's just a readability benefit and nothing else. And since you have a PR ready to go, why not?