Skip to content

Commit a14b659

Browse files
authored
[rb] Reduce RBS errors to 0 (#14661)
1 parent 62aa0e5 commit a14b659

File tree

23 files changed

+55
-64
lines changed

23 files changed

+55
-64
lines changed

rb/Gemfile.lock

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ PATH
1313
GEM
1414
remote: https://rubygems.org/
1515
specs:
16-
activesupport (7.2.1.2)
16+
activesupport (7.2.2)
1717
base64
18+
benchmark (>= 0.3)
1819
bigdecimal
1920
concurrent-ruby (~> 1.0, >= 1.3.1)
2021
connection_pool (>= 2.2.5)
@@ -28,6 +29,7 @@ GEM
2829
public_suffix (>= 2.0.2, < 7.0)
2930
ast (2.4.2)
3031
base64 (0.2.0)
32+
benchmark (0.4.0)
3133
bigdecimal (3.1.8)
3234
bigdecimal (3.1.8-java)
3335
concurrent-ruby (1.3.4)
@@ -45,7 +47,7 @@ GEM
4547
ffi (1.17.0)
4648
ffi (1.17.0-java)
4749
ffi (1.17.0-x86_64-darwin)
48-
fileutils (1.7.2)
50+
fileutils (1.7.3)
4951
git (1.19.1)
5052
addressable (~> 2.8)
5153
rchardet (~> 1.8)
@@ -58,21 +60,21 @@ GEM
5860
rdoc (>= 4.0.0)
5961
reline (>= 0.4.2)
6062
jar-dependencies (0.4.1)
61-
json (2.7.5)
62-
json (2.7.5-java)
63+
json (2.8.1)
64+
json (2.8.1-java)
6365
language_server-protocol (3.17.0.3)
6466
listen (3.9.0)
6567
rb-fsevent (~> 0.10, >= 0.10.3)
6668
rb-inotify (~> 0.9, >= 0.9.10)
6769
logger (1.6.1)
6870
minitest (5.25.1)
6971
parallel (1.26.3)
70-
parser (3.3.5.0)
72+
parser (3.3.6.0)
7173
ast (~> 2.4.1)
7274
racc
73-
psych (5.1.2)
75+
psych (5.2.0)
7476
stringio
75-
psych (5.1.2-java)
77+
psych (5.2.0-java)
7678
jar-dependencies (>= 0.1.7)
7779
public_suffix (6.0.1)
7880
racc (1.8.1)
@@ -89,7 +91,7 @@ GEM
8991
rdoc (6.7.0)
9092
psych (>= 4.0.0)
9193
regexp_parser (2.9.2)
92-
reline (0.5.10)
94+
reline (0.5.11)
9395
io-console (~> 0.5)
9496
rexml (3.3.9)
9597
rspec (3.13.0)
@@ -105,7 +107,7 @@ GEM
105107
diff-lcs (>= 1.2.0, < 2.0)
106108
rspec-support (~> 3.13.0)
107109
rspec-support (3.13.1)
108-
rubocop (1.67.0)
110+
rubocop (1.68.0)
109111
json (~> 2.3)
110112
language_server-protocol (>= 3.17.0)
111113
parallel (~> 1.10)
@@ -115,7 +117,7 @@ GEM
115117
rubocop-ast (>= 1.32.2, < 2.0)
116118
ruby-progressbar (~> 1.7)
117119
unicode-display_width (>= 2.4.0, < 3.0)
118-
rubocop-ast (1.33.0)
120+
rubocop-ast (1.34.1)
119121
parser (>= 3.3.1.0)
120122
rubocop-capybara (2.21.0)
121123
rubocop (~> 1.41)
@@ -151,7 +153,7 @@ GEM
151153
securerandom (>= 0.1)
152154
strscan (>= 1.0.0)
153155
terminal-table (>= 2, < 4)
154-
stringio (3.1.1)
156+
stringio (3.1.2)
155157
strscan (3.1.0)
156158
strscan (3.1.0-java)
157159
terminal-table (3.0.2)
@@ -163,7 +165,7 @@ GEM
163165
addressable (>= 2.8.0)
164166
crack (>= 0.3.2)
165167
hashdiff (>= 0.4.0, < 2.0.0)
166-
webrick (1.8.2)
168+
webrick (1.9.0)
167169
websocket (1.2.11)
168170
yard (0.9.37)
169171

rb/lib/selenium/webdriver/bidi/log_handler.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def initialize(bidi)
3030
end
3131

3232
# @return [int] id of the handler
33+
# steep:ignore:start
3334
def add_message_handler(type)
3435
subscribe_log_entry unless @log_entry_subscribed
3536
@bidi.add_callback('log.entryAdded') do |params|
@@ -39,6 +40,7 @@ def add_message_handler(type)
3940
end
4041
end
4142
end
43+
# steep:ignore:end
4244

4345
# @param [int] id of the handler previously added
4446
def remove_message_handler(id)

rb/lib/selenium/webdriver/bidi/struct.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ def camel_to_snake(camel_str)
3737
end
3838
end
3939
end
40-
end
41-
42-
# BiDi
40+
end # BiDi
4341
end # WebDriver
4442
end # Selenium

rb/lib/selenium/webdriver/common/error.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,11 @@ def initialize(msg = '')
5050
super(URLS[class_name] ? "#{msg}; #{SUPPORT_MSG} #{URLS[class_name]}" : msg)
5151
end
5252

53+
# steep:ignore:start
5354
def class_name
54-
self.class.name&.split('::')&.last&.to_sym
55+
self.class.name.split('::')&.last&.to_sym
5556
end
57+
# steep:ignore:end
5658
end
5759

5860
#

rb/lib/selenium/webdriver/common/fedcm/account.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ class Account
3030
attr_reader :account_id, :email, :name, :given_name, :picture_url,
3131
:idp_config_url, :login_state, :terms_of_service_url, :privacy_policy_url
3232

33-
# Initializes a new account with the provided attributes.
34-
#
35-
# @param [Hash]
33+
# steep:ignore:start
3634
def initialize(**args)
3735
@account_id = args['accountId']
3836
@email = args['email']
@@ -44,6 +42,7 @@ def initialize(**args)
4442
@terms_of_service_url = args['termsOfServiceUrl']
4543
@privacy_policy_url = args['privacyPolicyUrl']
4644
end
45+
# steep:ignore:end
4746
end # Account
4847
end # FedCM
4948
end # WebDriver

rb/lib/selenium/webdriver/common/target_locator.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def parent_frame
5050
# @param type either :tab or :window
5151
#
5252

53+
# steep:ignore:start
5354
def new_window(type = :window)
5455
raise ArgumentError, "Valid types are :tab and :window, received: #{type.inspect}" unless %i[window
5556
tab].include?(type)
@@ -70,6 +71,7 @@ def new_window(type = :window)
7071
window(handle)
7172
end
7273
end
74+
# steep:ignore:end
7375

7476
#
7577
# switch to the given window handle

rb/lib/selenium/webdriver/remote/http/common.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def close
4848
# hook for subclasses - will be called on Driver#quit
4949
end
5050

51+
# steep:ignore:start
5152
def call(verb, url, command_hash)
5253
url = server_url.merge(url) unless url.is_a?(URI)
5354
headers = common_headers.dup
@@ -66,6 +67,7 @@ def call(verb, url, command_hash)
6667

6768
request verb, url, headers, payload
6869
end
70+
# steep:ignore:end
6971

7072
private
7173

rb/sig/lib/selenium/webdriver/bidi.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module Selenium
77

88
def initialize: (url: String) -> void
99

10-
def add_callback: -> Integer
10+
def add_callback: (String event) { () -> void } -> Integer
1111

1212
def close: () -> nil
1313

rb/sig/lib/selenium/webdriver/bidi/log_handler.rbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ module Selenium
1212

1313
def initialize: (BiDi bidi) -> void
1414

15-
def add_message_handler: (String type) { (untyped) -> untyped } -> Integer
15+
def add_message_handler: (String type) ?{ (untyped) -> untyped } -> Integer
1616

17-
def remove_message_handler: (Integer id) -> bool
17+
def remove_message_handler: (Integer id) -> bool?
1818

1919
private
2020

rb/sig/lib/selenium/webdriver/bidi/struct.rbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module Selenium
22
module WebDriver
33
class BiDi
4-
class Struct < ::Struct
5-
def self.new: (*untyped args) { (?) -> untyped } -> void
4+
class Struct < ::Struct[untyped]
5+
def self.new: (*untyped args) ?{ (self) [self: self] -> untyped } -> void
66

77
def self.camel_to_snake: (String camel_str) -> String
88
end

rb/sig/lib/selenium/webdriver/common/driver_finder.rbs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ module Selenium
1919
private
2020

2121
def paths: -> untyped
22+
23+
def to_args: -> Array[String]
2224
end
2325
end
2426
end

rb/sig/lib/selenium/webdriver/common/error.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module Selenium
77

88
ERROR_URL: String
99

10-
URLS: Hash[Symbol, String]
10+
URLS: Hash[Symbol?, String]
1111

1212
class WebDriverError < StandardError
1313
def initialize: (?String | Array[String] msg) -> void

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ module Selenium
2828

2929
def warn: (String message, ?id: Symbol | Array[Symbol] id) ?{ () -> void } -> void
3030

31-
def deprecate: (String old, ?String? new, ?id: Symbol | Array[Symbol] id, ?reference: String reference) { () -> void } -> (void)
31+
def deprecate: (String old, ?String? new, ?id: Symbol | Array[Symbol] id, ?reference: String reference) ?{ () -> void } -> untyped
3232

3333
def debug?: () -> bool
3434

3535
private
3636

3737
def create_logger: (String name, level: Symbol level) -> ::Logger
3838

39-
def discard_or_log: (Symbol level, String message, (Symbol | Array[::Symbol]) | [(Symbol | Array[Symbol])] id) ?{ () -> void } -> (void)
39+
def discard_or_log: (Symbol level, String message, (Symbol | Array[::Symbol]) | [(Symbol | Array[Symbol])] id) ?{ () -> void } -> untyped
4040
end
4141
end
4242
end

rb/sig/lib/selenium/webdriver/common/options.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Selenium
22
module WebDriver
33
class Options
4-
@options: Hash[String | Symbol, String | Numeric | bool?]
4+
@options: Hash[untyped, untyped]
55

66
W3C_OPTIONS: Array[Symbol]
77

rb/sig/lib/selenium/webdriver/common/selenium_manager.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module Selenium
1212

1313
def self.bin_path: () -> String
1414

15-
def self.binary_paths: (Array[String] arguments) -> Hash[untyped, Array[String]]
15+
def self.binary_paths: (*String arguments) -> Hash[untyped, Array[String]]
1616

1717
private
1818

rb/sig/lib/selenium/webdriver/common/service.rbs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ module Selenium
55

66
DEFAULT_PORT: untyped
77

8+
DRIVER_PATH_ENV_KEY: String
9+
810
self.@driver_path: untyped
911

1012
@executable_path: untyped

rb/sig/lib/selenium/webdriver/common/websocket_connection.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module Selenium
3535

3636
def initialize: (url: untyped) -> void
3737

38-
def add_callback: (untyped event, untyped id) -> untyped
38+
def add_callback: (untyped event) { () -> void } -> untyped
3939

4040
def close: () -> untyped
4141

rb/sig/lib/selenium/webdriver/fedcm/account.rbs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,31 @@
11
module Selenium
22
module WebDriver
33
module FedCM
4-
# Represents an account displayed in a FedCm account list.
5-
# See: https://w3c-fedid.github.io/FedCM/#dictdef-identityprovideraccount
6-
# https://w3c-fedid.github.io/FedCM/#webdriver-accountlist
74
class Account
85
@account_id: String
9-
106
@email: String
11-
127
@name: String
13-
148
@given_name: String
15-
169
@picture_url: String
17-
1810
@idp_config_url: String
19-
2011
@login_state: String
21-
2212
@terms_of_service_url: String
23-
2413
@privacy_policy_url: String
2514

2615
LOGIN_STATE_SIGNIN: String
27-
2816
LOGIN_STATE_SIGNUP: String
2917

3018
attr_reader account_id: String
31-
3219
attr_reader email: String
33-
3420
attr_reader name: String
35-
3621
attr_reader given_name: String
37-
3822
attr_reader picture_url: String
39-
4023
attr_reader idp_config_url: String
41-
4224
attr_reader login_state: String
43-
4425
attr_reader terms_of_service_url: String
45-
4626
attr_reader privacy_policy_url: String
4727

48-
def initialize: (**untyped args) -> void
28+
def initialize: (**String args) -> void
4929
end
5030
end
5131
end

rb/sig/lib/selenium/webdriver/firefox/options.rbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module Selenium
66

77
@profile: untyped
88

9-
@options: Hash[Symbol, untyped]
9+
@options: Hash[untyped, untyped]
1010

1111
attr_accessor debugger_address: untyped
1212

@@ -30,7 +30,7 @@ module Selenium
3030

3131
def log_level=: (untyped level) -> untyped
3232

33-
def enable_android: (?package: ::String, ?serial_number: untyped?, ?activity: untyped?, ?intent_arguments: untyped?) -> untyped
33+
def enable_android: (?package: String, ?serial_number: untyped?, ?activity: untyped?, ?intent_arguments: untyped?) -> untyped
3434

3535
private
3636

rb/sig/lib/selenium/webdriver/remote/bidi_bridge.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module Selenium
1010

1111
def quit: () -> nil
1212

13-
def close: () -> nil
13+
def close: () -> untyped
1414
end
1515
end
1616
end

0 commit comments

Comments
 (0)