Skip to content

Commit 53922c2

Browse files
committed
[rb] update styling for rubocop
1 parent ecd1285 commit 53922c2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+288
-288
lines changed

rb/lib/selenium/webdriver/atoms.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def read_atom(function)
2727
end
2828

2929
def execute_atom(function_name, *arguments)
30-
script = format("/* #{function_name} */ return (%<atom>s).apply(null, arguments)",
30+
script = format("/* #{function_name} */return (%<atom>s).apply(null, arguments)",
3131
atom: read_atom(function_name))
3232
execute_script(script, *arguments)
3333
end

rb/lib/selenium/webdriver/bidi/browsing_context.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ class BrowsingContext
2727
attr_accessor :id
2828

2929
READINESS_STATE = {
30-
none: "none",
31-
interactive: "interactive",
32-
complete: "complete"
30+
none: 'none',
31+
interactive: 'interactive',
32+
complete: 'complete'
3333
}.freeze
3434

3535
def initialize(driver:, browsing_context_id: nil, type: nil, reference_context: nil)
3636
unless driver.capabilities.web_socket_url
3737
raise Error::WebDriverError,
38-
"WebDriver instance must support BiDi protocol"
38+
'WebDriver instance must support BiDi protocol'
3939
end
4040

4141
unless type.nil? || %i[window tab].include?(type)
@@ -44,7 +44,7 @@ def initialize(driver:, browsing_context_id: nil, type: nil, reference_context:
4444
end
4545

4646
@bidi = driver.bidi
47-
@id = browsing_context_id.nil? ? create(type, reference_context)["context"] : browsing_context_id
47+
@id = browsing_context_id.nil? ? create(type, reference_context)['context'] : browsing_context_id
4848
end
4949

5050
def navigate(url:, readiness_state: nil)
@@ -53,17 +53,17 @@ def navigate(url:, readiness_state: nil)
5353
"Valid readiness states are :none, :interactive & :complete. Received: #{readiness_state.inspect}"
5454
end
5555

56-
navigate_result = @bidi.send_cmd("browsingContext.navigate", context: @id, url: url,
56+
navigate_result = @bidi.send_cmd('browsingContext.navigate', context: @id, url: url,
5757
wait: READINESS_STATE[readiness_state])
5858

5959
NavigateResult.new(
60-
url: navigate_result["url"],
61-
navigation_id: navigate_result["navigation"]
60+
url: navigate_result['url'],
61+
navigation_id: navigate_result['navigation']
6262
)
6363
end
6464

6565
def get_tree(max_depth: nil)
66-
result = @bidi.send_cmd("browsingContext.getTree", root: @id, maxDepth: max_depth).dig("contexts", 0)
66+
result = @bidi.send_cmd('browsingContext.getTree', root: @id, maxDepth: max_depth).dig('contexts', 0)
6767

6868
BrowsingContextInfo.new(
6969
id: result['context'],
@@ -74,13 +74,13 @@ def get_tree(max_depth: nil)
7474
end
7575

7676
def close
77-
@bidi.send_cmd("browsingContext.close", context: @id)
77+
@bidi.send_cmd('browsingContext.close', context: @id)
7878
end
7979

8080
private
8181

8282
def create(type, reference_context)
83-
@bidi.send_cmd("browsingContext.create", type: type.to_s, referenceContext: reference_context)
83+
@bidi.send_cmd('browsingContext.create', type: type.to_s, referenceContext: reference_context)
8484
end
8585
end # BrowsingContext
8686
end # BiDi

rb/lib/selenium/webdriver/bidi/log/javascript_log_entry.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class JavascriptLogEntry < GenericLogEntry
2525

2626
def initialize(level:, text:, timestamp:, type:, stack_trace:)
2727
super(level: level, text: text, timestamp: timestamp, type: type, stack_trace: stack_trace)
28-
@type = "javascript"
28+
@type = 'javascript'
2929
end
3030
end # JavascriptLogEntry
3131
end # BiDi

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,20 @@ class LogInspector
3333
}.freeze
3434

3535
LOG_LEVEL = {
36-
DEBUG: "debug",
37-
ERROR: "error",
38-
INFO: "info",
39-
WARNING: "warning"
36+
DEBUG: 'debug',
37+
ERROR: 'error',
38+
INFO: 'info',
39+
WARNING: 'warning'
4040
}.freeze
4141

4242
def initialize(driver, browsing_context_ids = nil)
4343
unless driver.capabilities.web_socket_url
4444
raise Error::WebDriverError,
45-
"WebDriver instance must support BiDi protocol"
45+
'WebDriver instance must support BiDi protocol'
4646
end
4747

4848
@bidi = driver.bidi
49-
@bidi.session.subscribe("log.entryAdded", browsing_context_ids)
49+
@bidi.session.subscribe('log.entryAdded', browsing_context_ids)
5050
end
5151

5252
def on_console_entry(&block)
@@ -55,8 +55,8 @@ def on_console_entry(&block)
5555
return if enabled
5656

5757
on_log do |params|
58-
type = params["type"]
59-
console_log_events(params) if type.eql?("console")
58+
type = params['type']
59+
console_log_events(params) if type.eql?('console')
6060
end
6161
end
6262

@@ -66,8 +66,8 @@ def on_javascript_log(&block)
6666
return if enabled
6767

6868
on_log do |params|
69-
type = params["type"]
70-
javascript_log_events(params) if type.eql?("javascript")
69+
type = params['type']
70+
javascript_log_events(params) if type.eql?('javascript')
7171
end
7272
end
7373

@@ -78,10 +78,10 @@ def on_javascript_exception(&block)
7878
return if enabled
7979

8080
on_log do |params|
81-
type = params["type"]
82-
level = params["level"]
81+
type = params['type']
82+
level = params['level']
8383

84-
javascript_log_events(params) if type.eql?("javascript") && level.eql?(LOG_LEVEL[:ERROR])
84+
javascript_log_events(params) if type.eql?('javascript') && level.eql?(LOG_LEVEL[:ERROR])
8585
end
8686
end
8787

rb/lib/selenium/webdriver/bidi/session.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ def subscribe(events, browsing_contexts = nil)
3636
events_list = Array(events)
3737
browsing_contexts_list = browsing_contexts.nil? ? nil : Array(browsing_contexts)
3838

39-
@bidi.send_cmd("session.subscribe", events: events_list, contexts: browsing_contexts_list)
39+
@bidi.send_cmd('session.subscribe', events: events_list, contexts: browsing_contexts_list)
4040
end
4141

4242
def unsubscribe(events, browsing_contexts = nil)
4343
events_list = Array(events)
4444
browsing_contexts_list = browsing_contexts.nil? ? nil : Array(browsing_contexts)
4545

46-
@bidi.send_cmd("session.unsubscribe", events: events_list, contexts: browsing_contexts_list)
46+
@bidi.send_cmd('session.unsubscribe', events: events_list, contexts: browsing_contexts_list)
4747
end
4848
end # Session
4949
end # BiDi

rb/lib/selenium/webdriver/chromium/options.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def check_w3c(w3c)
241241

242242
raise Error::InvalidArgumentError,
243243
"Setting 'w3c: false' is not allowed.\n" \
244-
"Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/"
244+
'Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/'
245245
end
246246

247247
def binary_path

rb/lib/selenium/webdriver/chromium/service.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ def extract_service_args(driver_opts)
3232
if driver_opts.key?(:whitelisted_ips)
3333
driver_args << "--whitelisted-ips=#{driver_opts.delete(:whitelisted_ips)}"
3434
end
35-
driver_args << "--verbose" if driver_opts.key?(:verbose)
36-
driver_args << "--silent" if driver_opts.key?(:silent)
35+
driver_args << '--verbose' if driver_opts.key?(:verbose)
36+
driver_args << '--silent' if driver_opts.key?(:silent)
3737
driver_args
3838
end
3939
end # Service

rb/lib/selenium/webdriver/common/profile_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def encoded
4040
end
4141

4242
def as_json(*)
43-
{"zip" => encoded}
43+
{'zip' => encoded}
4444
end
4545

4646
def to_json(*)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module WebDriver
2727
# @api private
2828
#
2929
class SeleniumManager
30-
BIN_PATH = "../../../../../bin"
30+
BIN_PATH = '../../../../../bin'
3131

3232
class << self
3333
# @param [String] driver_name which driver to use.
@@ -60,7 +60,7 @@ def binary
6060
end
6161
location = File.expand_path(path, __FILE__)
6262
unless location.is_a?(String) && File.exist?(location) && File.executable?(location)
63-
raise Error::WebDriverError, "Unable to obtain Selenium Manager"
63+
raise Error::WebDriverError, 'Unable to obtain Selenium Manager'
6464
end
6565

6666
WebDriver.logger.debug("Selenium Manager found at #{location}")

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ def shutdown_supported
9191
protected
9292

9393
def extract_service_args(driver_opts)
94-
WebDriver.logger.deprecate("initializing Service class with :args using Hash",
95-
":args parameter with an Array of String values",
94+
WebDriver.logger.deprecate('initializing Service class with :args using Hash',
95+
':args parameter with an Array of String values',
9696
id: :driver_opts)
9797
driver_opts.key?(:args) ? driver_opts.delete(:args) : []
9898
end

0 commit comments

Comments
 (0)