Skip to content

Commit

Permalink
[rb] Reduce RBS errors to 0 (#14661)
Browse files Browse the repository at this point in the history
  • Loading branch information
aguspe authored Nov 10, 2024
1 parent 62aa0e5 commit a14b659
Show file tree
Hide file tree
Showing 23 changed files with 55 additions and 64 deletions.
26 changes: 14 additions & 12 deletions rb/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ PATH
GEM
remote: https://rubygems.org/
specs:
activesupport (7.2.1.2)
activesupport (7.2.2)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
Expand All @@ -28,6 +29,7 @@ GEM
public_suffix (>= 2.0.2, < 7.0)
ast (2.4.2)
base64 (0.2.0)
benchmark (0.4.0)
bigdecimal (3.1.8)
bigdecimal (3.1.8-java)
concurrent-ruby (1.3.4)
Expand All @@ -45,7 +47,7 @@ GEM
ffi (1.17.0)
ffi (1.17.0-java)
ffi (1.17.0-x86_64-darwin)
fileutils (1.7.2)
fileutils (1.7.3)
git (1.19.1)
addressable (~> 2.8)
rchardet (~> 1.8)
Expand All @@ -58,21 +60,21 @@ GEM
rdoc (>= 4.0.0)
reline (>= 0.4.2)
jar-dependencies (0.4.1)
json (2.7.5)
json (2.7.5-java)
json (2.8.1)
json (2.8.1-java)
language_server-protocol (3.17.0.3)
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.6.1)
minitest (5.25.1)
parallel (1.26.3)
parser (3.3.5.0)
parser (3.3.6.0)
ast (~> 2.4.1)
racc
psych (5.1.2)
psych (5.2.0)
stringio
psych (5.1.2-java)
psych (5.2.0-java)
jar-dependencies (>= 0.1.7)
public_suffix (6.0.1)
racc (1.8.1)
Expand All @@ -89,7 +91,7 @@ GEM
rdoc (6.7.0)
psych (>= 4.0.0)
regexp_parser (2.9.2)
reline (0.5.10)
reline (0.5.11)
io-console (~> 0.5)
rexml (3.3.9)
rspec (3.13.0)
Expand All @@ -105,7 +107,7 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rubocop (1.67.0)
rubocop (1.68.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand All @@ -115,7 +117,7 @@ GEM
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.33.0)
rubocop-ast (1.34.1)
parser (>= 3.3.1.0)
rubocop-capybara (2.21.0)
rubocop (~> 1.41)
Expand Down Expand Up @@ -151,7 +153,7 @@ GEM
securerandom (>= 0.1)
strscan (>= 1.0.0)
terminal-table (>= 2, < 4)
stringio (3.1.1)
stringio (3.1.2)
strscan (3.1.0)
strscan (3.1.0-java)
terminal-table (3.0.2)
Expand All @@ -163,7 +165,7 @@ GEM
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webrick (1.8.2)
webrick (1.9.0)
websocket (1.2.11)
yard (0.9.37)

Expand Down
2 changes: 2 additions & 0 deletions rb/lib/selenium/webdriver/bidi/log_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def initialize(bidi)
end

# @return [int] id of the handler
# steep:ignore:start
def add_message_handler(type)
subscribe_log_entry unless @log_entry_subscribed
@bidi.add_callback('log.entryAdded') do |params|
Expand All @@ -39,6 +40,7 @@ def add_message_handler(type)
end
end
end
# steep:ignore:end

# @param [int] id of the handler previously added
def remove_message_handler(id)
Expand Down
4 changes: 1 addition & 3 deletions rb/lib/selenium/webdriver/bidi/struct.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ def camel_to_snake(camel_str)
end
end
end
end

# BiDi
end # BiDi
end # WebDriver
end # Selenium
4 changes: 3 additions & 1 deletion rb/lib/selenium/webdriver/common/error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ def initialize(msg = '')
super(URLS[class_name] ? "#{msg}; #{SUPPORT_MSG} #{URLS[class_name]}" : msg)
end

# steep:ignore:start
def class_name
self.class.name&.split('::')&.last&.to_sym
self.class.name.split('::')&.last&.to_sym
end
# steep:ignore:end
end

#
Expand Down
5 changes: 2 additions & 3 deletions rb/lib/selenium/webdriver/common/fedcm/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ class Account
attr_reader :account_id, :email, :name, :given_name, :picture_url,
:idp_config_url, :login_state, :terms_of_service_url, :privacy_policy_url

# Initializes a new account with the provided attributes.
#
# @param [Hash]
# steep:ignore:start
def initialize(**args)
@account_id = args['accountId']
@email = args['email']
Expand All @@ -44,6 +42,7 @@ def initialize(**args)
@terms_of_service_url = args['termsOfServiceUrl']
@privacy_policy_url = args['privacyPolicyUrl']
end
# steep:ignore:end
end # Account
end # FedCM
end # WebDriver
Expand Down
2 changes: 2 additions & 0 deletions rb/lib/selenium/webdriver/common/target_locator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def parent_frame
# @param type either :tab or :window
#

# steep:ignore:start
def new_window(type = :window)
raise ArgumentError, "Valid types are :tab and :window, received: #{type.inspect}" unless %i[window
tab].include?(type)
Expand All @@ -70,6 +71,7 @@ def new_window(type = :window)
window(handle)
end
end
# steep:ignore:end

#
# switch to the given window handle
Expand Down
2 changes: 2 additions & 0 deletions rb/lib/selenium/webdriver/remote/http/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def close
# hook for subclasses - will be called on Driver#quit
end

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

request verb, url, headers, payload
end
# steep:ignore:end

private

Expand Down
2 changes: 1 addition & 1 deletion rb/sig/lib/selenium/webdriver/bidi.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Selenium

def initialize: (url: String) -> void

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

def close: () -> nil

Expand Down
4 changes: 2 additions & 2 deletions rb/sig/lib/selenium/webdriver/bidi/log_handler.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ module Selenium

def initialize: (BiDi bidi) -> void

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

def remove_message_handler: (Integer id) -> bool
def remove_message_handler: (Integer id) -> bool?

private

Expand Down
4 changes: 2 additions & 2 deletions rb/sig/lib/selenium/webdriver/bidi/struct.rbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module Selenium
module WebDriver
class BiDi
class Struct < ::Struct
def self.new: (*untyped args) { (?) -> untyped } -> void
class Struct < ::Struct[untyped]
def self.new: (*untyped args) ?{ (self) [self: self] -> untyped } -> void

def self.camel_to_snake: (String camel_str) -> String
end
Expand Down
2 changes: 2 additions & 0 deletions rb/sig/lib/selenium/webdriver/common/driver_finder.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ module Selenium
private

def paths: -> untyped

def to_args: -> Array[String]
end
end
end
2 changes: 1 addition & 1 deletion rb/sig/lib/selenium/webdriver/common/error.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Selenium

ERROR_URL: String

URLS: Hash[Symbol, String]
URLS: Hash[Symbol?, String]

class WebDriverError < StandardError
def initialize: (?String | Array[String] msg) -> void
Expand Down
4 changes: 2 additions & 2 deletions rb/sig/lib/selenium/webdriver/common/logger.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ module Selenium

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

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

def debug?: () -> bool

private

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

def discard_or_log: (Symbol level, String message, (Symbol | Array[::Symbol]) | [(Symbol | Array[Symbol])] id) ?{ () -> void } -> (void)
def discard_or_log: (Symbol level, String message, (Symbol | Array[::Symbol]) | [(Symbol | Array[Symbol])] id) ?{ () -> void } -> untyped
end
end
end
2 changes: 1 addition & 1 deletion rb/sig/lib/selenium/webdriver/common/options.rbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Selenium
module WebDriver
class Options
@options: Hash[String | Symbol, String | Numeric | bool?]
@options: Hash[untyped, untyped]

W3C_OPTIONS: Array[Symbol]

Expand Down
2 changes: 1 addition & 1 deletion rb/sig/lib/selenium/webdriver/common/selenium_manager.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Selenium

def self.bin_path: () -> String

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

private

Expand Down
2 changes: 2 additions & 0 deletions rb/sig/lib/selenium/webdriver/common/service.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ module Selenium

DEFAULT_PORT: untyped

DRIVER_PATH_ENV_KEY: String

self.@driver_path: untyped

@executable_path: untyped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module Selenium

def initialize: (url: untyped) -> void

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

def close: () -> untyped

Expand Down
22 changes: 1 addition & 21 deletions rb/sig/lib/selenium/webdriver/fedcm/account.rbs
Original file line number Diff line number Diff line change
@@ -1,51 +1,31 @@
module Selenium
module WebDriver
module FedCM
# Represents an account displayed in a FedCm account list.
# See: https://w3c-fedid.github.io/FedCM/#dictdef-identityprovideraccount
# https://w3c-fedid.github.io/FedCM/#webdriver-accountlist
class Account
@account_id: String

@email: String

@name: String

@given_name: String

@picture_url: String

@idp_config_url: String

@login_state: String

@terms_of_service_url: String

@privacy_policy_url: String

LOGIN_STATE_SIGNIN: String

LOGIN_STATE_SIGNUP: String

attr_reader account_id: String

attr_reader email: String

attr_reader name: String

attr_reader given_name: String

attr_reader picture_url: String

attr_reader idp_config_url: String

attr_reader login_state: String

attr_reader terms_of_service_url: String

attr_reader privacy_policy_url: String

def initialize: (**untyped args) -> void
def initialize: (**String args) -> void
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions rb/sig/lib/selenium/webdriver/firefox/options.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Selenium

@profile: untyped

@options: Hash[Symbol, untyped]
@options: Hash[untyped, untyped]

attr_accessor debugger_address: untyped

Expand All @@ -30,7 +30,7 @@ module Selenium

def log_level=: (untyped level) -> untyped

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

private

Expand Down
2 changes: 1 addition & 1 deletion rb/sig/lib/selenium/webdriver/remote/bidi_bridge.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Selenium

def quit: () -> nil

def close: () -> nil
def close: () -> untyped
end
end
end
Expand Down
Loading

0 comments on commit a14b659

Please sign in to comment.