Skip to content
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] Update minimum Ruby to 3.1 #14685

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open

[rb] Update minimum Ruby to 3.1 #14685

wants to merge 1 commit into from

Conversation

p0deje
Copy link
Member

@p0deje p0deje commented Oct 30, 2024

User description

3.0 is EOL in Apr 2024
https://endoflife.date/ruby


PR Type

enhancement, dependencies


Description

  • Updated the minimum required Ruby version to 3.1 across gemspecs and configuration files.
  • Utilized shorthand block syntax in various Ruby methods for cleaner code.
  • Updated JRuby and Ruby versions in CI workflows to ensure compatibility.
  • Adjusted gem checksums in Bazel configuration to match updated dependencies.
  • Updated documentation to reflect the new Ruby version requirement.

Changes walkthrough 📝

Relevant files
Enhancement
8 files
server.rb
Use shorthand block syntax in server methods                         

rb/lib/selenium/server.rb

  • Updated method signatures to use shorthand block syntax.
+3/-3     
bidi.rb
Use shorthand block syntax in BiDi methods                             

rb/lib/selenium/webdriver/bidi.rb

  • Updated method signatures to use shorthand block syntax.
+2/-2     
log_inspector.rb
Use shorthand block syntax in log inspector methods           

rb/lib/selenium/webdriver/bidi/log_inspector.rb

  • Updated method signatures to use shorthand block syntax.
+4/-4     
has_network_interception.rb
Use shorthand block syntax in network interception methods

rb/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb

  • Updated method signatures to use shorthand block syntax.
+2/-2     
logger.rb
Use `intersect?` method for array intersection                     

rb/lib/selenium/webdriver/common/logger.rb

  • Replaced array intersection logic with intersect? method.
+1/-1     
script.rb
Use shorthand block syntax in script methods                         

rb/lib/selenium/webdriver/common/script.rb

  • Updated method signatures to use shorthand block syntax.
+4/-4     
bridge.rb
Use shorthand block syntax in bridge methods                         

rb/lib/selenium/webdriver/remote/bridge.rb

  • Updated method signatures to use shorthand block syntax.
+2/-2     
guards.rb
Use shorthand block syntax in guard methods                           

rb/lib/selenium/webdriver/support/guards.rb

  • Updated method signatures to use shorthand block syntax.
+2/-2     
Dependencies
4 files
selenium-devtools.gemspec
Update required Ruby version to 3.1 in gemspec                     

rb/selenium-devtools.gemspec

  • Updated required Ruby version to 3.1.
+1/-1     
selenium-webdriver.gemspec
Update required Ruby version to 3.1 in gemspec                     

rb/selenium-webdriver.gemspec

  • Updated required Ruby version to 3.1.
+1/-1     
MODULE.bazel
Update gem checksums in Bazel configuration                           

MODULE.bazel

  • Updated gem checksums for dependencies.
+22/-22 
.ruby-version
Update Ruby version to 3.1.6                                                         

rb/.ruby-version

  • Updated Ruby version to 3.1.6.
+1/-1     
Configuration changes
3 files
ci-rbe.yml
Update JRuby version in CI workflow                                           

.github/workflows/ci-rbe.yml

  • Updated JRuby version in CI workflow.
+2/-2     
ci-ruby.yml
Update Ruby versions in CI matrix                                               

.github/workflows/ci-ruby.yml

  • Updated Ruby versions in CI matrix.
+6/-6     
.rubocop.yml
Update target Ruby version in RuboCop configuration           

rb/.rubocop.yml

  • Updated target Ruby version to 3.1.
+1/-1     
Documentation
1 files
README.md
Update supported Ruby version in README                                   

rb/README.md

  • Updated supported Ruby version to 3.1.
+1/-1     

💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

Copy link
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Performance Improvement
The change from (@ignored & id).any? to @ignored.intersect?(id) may improve performance for large sets. Verify if this change is intentional and if it maintains the same functionality.

Configuration Update
The target Ruby version has been updated to 3.1. Ensure that all code is compatible with Ruby 3.1 and that no deprecated features are being used.

Documentation Update
The supported Ruby version in the README has been updated to 3.1. Verify that this change is consistent with other documentation and release notes.

Copy link
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Score
Enhancement
Replace manual intersection check with the intersect? method for improved readability and potential performance

Use the intersect? method instead of checking for any intersection manually. This is
more idiomatic and potentially more efficient.

rb/lib/selenium/webdriver/common/logger.rb [196]

-return if (@ignored & id).any?
+return if @ignored.intersect?(id)
  • Apply this suggestion
Suggestion importance[1-10]: 9

Why: The suggestion accurately reflects the change made in the PR, replacing a manual intersection check with the intersect? method, which is more idiomatic and potentially more efficient in Ruby 3.1.

9
Use method chaining to improve readability of conditional statements

Consider using the then method to chain the conditional return, improving code
readability.

rb/lib/selenium/webdriver/common/logger.rb [196-197]

 return if @ignored.intersect?(id)
-return if @allowed.any? && (@allowed & id).none?
+return if @allowed.any?.then { (@allowed & id).none? }
  • Apply this suggestion
Suggestion importance[1-10]: 5

Why: While the suggestion to use method chaining with then could improve readability, it is a stylistic choice and does not significantly impact functionality or performance. The original code is already clear and concise.

5

💡 Need additional feedback ? start a PR chat

Copy link
Contributor

codiumai-pr-agent-pro bot commented Oct 30, 2024

CI Failure Feedback 🧐

(Checks updated until commit a2db48a)

Action: Ruby / Unit Tests (truffleruby-24.1.1, ubuntu) / Unit Tests (truffleruby-24.1.1, ubuntu)

Failed stage: Run Bazel [❌]

Failed test name: ""

Failure summary:

The action failed due to the following reasons:

  • An error occurred during the fetch of the repository rules_rubyruby~ruby because the Ruby version
    truffleruby-24.1.1 was not found in ruby-build definitions.
  • This missing definition caused the package @@rules_rubyruby~ruby// to fail to fetch, leading to
    the failure of the target //rb/spec/unit/selenium/webdriver:guard.
  • As a result, the build analysis failed, and no test targets were found, although testing was
    requested.

  • Relevant error logs:
    1:  ##[group]Operating System
    2:  Ubuntu
    ...
    
    971:  Package 'php-symfony-debug-bundle' is not installed, so not removed
    972:  Package 'php-symfony-dependency-injection' is not installed, so not removed
    973:  Package 'php-symfony-deprecation-contracts' is not installed, so not removed
    974:  Package 'php-symfony-discord-notifier' is not installed, so not removed
    975:  Package 'php-symfony-doctrine-bridge' is not installed, so not removed
    976:  Package 'php-symfony-doctrine-messenger' is not installed, so not removed
    977:  Package 'php-symfony-dom-crawler' is not installed, so not removed
    978:  Package 'php-symfony-dotenv' is not installed, so not removed
    979:  Package 'php-symfony-error-handler' is not installed, so not removed
    ...
    
    1864:  �[32mAnalyzing:�[0m 63 targets (199 packages loaded, 1253 targets configured)
    1865:  �[32m[1 / 1]�[0m checking cached actions
    1866:  �[32mAnalyzing:�[0m 63 targets (200 packages loaded, 1469 targets configured)
    1867:  �[32m[1 / 1]�[0m checking cached actions
    1868:  �[32mINFO: �[0mRepository rules_ruby~~ruby~ruby instantiated at:
    1869:  <builtin>: in <toplevel>
    1870:  Repository rule rb_download defined at:
    1871:  /home/runner/.bazel/external/rules_ruby~/ruby/private/download.bzl:242:30: in <toplevel>
    1872:  �[31m�[1mERROR: �[0mAn error occurred during the fetch of repository 'rules_ruby~~ruby~ruby':
    1873:  Traceback (most recent call last):
    1874:  File "/home/runner/.bazel/external/rules_ruby~/ruby/private/download.bzl", line 90, column 32, in _rb_download_impl
    1875:  _install_via_ruby_build(repository_ctx, version)
    1876:  File "/home/runner/.bazel/external/rules_ruby~/ruby/private/download.bzl", line 230, column 13, in _install_via_ruby_build
    1877:  fail("%s\n%s" % (result.stdout, result.stderr))
    1878:  Error in fail: 
    1879:  ruby-build: definition not found: truffleruby-24.1.1
    1880:  �[31m�[1mERROR: �[0mno such package '@@rules_ruby~~ruby~ruby//': 
    1881:  ruby-build: definition not found: truffleruby-24.1.1
    1882:  �[31m�[1mERROR: �[0m/home/runner/work/selenium/selenium/rb/spec/unit/selenium/webdriver/BUILD.bazel:28:17: //rb/spec/unit/selenium/webdriver:guard depends on @@rules_ruby~~ruby~ruby//:toolchain in repository @@rules_ruby~~ruby~ruby which failed to fetch. no such package '@@rules_ruby~~ruby~ruby//': 
    1883:  ruby-build: definition not found: truffleruby-24.1.1
    1884:  �[31m�[1mERROR: �[0mAnalysis of target '//rb/spec/unit/selenium/webdriver:guard' failed; build aborted: Analysis failed
    1885:  �[32mINFO: �[0mElapsed time: 12.203s, Critical Path: 1.52s
    1886:  �[32mINFO: �[0m1 process: 1 internal.
    1887:  �[31m�[1mERROR: �[0mBuild did NOT complete successfully
    1888:  �[31m�[1mFAILED:�[0m 
    1889:  �[31m�[1mERROR: �[0mNo test targets were found, yet testing was requested
    1890:  �[0m
    1891:  ##[error]Process completed with exit code 1.
    

    ✨ CI feedback usage guide:

    The CI feedback tool (/checks) automatically triggers when a PR has a failed check.
    The tool analyzes the failed checks and provides several feedbacks:

    • Failed stage
    • Failed test name
    • Failure summary
    • Relevant error logs

    In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR:

    /checks "https://github.com/{repo_name}/actions/runs/{run_number}/job/{job_number}"
    

    where {repo_name} is the name of the repository, {run_number} is the run number of the failed check, and {job_number} is the job number of the failed check.

    Configuration options

    • enable_auto_checks_feedback - if set to true, the tool will automatically provide feedback when a check is failed. Default is true.
    • excluded_checks_list - a list of checks to exclude from the feedback, for example: ["check1", "check2"]. Default is an empty list.
    • enable_help_text - if set to true, the tool will provide a help message with the feedback. Default is true.
    • persistent_comment - if set to true, the tool will overwrite a previous checks comment with the new feedback. Default is true.
    • final_update_message - if persistent_comment is true and updating a previous checks message, the tool will also create a new message: "Persistent checks updated to latest commit". Default is true.

    See more information about the checks tool in the docs.

    3.0 is EOL in Apr 2024
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant