-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
[rb] Fix "no anonymous block parameter" in ruby 3.1 #15315
[rb] Fix "no anonymous block parameter" in ruby 3.1 #15315
Conversation
When running on Ruby 3.1.2p20 (shipped with Debian 12), the use of anonymous blocks cause exceptions to be raised. This was fixed in later Ruby versions, but will not be backported to the version of Ruby shipped by Debian 12 nor the versions or ruby shipped with all Debian derivative. Explicitly name blocks to avoid triggering this issue with affected versions of Ruby. While here, also adjust the rubocop configuration to detect this issue and mandate the use of explicitly named blocks. Signed-off-by: Romain Tartière <romain@blogreen.org>
ec01f7f
to
c9ce790
Compare
Skip this version as it breaks at least with Ruby 3.1 on Debian 12. A PR was opened upstream to fix the issue: SeleniumHQ/selenium#15315
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
@VietND96 Yes, I can cut a release once this is merged |
FYI, I added a comment for what seems to be the root cause of the Ruby tests failures here: I can add a commit to this PR or create another PR to try to address it is desired, just tell me how you prefer to proceed. |
@smortex should be fixed in 4.29.1 |
Fix "no anonymous block parameter" in ruby 3.1 When running on Ruby 3.1.2p20 (shipped with Debian 12), the use of anonymous blocks cause exceptions to be raised. This was fixed in later Ruby versions, but will not be backported to the version of Ruby shipped by Debian 12 nor the versions or ruby shipped with all Debian derivative. Explicitly name blocks to avoid triggering this issue with affected versions of Ruby. While here, also adjust the rubocop configuration to detect this issue and mandate the use of explicitly named blocks. Signed-off-by: Romain Tartière <romain@blogreen.org> Co-authored-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
User description
Motivation and Context
When running on Ruby 3.1.2p20 (shipped with Debian 12), the use of anonymous blocks cause exceptions to be raised. This was fixed in later Ruby versions, but will not be backported to the version of Ruby shipped by Debian 12 nor the versions or ruby shipped with all Debian derivative (e.g. Ubuntu).
This PR by dependabot show the failure: the previously working test suite cannot start:
opus-codium/pakotoa#272
The log (reproduced bellow) shows that the CI setup does not complete successfully:
A similar issue in Rails was fixed in a similar way here:
rails/rails#51476
Types of changes
Checklist
My change requires a change to the documentation.(n/a)I have updated the documentation accordingly.(n/a)I have added tests to cover my changes.(n/a)PR Type
Bug fix, Enhancement
Description
Fix compatibility issues with Ruby 3.1 by replacing anonymous block parameters with explicitly named ones.
Update
rubocop
configuration to enforce explicit block naming.Ensure backward compatibility with Ruby versions used in Debian and its derivatives.
Changes walkthrough 📝
9 files
Replace anonymous block parameters with explicit ones in
net_http_start
.Use explicit block parameters in callback methods.
Replace anonymous block parameters in log handling methods.
Use explicit block parameters in network event handling.
Replace anonymous block parameters in network interception methods.
Use explicit block parameters in request and response handler methods.
Replace anonymous block parameters in script message handler methods.
Use explicit block parameters in command addition methods.
Replace anonymous block parameters in guard condition methods.
1 files
Update rubocop configuration to enforce explicit block naming.