Skip to content

Commit a586d3c

Browse files
committed
rb - update block formatting
1 parent 274e9f2 commit a586d3c

39 files changed

+150
-208
lines changed

rb/.rubocop_todo.yml

Lines changed: 1 addition & 59 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 19:07:43 -0700 using RuboCop version 0.37.2.
3+
# on 2016-06-08 19:18:26 -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
@@ -29,15 +29,6 @@ Lint/HandleExceptions:
2929
- 'lib/selenium/webdriver/remote/w3c_bridge.rb'
3030
- 'spec/integration/selenium/webdriver/spec_support/test_environment.rb'
3131

32-
# Offense count: 5
33-
# Cop supports --auto-correct.
34-
# Configuration parameters: IgnoreEmptyBlocks.
35-
Lint/UnusedBlockArgument:
36-
Exclude:
37-
- 'lib/selenium/webdriver/firefox/binary.rb'
38-
- 'spec/integration/selenium/webdriver/remote/element_spec.rb'
39-
- 'spec/unit/selenium/webdriver/phantomjs/bridge_spec.rb'
40-
4132
# Offense count: 27
4233
# Cop supports --auto-correct.
4334
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
@@ -136,16 +127,6 @@ Style/BarePercentLiterals:
136127
Exclude:
137128
- 'spec/integration/selenium/webdriver/firefox/profile_spec.rb'
138129

139-
# Offense count: 61
140-
# Cop supports --auto-correct.
141-
# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
142-
# SupportedStyles: line_count_based, semantic, braces_for_chaining
143-
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
144-
# FunctionalMethods: let, let!, subject, watch
145-
# IgnoredMethods: lambda, proc, it
146-
Style/BlockDelimiters:
147-
Enabled: false
148-
149130
# Offense count: 5
150131
# Configuration parameters: EnforcedStyle, SupportedStyles.
151132
# SupportedStyles: nested, compact
@@ -326,13 +307,6 @@ Style/IndentationWidth:
326307
- 'lib/selenium/webdriver/support/color.rb'
327308
- 'spec/integration/selenium/webdriver/spec_support/guards.rb'
328309

329-
# Offense count: 2
330-
# Cop supports --auto-correct.
331-
Style/Lambda:
332-
Exclude:
333-
- 'spec/integration/selenium/webdriver/remote/element_spec.rb'
334-
- 'spec/unit/selenium/webdriver/wait_spec.rb'
335-
336310
# Offense count: 1
337311
# Cop supports --auto-correct.
338312
Style/LeadingCommentSpace:
@@ -486,13 +460,6 @@ Style/Semicolon:
486460
- 'spec/unit/selenium/webdriver/file_reaper_spec.rb'
487461
- 'spec/unit/selenium/webdriver/support/color_spec.rb'
488462

489-
# Offense count: 2
490-
# Configuration parameters: Methods.
491-
# Methods: {"reduce"=>["a", "e"]}, {"inject"=>["a", "e"]}
492-
Style/SingleLineBlockParams:
493-
Exclude:
494-
- 'lib/selenium/webdriver/chrome/profile.rb'
495-
496463
# Offense count: 2
497464
# Cop supports --auto-correct.
498465
# Configuration parameters: AllowIfMethodIsEmpty.
@@ -530,13 +497,6 @@ Style/SpaceBeforeComma:
530497
- 'lib/selenium/webdriver/remote/capabilities.rb'
531498
- 'spec/unit/selenium/webdriver/safari/bridge_spec.rb'
532499

533-
# Offense count: 14
534-
# Cop supports --auto-correct.
535-
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
536-
# SupportedStyles: space, no_space
537-
Style/SpaceInsideBlockBraces:
538-
Enabled: false
539-
540500
# Offense count: 1
541501
# Cop supports --auto-correct.
542502
Style/SpaceInsideParens:
@@ -572,24 +532,6 @@ Style/StringLiterals:
572532
Style/StringLiteralsInInterpolation:
573533
Enabled: false
574534

575-
# Offense count: 7
576-
# Cop supports --auto-correct.
577-
# Configuration parameters: IgnoredMethods.
578-
# IgnoredMethods: respond_to
579-
Style/SymbolProc:
580-
Exclude:
581-
- 'lib/selenium/webdriver/chrome/bridge.rb'
582-
- 'lib/selenium/webdriver/remote/bridge.rb'
583-
- 'lib/selenium/webdriver/safari/bridge.rb'
584-
- 'lib/selenium/webdriver/support/select.rb'
585-
- 'spec/unit/selenium/webdriver/file_reaper_spec.rb'
586-
587-
# Offense count: 2
588-
# Cop supports --auto-correct.
589-
Style/Tab:
590-
Exclude:
591-
- 'spec/unit/selenium/webdriver/support/select_spec.rb'
592-
593535
# Offense count: 22
594536
# Cop supports --auto-correct.
595537
# Configuration parameters: EnforcedStyle, SupportedStyles.

rb/lib/selenium/server.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ def download(required_version)
115115
def latest
116116
require 'rexml/document'
117117
net_http.start("selenium-release.storage.googleapis.com") do |http|
118-
REXML::Document.new(http.get("/").body).root.get_elements("//Contents/Key").map { |e|
118+
REXML::Document.new(http.get("/").body).root.get_elements("//Contents/Key").map do |e|
119119
e.text[/selenium-server-standalone-(\d+\.\d+\.\d+)\.jar/, 1]
120-
}.compact.max
120+
end.compact.max
121121
end
122122
end
123123

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def create_capabilities(opts)
9494
raise ArgumentError, ":args must be an Array of Strings"
9595
end
9696

97-
chrome_options['args'] = args.map { |e| e.to_s }
97+
chrome_options['args'] = args.map(&:to_s)
9898
end
9999

100100
if profile

rb/lib/selenium/webdriver/chrome/profile.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ def add_encoded_extension(encoded)
5454

5555
def []=(key, value)
5656
parts = key.split(".")
57-
parts[0..-2].inject(prefs) { |pr, k| pr[k] ||= {} }[parts.last] = value
57+
parts[0..-2].inject(prefs) { |a, e| a[e] ||= {} }[parts.last] = value
5858
end
5959

6060
def [](key)
6161
parts = key.split(".")
62-
parts.inject(prefs) { |pr, k| pr.fetch(k) }
62+
parts.inject(prefs) { |a, e| a.fetch(e) }
6363
end
6464

6565
def layout_on_disk

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,9 @@ def drag_and_drop_by(source, right_by, down_by)
359359
#
360360

361361
def perform
362-
@actions.each { |receiver, method, args|
362+
@actions.each do |receiver, method, args|
363363
@devices.fetch(receiver).__send__(method, *args)
364-
}
364+
end
365365

366366
nil
367367
end

rb/lib/selenium/webdriver/firefox/binary.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def windows_registry_path
185185
lm = Win32::Registry::HKEY_LOCAL_MACHINE
186186
lm.open("SOFTWARE\\Mozilla\\Mozilla Firefox") do |reg|
187187
main = lm.open("SOFTWARE\\Mozilla\\Mozilla Firefox\\#{reg.keys[0]}\\Main")
188-
if entry = main.find { |key, type, data| key =~ /pathtoexe/i }
188+
if entry = main.find { |key, _type, _data| key =~ /pathtoexe/i }
189189
return entry.last
190190
end
191191
end

rb/lib/selenium/webdriver/firefox/profile.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,11 @@ def read_user_prefs(path)
267267
end
268268

269269
def write_prefs(prefs, path)
270-
File.open(path, "w") { |file|
270+
File.open(path, "w") do |file|
271271
prefs.each do |key, value|
272272
file.puts %{user_pref("#{key}", #{value.to_json});}
273273
end
274-
}
274+
end
275275
end
276276

277277
end # Profile

rb/lib/selenium/webdriver/remote/bridge.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ def getScreenOrientation
513513

514514
def getAvailableLogTypes
515515
types = execute :getAvailableLogTypes
516-
Array(types).map { |e| e.to_sym }
516+
Array(types).map(&:to_sym)
517517
end
518518

519519
def getLog(type)

rb/lib/selenium/webdriver/remote/w3c_bridge.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ def getAllCookies
384384
end
385385

386386
def deleteAllCookies
387-
getAllCookies.each { |cookie| deleteCookie(cookie['name'])}
387+
getAllCookies.each { |cookie| deleteCookie(cookie['name']) }
388388
end
389389

390390
#
@@ -635,9 +635,9 @@ def raw_execute(command, opts = {}, command_hash = nil)
635635
path[':session_id'] = @session_id if path.include?(":session_id")
636636

637637
begin
638-
opts.each { |key, value|
638+
opts.each do |key, value|
639639
path[key.inspect] = escaper.escape(value.to_s)
640-
}
640+
end
641641
rescue IndexError
642642
raise ArgumentError, "#{opts.inspect} invalid for #{command.inspect}"
643643
end

rb/lib/selenium/webdriver/safari/bridge.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def raw_execute(command, opts = {}, command_hash = nil)
9797

9898
def camel_case(str)
9999
parts = str.split('_')
100-
parts[1..-1].map { |e| e.capitalize! }
100+
parts[1..-1].map(&:capitalize!)
101101

102102
parts.join
103103
end

0 commit comments

Comments
 (0)