Skip to content

Commit

Permalink
rb - update hash syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Jun 16, 2016
1 parent faddaa5 commit fed0476
Show file tree
Hide file tree
Showing 80 changed files with 671 additions and 714 deletions.
6 changes: 6 additions & 0 deletions rb/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@ inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.0

Style/SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space

Style/BracesAroundHashParameters:
EnforcedStyle: context_dependent
55 changes: 4 additions & 51 deletions rb/.rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2016-06-08 13:57:05 -0700 using RuboCop version 0.37.2.
# on 2016-06-08 15:23:02 -0700 using RuboCop version 0.37.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand Down Expand Up @@ -101,7 +101,7 @@ Metrics/ClassLength:
Metrics/CyclomaticComplexity:
Max: 17

# Offense count: 737
# Offense count: 721
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
# URISchemes: http, https
Metrics/LineLength:
Expand Down Expand Up @@ -175,14 +175,6 @@ Style/Alias:
- 'lib/selenium/webdriver/support/color.rb'
- 'spec/integration/selenium/webdriver/spec_support/guards.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles.
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
Style/AlignHash:
Exclude:
- 'lib/selenium/webdriver/remote/w3c_bridge.rb'

# Offense count: 7
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Expand Down Expand Up @@ -238,20 +230,6 @@ Style/BarePercentLiterals:
Style/BlockDelimiters:
Enabled: false

# Offense count: 18
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: braces, no_braces, context_dependent
Style/BracesAroundHashParameters:
Exclude:
- 'lib/selenium/webdriver/remote/bridge.rb'
- 'lib/selenium/webdriver/remote/w3c_bridge.rb'
- 'spec/integration/selenium/webdriver/chrome/profile_spec.rb'
- 'spec/integration/selenium/webdriver/driver_spec.rb'
- 'spec/integration/selenium/webdriver/error_spec.rb'
- 'spec/unit/selenium/webdriver/chrome/bridge_spec.rb'
- 'spec/unit/selenium/webdriver/search_context_spec.rb'

# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: IndentWhenRelativeTo, SupportedStyles, IndentOneStep, IndentationWidth.
Expand Down Expand Up @@ -395,7 +373,7 @@ Style/EmptyLinesAroundMethodBody:
Style/EmptyLinesAroundModuleBody:
Enabled: false

# Offense count: 29
# Offense count: 30
# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
Style/ExtraSpacing:
Expand Down Expand Up @@ -451,13 +429,6 @@ Style/GuardClause:
- 'lib/selenium/webdriver/remote/*'
- 'spec/integration/selenium/webdriver/spec_support/*'

# Offense count: 766
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues.
# SupportedStyles: ruby19, ruby19_no_mixed_keys, hash_rockets
Style/HashSyntax:
Enabled: false

# Offense count: 18
# Cop supports --auto-correct.
# Configuration parameters: MaxLineLength.
Expand All @@ -483,15 +454,6 @@ Style/IfUnlessModifier:
Style/IndentArray:
Enabled: false

# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: SupportedStyles, IndentationWidth.
# SupportedStyles: special_inside_parentheses, consistent, align_braces
Style/IndentHash:
EnforcedStyle: consistent
Exclude:
- 'lib/selenium/webdriver/remote/*'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Expand Down Expand Up @@ -701,7 +663,7 @@ Style/SpaceAfterComma:
- 'lib/selenium/webdriver/common/touch_action_builder.rb'
- 'spec/unit/selenium/webdriver/spec_helper.rb'

# Offense count: 10
# Offense count: 9
# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment.
Style/SpaceAroundOperators:
Expand All @@ -712,9 +674,7 @@ Style/SpaceAroundOperators:
- 'lib/selenium/webdriver/common/log_entry.rb'
- 'lib/selenium/webdriver/firefox/profile.rb'
- 'lib/selenium/webdriver/remote/http/curb.rb'
- 'lib/selenium/webdriver/remote/w3c_bridge.rb'
- 'spec/unit/selenium/server_spec.rb'
- 'spec/unit/selenium/webdriver/proxy_spec.rb'

# Offense count: 5
# Cop supports --auto-correct.
Expand All @@ -730,13 +690,6 @@ Style/SpaceBeforeComma:
Style/SpaceInsideBlockBraces:
Enabled: false

# Offense count: 104
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
# SupportedStyles: space, no_space
Style/SpaceInsideHashLiteralBraces:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
Style/SpaceInsideParens:
Expand Down
4 changes: 2 additions & 2 deletions rb/lib/selenium/webdriver/android/bridge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def initialize(opts = {})
warn 'The Android driver is deprecated - please use either http://selendroid.io or http://appium.io instead.'

remote_opts = {
:url => opts.fetch(:url, DEFAULT_URL),
:desired_capabilities => opts.fetch(:desired_capabilities, capabilities),
url: opts.fetch(:url, DEFAULT_URL),
desired_capabilities: opts.fetch(:desired_capabilities, capabilities),
}

remote_opts[:http_client] = opts[:http_client] if opts.has_key?(:http_client)
Expand Down
6 changes: 3 additions & 3 deletions rb/lib/selenium/webdriver/chrome/bridge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ def initialize(opts = {})
caps = create_capabilities(opts)

remote_opts = {
:url => url,
:desired_capabilities => caps
url: url,
desired_capabilities: caps
}

remote_opts.merge!(:http_client => http_client) if http_client
remote_opts.merge!(http_client: http_client) if http_client

super(remote_opts)
end
Expand Down
4 changes: 2 additions & 2 deletions rb/lib/selenium/webdriver/common/action_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class ActionBuilder

def initialize(mouse, keyboard)
@devices = {
:mouse => mouse,
:keyboard => keyboard
mouse: mouse,
keyboard: keyboard
}

@actions = []
Expand Down
2 changes: 1 addition & 1 deletion rb/lib/selenium/webdriver/common/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def execute_async_script(script, *args)

def [](sel)
if sel.kind_of?(String) || sel.kind_of?(Symbol)
sel = { :id => sel }
sel = {id: sel}
end

find_element sel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def network_connection_type=(connection_type)
private

def type_to_values
{:airplane_mode => 1, :wifi => 2, :data => 4, :all => 6, :none => 0}
{airplane_mode: 1, wifi: 2, data: 4, all: 6, none: 0}
end

def values_to_type
Expand Down
126 changes: 63 additions & 63 deletions rb/lib/selenium/webdriver/common/keys.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,69 +27,69 @@ module Keys
#

KEYS = {
:null => "\ue000",
:cancel => "\ue001",
:help => "\ue002",
:backspace => "\ue003",
:tab => "\ue004",
:clear => "\ue005",
:return => "\ue006",
:enter => "\ue007",
:shift => "\ue008",
:left_shift => "\ue008",
:control => "\ue009",
:left_control => "\ue009",
:alt => "\ue00A",
:left_alt => "\ue00A",
:pause => "\ue00B",
:escape => "\ue00C",
:space => "\ue00D",
:page_up => "\ue00E",
:page_down => "\ue00F",
:end => "\ue010",
:home => "\ue011",
:left => "\ue012",
:arrow_left => "\ue012",
:up => "\ue013",
:arrow_up => "\ue013",
:right => "\ue014",
:arrow_right => "\ue014",
:down => "\ue015",
:arrow_down => "\ue015",
:insert => "\ue016",
:delete => "\ue017",
:semicolon => "\ue018",
:equals => "\ue019",
:numpad0 => "\ue01A",
:numpad1 => "\ue01B",
:numpad2 => "\ue01C",
:numpad3 => "\ue01D",
:numpad4 => "\ue01E",
:numpad5 => "\ue01F",
:numpad6 => "\ue020",
:numpad7 => "\ue021",
:numpad8 => "\ue022",
:numpad9 => "\ue023",
:multiply => "\ue024",
:add => "\ue025",
:separator => "\ue026",
:subtract => "\ue027",
:decimal => "\ue028",
:divide => "\ue029",
:f1 => "\ue031",
:f2 => "\ue032",
:f3 => "\ue033",
:f4 => "\ue034",
:f5 => "\ue035",
:f6 => "\ue036",
:f7 => "\ue037",
:f8 => "\ue038",
:f9 => "\ue039",
:f10 => "\ue03A",
:f11 => "\ue03B",
:f12 => "\ue03C",
:meta => "\ue03D",
:command => "\ue03D" # alias
null: "\ue000",
cancel: "\ue001",
help: "\ue002",
backspace: "\ue003",
tab: "\ue004",
clear: "\ue005",
return: "\ue006",
enter: "\ue007",
shift: "\ue008",
left_shift: "\ue008",
control: "\ue009",
left_control: "\ue009",
alt: "\ue00A",
left_alt: "\ue00A",
pause: "\ue00B",
escape: "\ue00C",
space: "\ue00D",
page_up: "\ue00E",
page_down: "\ue00F",
end: "\ue010",
home: "\ue011",
left: "\ue012",
arrow_left: "\ue012",
up: "\ue013",
arrow_up: "\ue013",
right: "\ue014",
arrow_right: "\ue014",
down: "\ue015",
arrow_down: "\ue015",
insert: "\ue016",
delete: "\ue017",
semicolon: "\ue018",
equals: "\ue019",
numpad0: "\ue01A",
numpad1: "\ue01B",
numpad2: "\ue01C",
numpad3: "\ue01D",
numpad4: "\ue01E",
numpad5: "\ue01F",
numpad6: "\ue020",
numpad7: "\ue021",
numpad8: "\ue022",
numpad9: "\ue023",
multiply: "\ue024",
add: "\ue025",
separator: "\ue026",
subtract: "\ue027",
decimal: "\ue028",
divide: "\ue029",
f1: "\ue031",
f2: "\ue032",
f3: "\ue033",
f4: "\ue034",
f5: "\ue035",
f6: "\ue036",
f7: "\ue037",
f8: "\ue038",
f9: "\ue039",
f10: "\ue03A",
f11: "\ue03B",
f12: "\ue03C",
meta: "\ue03D",
command: "\ue03D" # alias
}

#
Expand Down
12 changes: 6 additions & 6 deletions rb/lib/selenium/webdriver/common/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ def delete_all_cookies
def all_cookies
@bridge.getAllCookies.map do |cookie|
{
:name => cookie["name"],
:value => cookie["value"],
:path => cookie["path"],
:domain => cookie["domain"] && strip_port(cookie["domain"]),
:expires => cookie["expiry"] && datetime_at(cookie['expiry']),
:secure => cookie["secure"]
name: cookie["name"],
value: cookie["value"],
path: cookie["path"],
domain: cookie["domain"] && strip_port(cookie["domain"]),
expires: cookie["expiry"] && datetime_at(cookie['expiry']),
secure: cookie["secure"]
}
end
end
Expand Down
22 changes: 11 additions & 11 deletions rb/lib/selenium/webdriver/common/platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,15 @@ def interfaces
end # Selenium

if __FILE__ == $0
p :engine => Selenium::WebDriver::Platform.engine,
:os => Selenium::WebDriver::Platform.os,
:ruby_version => Selenium::WebDriver::Platform.ruby_version,
:jruby? => Selenium::WebDriver::Platform.jruby?,
:windows? => Selenium::WebDriver::Platform.windows?,
:home => Selenium::WebDriver::Platform.home,
:bitsize => Selenium::WebDriver::Platform.bitsize,
:localhost => Selenium::WebDriver::Platform.localhost,
:ip => Selenium::WebDriver::Platform.ip,
:interfaces => Selenium::WebDriver::Platform.interfaces,
:null_device => Selenium::WebDriver::Platform.null_device
p engine: Selenium::WebDriver::Platform.engine,
os: Selenium::WebDriver::Platform.os,
ruby_version: Selenium::WebDriver::Platform.ruby_version,
jruby?: Selenium::WebDriver::Platform.jruby?,
windows?: Selenium::WebDriver::Platform.windows?,
home: Selenium::WebDriver::Platform.home,
bitsize: Selenium::WebDriver::Platform.bitsize,
localhost: Selenium::WebDriver::Platform.localhost,
ip: Selenium::WebDriver::Platform.ip,
interfaces: Selenium::WebDriver::Platform.interfaces,
null_device: Selenium::WebDriver::Platform.null_device
end
2 changes: 1 addition & 1 deletion rb/lib/selenium/webdriver/common/profile_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def create_tmp_copy(directory)

# TODO: must be a better way..
FileUtils.rm_rf tmp_directory
FileUtils.mkdir_p File.dirname(tmp_directory), :mode => 0700
FileUtils.mkdir_p File.dirname(tmp_directory), mode: 0700
FileUtils.cp_r directory, tmp_directory

tmp_directory
Expand Down
10 changes: 5 additions & 5 deletions rb/lib/selenium/webdriver/common/proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ module Selenium
module WebDriver
class Proxy
TYPES = {
:direct => "DIRECT", # Direct connection, no proxy (default on Windows).
:manual => "MANUAL", # Manual proxy settings (e.g., for httpProxy).
:pac => "PAC", # Proxy autoconfiguration from URL.
:auto_detect => "AUTODETECT", # Proxy autodetection (presumably with WPAD).
:system => "SYSTEM" # Use system settings (default on Linux).
direct: "DIRECT", # Direct connection, no proxy (default on Windows).
manual: "MANUAL", # Manual proxy settings (e.g., for httpProxy).
pac: "PAC", # Proxy autoconfiguration from URL.
auto_detect: "AUTODETECT", # Proxy autodetection (presumably with WPAD).
system: "SYSTEM" # Use system settings (default on Linux).
}

attr_reader :type,
Expand Down
Loading

0 comments on commit fed0476

Please sign in to comment.