-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove unknown hash keyword arguments #1757
Conversation
Do you know of any locations where more "easy to understand" discussion is ongoing. I had a look at the initial PR's but I feel (Albeit late at night), I don't really "get it" other than it is more optimal for large hashes. The code in question is very old and I'd rather not edit it without knowing exactly what the previous behaviour was doing. |
So the commit that causes the issue is: ruby/ruby@9594db0 you can see from the tests that unexpected keywords are expected to now raise an error. I went sperlunking through the code and the original definition was actually passing a hash into |
As an aside, rubocop also seems to fail on main? But this patch now makes tests pass locally |
rubocop failing is a sep issue. Upgrading to 1.61 fixes it which I have done elsewhere. So don't worry about CI for now. I'll take a re-read of the stuff you sent over. In principle I have no issues just this is super ancient code. |
NULL_CONVERSIONS = Hash.new(strict: false, proc: ->(cell_value) { cell_value }).freeze | ||
# This is a Hash being initialized with a default value of a Hash, DO NOT REFORMAT TO REMOVE {} | ||
# Future versions [3.4.0+] of ruby will interpret these as keywords and break. | ||
NULL_CONVERSIONS = Hash.new({strict: false, proc: ->(cell_value) { cell_value }}).freeze |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you space out the arguments of the hash so { strict.....
and rebase with main
. Rubocop "should" now pass
Rebased and checked locally that rubocop passes, and tests pass on Ruby 3.3, on 3.4 there is also the need to bring in the base64 gem, and some output stuff has changed but I figure those changes are out of scope for this PR? Although I could easily add the dependency |
I've enqueued the pipelines for now. I figure this does some improvements and I'm working on a v10 release to tie in with getting a lot of the dependencies updated and interopping again. So I will come back to this when I can |
Forgot to post here - The failure in CI is unrelated and I'm working on fixing this up - it's something we should have done differently in the CCK. @JonRowe - If you want to write up a changelog entry I'll get this merged ASAP - The next version cut will be v10 as we're doing some big changes to the core hexagon and updating the minimum ruby support |
@luke-hill I've added a changelog entry and rebased |
Thanks for this @JonRowe - All merged in now. V10 is likely going to be a bit bigger as we move some of the internal requirements out into cucumber-core, so I'm not sure entirely when this will be released. But it'll be in the next version |
Thanks! |
NULL_CONVERSIONS = Hash.new(strict: false, proc: ->(cell_value) { cell_value }).freeze | ||
# This is a Hash being initialized with a default value of a Hash, DO NOT REFORMAT TO REMOVE {} | ||
# Future versions [3.4.0+] of ruby will interpret these as keywords and break. | ||
NULL_CONVERSIONS = Hash.new({ strict: false, proc: ->(cell_value) { cell_value } }).freeze |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not simply:
NULL_CONVERSIONS = { strict: false, proc: ->(cell_value) { cell_value } }.freeze
? The Hash.new
seems redundant here.
Unless Hash
here is not ::Hash
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll be honest, this is very old code and I don't know the precise way it is used. This was the smallest safest change suggested.
Description
Ruby head adds a capacity keyword option to Hash which causes other keywords passed to
Hash.new
to be validated, this causes an error when running Cucumber 9.2.0 on ruby-head (example from an rspec-expectations build):Type of change
Please delete options that are not relevant.
Checklist:
bundle exec rubocop
reports no offenses