Skip to content

Commit fed0476

Browse files
committed
rb - update hash syntax
1 parent faddaa5 commit fed0476

Some content is hidden

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

80 files changed

+671
-714
lines changed

rb/.rubocop.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@ inherit_from: .rubocop_todo.yml
22

33
AllCops:
44
TargetRubyVersion: 2.0
5+
6+
Style/SpaceInsideHashLiteralBraces:
7+
EnforcedStyle: no_space
8+
9+
Style/BracesAroundHashParameters:
10+
EnforcedStyle: context_dependent

rb/.rubocop_todo.yml

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2016-06-08 13:57:05 -0700 using RuboCop version 0.37.2.
3+
# on 2016-06-08 15:23:02 -0700 using RuboCop version 0.37.2.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
@@ -101,7 +101,7 @@ Metrics/ClassLength:
101101
Metrics/CyclomaticComplexity:
102102
Max: 17
103103

104-
# Offense count: 737
104+
# Offense count: 721
105105
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
106106
# URISchemes: http, https
107107
Metrics/LineLength:
@@ -175,14 +175,6 @@ Style/Alias:
175175
- 'lib/selenium/webdriver/support/color.rb'
176176
- 'spec/integration/selenium/webdriver/spec_support/guards.rb'
177177

178-
# Offense count: 1
179-
# Cop supports --auto-correct.
180-
# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles.
181-
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
182-
Style/AlignHash:
183-
Exclude:
184-
- 'lib/selenium/webdriver/remote/w3c_bridge.rb'
185-
186178
# Offense count: 7
187179
# Cop supports --auto-correct.
188180
# Configuration parameters: EnforcedStyle, SupportedStyles.
@@ -238,20 +230,6 @@ Style/BarePercentLiterals:
238230
Style/BlockDelimiters:
239231
Enabled: false
240232

241-
# Offense count: 18
242-
# Cop supports --auto-correct.
243-
# Configuration parameters: EnforcedStyle, SupportedStyles.
244-
# SupportedStyles: braces, no_braces, context_dependent
245-
Style/BracesAroundHashParameters:
246-
Exclude:
247-
- 'lib/selenium/webdriver/remote/bridge.rb'
248-
- 'lib/selenium/webdriver/remote/w3c_bridge.rb'
249-
- 'spec/integration/selenium/webdriver/chrome/profile_spec.rb'
250-
- 'spec/integration/selenium/webdriver/driver_spec.rb'
251-
- 'spec/integration/selenium/webdriver/error_spec.rb'
252-
- 'spec/unit/selenium/webdriver/chrome/bridge_spec.rb'
253-
- 'spec/unit/selenium/webdriver/search_context_spec.rb'
254-
255233
# Offense count: 3
256234
# Cop supports --auto-correct.
257235
# Configuration parameters: IndentWhenRelativeTo, SupportedStyles, IndentOneStep, IndentationWidth.
@@ -395,7 +373,7 @@ Style/EmptyLinesAroundMethodBody:
395373
Style/EmptyLinesAroundModuleBody:
396374
Enabled: false
397375

398-
# Offense count: 29
376+
# Offense count: 30
399377
# Cop supports --auto-correct.
400378
# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
401379
Style/ExtraSpacing:
@@ -451,13 +429,6 @@ Style/GuardClause:
451429
- 'lib/selenium/webdriver/remote/*'
452430
- 'spec/integration/selenium/webdriver/spec_support/*'
453431

454-
# Offense count: 766
455-
# Cop supports --auto-correct.
456-
# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues.
457-
# SupportedStyles: ruby19, ruby19_no_mixed_keys, hash_rockets
458-
Style/HashSyntax:
459-
Enabled: false
460-
461432
# Offense count: 18
462433
# Cop supports --auto-correct.
463434
# Configuration parameters: MaxLineLength.
@@ -483,15 +454,6 @@ Style/IfUnlessModifier:
483454
Style/IndentArray:
484455
Enabled: false
485456

486-
# Offense count: 5
487-
# Cop supports --auto-correct.
488-
# Configuration parameters: SupportedStyles, IndentationWidth.
489-
# SupportedStyles: special_inside_parentheses, consistent, align_braces
490-
Style/IndentHash:
491-
EnforcedStyle: consistent
492-
Exclude:
493-
- 'lib/selenium/webdriver/remote/*'
494-
495457
# Offense count: 1
496458
# Cop supports --auto-correct.
497459
# Configuration parameters: EnforcedStyle, SupportedStyles.
@@ -701,7 +663,7 @@ Style/SpaceAfterComma:
701663
- 'lib/selenium/webdriver/common/touch_action_builder.rb'
702664
- 'spec/unit/selenium/webdriver/spec_helper.rb'
703665

704-
# Offense count: 10
666+
# Offense count: 9
705667
# Cop supports --auto-correct.
706668
# Configuration parameters: AllowForAlignment.
707669
Style/SpaceAroundOperators:
@@ -712,9 +674,7 @@ Style/SpaceAroundOperators:
712674
- 'lib/selenium/webdriver/common/log_entry.rb'
713675
- 'lib/selenium/webdriver/firefox/profile.rb'
714676
- 'lib/selenium/webdriver/remote/http/curb.rb'
715-
- 'lib/selenium/webdriver/remote/w3c_bridge.rb'
716677
- 'spec/unit/selenium/server_spec.rb'
717-
- 'spec/unit/selenium/webdriver/proxy_spec.rb'
718678

719679
# Offense count: 5
720680
# Cop supports --auto-correct.
@@ -730,13 +690,6 @@ Style/SpaceBeforeComma:
730690
Style/SpaceInsideBlockBraces:
731691
Enabled: false
732692

733-
# Offense count: 104
734-
# Cop supports --auto-correct.
735-
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
736-
# SupportedStyles: space, no_space
737-
Style/SpaceInsideHashLiteralBraces:
738-
Enabled: false
739-
740693
# Offense count: 1
741694
# Cop supports --auto-correct.
742695
Style/SpaceInsideParens:

rb/lib/selenium/webdriver/android/bridge.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ def initialize(opts = {})
3333
warn 'The Android driver is deprecated - please use either http://selendroid.io or http://appium.io instead.'
3434

3535
remote_opts = {
36-
:url => opts.fetch(:url, DEFAULT_URL),
37-
:desired_capabilities => opts.fetch(:desired_capabilities, capabilities),
36+
url: opts.fetch(:url, DEFAULT_URL),
37+
desired_capabilities: opts.fetch(:desired_capabilities, capabilities),
3838
}
3939

4040
remote_opts[:http_client] = opts[:http_client] if opts.has_key?(:http_client)

rb/lib/selenium/webdriver/chrome/bridge.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ def initialize(opts = {})
3939
caps = create_capabilities(opts)
4040

4141
remote_opts = {
42-
:url => url,
43-
:desired_capabilities => caps
42+
url: url,
43+
desired_capabilities: caps
4444
}
4545

46-
remote_opts.merge!(:http_client => http_client) if http_client
46+
remote_opts.merge!(http_client: http_client) if http_client
4747

4848
super(remote_opts)
4949
end

rb/lib/selenium/webdriver/common/action_builder.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ class ActionBuilder
4646

4747
def initialize(mouse, keyboard)
4848
@devices = {
49-
:mouse => mouse,
50-
:keyboard => keyboard
49+
mouse: mouse,
50+
keyboard: keyboard
5151
}
5252

5353
@actions = []

rb/lib/selenium/webdriver/common/driver.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def execute_async_script(script, *args)
274274

275275
def [](sel)
276276
if sel.kind_of?(String) || sel.kind_of?(Symbol)
277-
sel = { :id => sel }
277+
sel = {id: sel}
278278
end
279279

280280
find_element sel

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def network_connection_type=(connection_type)
4242
private
4343

4444
def type_to_values
45-
{:airplane_mode => 1, :wifi => 2, :data => 4, :all => 6, :none => 0}
45+
{airplane_mode: 1, wifi: 2, data: 4, all: 6, none: 0}
4646
end
4747

4848
def values_to_type

rb/lib/selenium/webdriver/common/keys.rb

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -27,69 +27,69 @@ module Keys
2727
#
2828

2929
KEYS = {
30-
:null => "\ue000",
31-
:cancel => "\ue001",
32-
:help => "\ue002",
33-
:backspace => "\ue003",
34-
:tab => "\ue004",
35-
:clear => "\ue005",
36-
:return => "\ue006",
37-
:enter => "\ue007",
38-
:shift => "\ue008",
39-
:left_shift => "\ue008",
40-
:control => "\ue009",
41-
:left_control => "\ue009",
42-
:alt => "\ue00A",
43-
:left_alt => "\ue00A",
44-
:pause => "\ue00B",
45-
:escape => "\ue00C",
46-
:space => "\ue00D",
47-
:page_up => "\ue00E",
48-
:page_down => "\ue00F",
49-
:end => "\ue010",
50-
:home => "\ue011",
51-
:left => "\ue012",
52-
:arrow_left => "\ue012",
53-
:up => "\ue013",
54-
:arrow_up => "\ue013",
55-
:right => "\ue014",
56-
:arrow_right => "\ue014",
57-
:down => "\ue015",
58-
:arrow_down => "\ue015",
59-
:insert => "\ue016",
60-
:delete => "\ue017",
61-
:semicolon => "\ue018",
62-
:equals => "\ue019",
63-
:numpad0 => "\ue01A",
64-
:numpad1 => "\ue01B",
65-
:numpad2 => "\ue01C",
66-
:numpad3 => "\ue01D",
67-
:numpad4 => "\ue01E",
68-
:numpad5 => "\ue01F",
69-
:numpad6 => "\ue020",
70-
:numpad7 => "\ue021",
71-
:numpad8 => "\ue022",
72-
:numpad9 => "\ue023",
73-
:multiply => "\ue024",
74-
:add => "\ue025",
75-
:separator => "\ue026",
76-
:subtract => "\ue027",
77-
:decimal => "\ue028",
78-
:divide => "\ue029",
79-
:f1 => "\ue031",
80-
:f2 => "\ue032",
81-
:f3 => "\ue033",
82-
:f4 => "\ue034",
83-
:f5 => "\ue035",
84-
:f6 => "\ue036",
85-
:f7 => "\ue037",
86-
:f8 => "\ue038",
87-
:f9 => "\ue039",
88-
:f10 => "\ue03A",
89-
:f11 => "\ue03B",
90-
:f12 => "\ue03C",
91-
:meta => "\ue03D",
92-
:command => "\ue03D" # alias
30+
null: "\ue000",
31+
cancel: "\ue001",
32+
help: "\ue002",
33+
backspace: "\ue003",
34+
tab: "\ue004",
35+
clear: "\ue005",
36+
return: "\ue006",
37+
enter: "\ue007",
38+
shift: "\ue008",
39+
left_shift: "\ue008",
40+
control: "\ue009",
41+
left_control: "\ue009",
42+
alt: "\ue00A",
43+
left_alt: "\ue00A",
44+
pause: "\ue00B",
45+
escape: "\ue00C",
46+
space: "\ue00D",
47+
page_up: "\ue00E",
48+
page_down: "\ue00F",
49+
end: "\ue010",
50+
home: "\ue011",
51+
left: "\ue012",
52+
arrow_left: "\ue012",
53+
up: "\ue013",
54+
arrow_up: "\ue013",
55+
right: "\ue014",
56+
arrow_right: "\ue014",
57+
down: "\ue015",
58+
arrow_down: "\ue015",
59+
insert: "\ue016",
60+
delete: "\ue017",
61+
semicolon: "\ue018",
62+
equals: "\ue019",
63+
numpad0: "\ue01A",
64+
numpad1: "\ue01B",
65+
numpad2: "\ue01C",
66+
numpad3: "\ue01D",
67+
numpad4: "\ue01E",
68+
numpad5: "\ue01F",
69+
numpad6: "\ue020",
70+
numpad7: "\ue021",
71+
numpad8: "\ue022",
72+
numpad9: "\ue023",
73+
multiply: "\ue024",
74+
add: "\ue025",
75+
separator: "\ue026",
76+
subtract: "\ue027",
77+
decimal: "\ue028",
78+
divide: "\ue029",
79+
f1: "\ue031",
80+
f2: "\ue032",
81+
f3: "\ue033",
82+
f4: "\ue034",
83+
f5: "\ue035",
84+
f6: "\ue036",
85+
f7: "\ue037",
86+
f8: "\ue038",
87+
f9: "\ue039",
88+
f10: "\ue03A",
89+
f11: "\ue03B",
90+
f12: "\ue03C",
91+
meta: "\ue03D",
92+
command: "\ue03D" # alias
9393
}
9494

9595
#

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ def delete_all_cookies
9494
def all_cookies
9595
@bridge.getAllCookies.map do |cookie|
9696
{
97-
:name => cookie["name"],
98-
:value => cookie["value"],
99-
:path => cookie["path"],
100-
:domain => cookie["domain"] && strip_port(cookie["domain"]),
101-
:expires => cookie["expiry"] && datetime_at(cookie['expiry']),
102-
:secure => cookie["secure"]
97+
name: cookie["name"],
98+
value: cookie["value"],
99+
path: cookie["path"],
100+
domain: cookie["domain"] && strip_port(cookie["domain"]),
101+
expires: cookie["expiry"] && datetime_at(cookie['expiry']),
102+
secure: cookie["secure"]
103103
}
104104
end
105105
end

rb/lib/selenium/webdriver/common/platform.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -229,15 +229,15 @@ def interfaces
229229
end # Selenium
230230

231231
if __FILE__ == $0
232-
p :engine => Selenium::WebDriver::Platform.engine,
233-
:os => Selenium::WebDriver::Platform.os,
234-
:ruby_version => Selenium::WebDriver::Platform.ruby_version,
235-
:jruby? => Selenium::WebDriver::Platform.jruby?,
236-
:windows? => Selenium::WebDriver::Platform.windows?,
237-
:home => Selenium::WebDriver::Platform.home,
238-
:bitsize => Selenium::WebDriver::Platform.bitsize,
239-
:localhost => Selenium::WebDriver::Platform.localhost,
240-
:ip => Selenium::WebDriver::Platform.ip,
241-
:interfaces => Selenium::WebDriver::Platform.interfaces,
242-
:null_device => Selenium::WebDriver::Platform.null_device
232+
p engine: Selenium::WebDriver::Platform.engine,
233+
os: Selenium::WebDriver::Platform.os,
234+
ruby_version: Selenium::WebDriver::Platform.ruby_version,
235+
jruby?: Selenium::WebDriver::Platform.jruby?,
236+
windows?: Selenium::WebDriver::Platform.windows?,
237+
home: Selenium::WebDriver::Platform.home,
238+
bitsize: Selenium::WebDriver::Platform.bitsize,
239+
localhost: Selenium::WebDriver::Platform.localhost,
240+
ip: Selenium::WebDriver::Platform.ip,
241+
interfaces: Selenium::WebDriver::Platform.interfaces,
242+
null_device: Selenium::WebDriver::Platform.null_device
243243
end

0 commit comments

Comments
 (0)