You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This PR is the first PR of several to replace the untyped types for the precise types in all of the RBS signature files
The goal of splitting this process into multiple PRs is to make it easier for reviewers to go through the PRs, if anyone will prefer a big PR instead please let me know
Motivation and Context
Based on #10943 I created the following PRs to add RBS-type support to the ruby selenium library:
On #12844 I started adding support for RBS and I added the steep file configuration
On #13192 I extended the classes supported on RBS and updated the logger file
On #13234 I added RBS files for the entire selenium library,
however several of the autogenerated files only have the type defined as untyped instead of the precise type
aguspe
changed the title
Expand RBS typing support by replacing untypes with precise typing
[rb] Expand RBS typing support by replacing untypes with precise typing
Apr 13, 2024
2, because the changes are mostly type annotations and straightforward replacements of untyped with specific types. The PR is large but the nature of changes is repetitive and mostly involves updating method signatures with more precise types, which is generally less complex than logic changes.
🧪 Relevant tests
No
⚡ Possible issues
Possible Type Mismatch: The PR introduces specific types where previously 'untyped' was used. This could potentially lead to type mismatches if not all usages of these methods have been updated accordingly or if the inferred types are incorrect.
Incomplete Typing: Some elements still use 'untyped' within arrays or hashes, e.g., Array[untyped] or Hash[untyped, untyped]. This might indicate incomplete typing or areas where typing could be further improved.
Once this PR is merged I will keep improving the RBS-type support and in the meantime, I will work on my draft #13796 and I will add the correspondent RBS files for all the new classes and modules
Specify the types for the method and params parameters in the send_cmd method for better type safety
The send_cmd method still uses untyped for both method and params. For better type safety and clarity, consider specifying the expected types for these parameters.
Why: This suggestion addresses a significant improvement in type safety by specifying types for parameters in a method that currently uses untyped, which can greatly enhance code clarity and error prevention.
8
Specify the types within the array for the arguments parameter in the execute_atom method
The execute_atom method currently uses an array of untyped for the arguments parameter. For better type safety, consider specifying the types within the array.
Why: The suggestion to specify types within the array for better type safety is valid, but the existing code already includes specific types in the array, making this suggestion somewhat redundant.
5
Possible issue
Change the type of @additional_args to allow a combination of integers, booleans, and untyped elements within the array
The @additional_args attribute is currently typed as Integer | bool | Array[untyped]. It would be more flexible and accurate to allow for a combination of these types within the array. Consider changing it to Array[Integer | bool | untyped].
Why: The suggestion correctly identifies a potential improvement in type flexibility for the @additional_args attribute, which can enhance the code's robustness and clarity.
7
Best practice
Update the return type of add_option to include nil for better accuracy
The add_option method currently allows nil values for the value parameter, but the return type does not reflect this. Consider updating the return type to include nil.
Why: This suggestion is accurate in ensuring that the method signature reflects all possible return types, including nil, which improves the method's type accuracy.
…ng (SeleniumHQ#13709)
* Update atoms.rb signature types
* Start adding bidi types
* Extended types of devtools and edge
* Added firefox and safari types and removed unused signature
* Update chrome features with type and remove Safari error
* Update server and remove unused signature
* Expand Server type signature
* expanding type support on options
* Expand options types
* add extra options support
* Expand options support
---------
Co-authored-by: aguspe <agustin.pe94@gmail.com>
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
Description
This PR is the first PR of several to replace the untyped types for the precise types in all of the RBS signature files
The goal of splitting this process into multiple PRs is to make it easier for reviewers to go through the PRs, if anyone will prefer a big PR instead please let me know
Motivation and Context
Based on #10943 I created the following PRs to add RBS-type support to the ruby selenium library:
On #12844 I started adding support for RBS and I added the steep file configuration
On #13192 I extended the classes supported on RBS and updated the logger file
On #13234 I added RBS files for the entire selenium library,
however several of the autogenerated files only have the type defined as untyped instead of the precise type
Example
Before:
After:
Types of changes
Checklist
PR Type
Enhancement
Description
untyped
.Changes walkthrough 📝
10 files
server.rbs
Replace untyped attributes and methods with specific types
rb/sig/lib/selenium/server.rbs
String
,Integer
,bool
).untyped
.atoms.rbs
Update method signatures with specific types
rb/sig/lib/selenium/webdriver/atoms.rbs
untyped
.bidi.rbs
Replace untyped attributes and methods with specific types
rb/sig/lib/selenium/webdriver/bidi.rbs
WebSocketConnection
,Session
).untyped
.features.rbs
Update constants and methods with specific types
rb/sig/lib/selenium/webdriver/chrome/features.rbs
of
untyped
.options.rbs
Replace untyped attributes and methods with specific types
rb/sig/lib/selenium/webdriver/common/options.rbs
(e.g.,
Hash
,String
,Symbol
).untyped
.target_locator.rbs
Update method signatures with specific types
rb/sig/lib/selenium/webdriver/common/target_locator.rbs
untyped
.devtools.rbs
Replace untyped attributes and methods with specific types
rb/sig/lib/selenium/webdriver/devtools.rbs
(e.g.,
Hash
).untyped
.edge.rbs
Replace untyped attributes and methods with specific types
rb/sig/lib/selenium/webdriver/edge.rbs
(e.g.,
String
).firefox.rbs
Replace untyped attributes and methods with specific types
rb/sig/lib/selenium/webdriver/firefox.rbs
(e.g.,
String
).safari.rbs
Replace untyped attributes and methods with specific types
rb/sig/lib/selenium/webdriver/safari.rbs
(e.g.,
String
,bool
).