Skip to content

Commit

Permalink
[rb] update rubocop exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Apr 6, 2020
1 parent 6ec98a3 commit 974a435
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
15 changes: 7 additions & 8 deletions rb/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,14 @@ Style/CommentedKeyword:

# TODO: Refactor Chrome::Bridge#create_capabilities
Metrics/PerceivedComplexity:
Max: 11
Max: 8
Exclude:
- 'lib/selenium/webdriver/chrome/driver.rb'
- 'lib/selenium/webdriver/remote/capabilities.rb'

Metrics/CyclomaticComplexity:
Max: 9
Exclude:
- 'lib/selenium/webdriver/chrome/driver.rb'
- 'lib/selenium/webdriver/remote/capabilities.rb'
- 'spec/integration/selenium/webdriver/spec_support/test_environment.rb'

Metrics/ClassLength:
CountComments: false
Expand All @@ -70,9 +67,9 @@ Metrics/ClassLength:
- 'lib/selenium/webdriver/remote/capabilities.rb'

Metrics/AbcSize:
Max: 33
Max: 27
Exclude:
- 'lib/selenium/webdriver/common/driver.rb'
- 'lib/selenium/webdriver/remote/http/curb.rb'
- 'lib/selenium/webdriver/support/color.rb'

Metrics/LineLength:
Expand All @@ -90,9 +87,11 @@ Metrics/ModuleLength:

Metrics/MethodLength:
CountComments: false
Max: 33
Max: 22
Exclude:
- 'lib/selenium/webdriver/chrome/driver.rb'
- 'lib/selenium/server.rb'
- 'lib/selenium/webdriver/common/driver.rb'
- 'lib/selenium/webdriver/remote/http/default.rb'

Metrics/BlockLength:
Exclude:
Expand Down
15 changes: 9 additions & 6 deletions rb/lib/selenium/webdriver/remote/capabilities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,7 @@ def json_create(data)
caps.accept_insecure_certs = data.delete('acceptInsecureCerts') if data.key?('acceptInsecureCerts')
caps.page_load_strategy = data.delete('pageLoadStrategy') if data.key?('pageLoadStrategy')

if data.key?('timeouts')
timeouts = data.delete('timeouts')
caps.implicit_timeout = timeouts['implicit'] if timeouts
caps.page_load_timeout = timeouts['pageLoad'] if timeouts
caps.script_timeout = timeouts['script'] if timeouts
end
process_key(caps, data.delete('timeouts'))

if data.key?('proxy')
proxy = data.delete('proxy')
Expand Down Expand Up @@ -268,6 +263,14 @@ def camel_case(str)
str.gsub(/_([a-z])/) { Regexp.last_match(1).upcase }
end

def process_timeouts(caps, timeouts)
return if timeouts.nil?

caps.implicit_timeout = timeouts['implicit']
caps.page_load_timeout = timeouts['pageLoad']
caps.script_timeout = timeouts['script']
end

end # Capabilities
end # Remote
end # WebDriver
Expand Down

0 comments on commit 974a435

Please sign in to comment.