Skip to content

Commit

Permalink
chore: RuboCop Layout/DotPosition (#880)
Browse files Browse the repository at this point in the history
  • Loading branch information
jherdman authored and iMacTia committed Feb 26, 2019
1 parent 6634449 commit 3adf411
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 23 deletions.
12 changes: 1 addition & 11 deletions .rubocop_todo.yml
Expand Up @@ -6,16 +6,6 @@
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 7
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: leading, trailing
Layout/DotPosition:
Exclude:
- 'lib/faraday/adapter/em_http.rb'
- 'lib/faraday/autoload.rb'
- 'lib/faraday/connection.rb'

# Offense count: 1
# Cop supports --auto-correct.
Layout/EmptyLinesAroundAccessModifier:
Expand Down Expand Up @@ -249,7 +239,7 @@ Metrics/BlockLength:
# Offense count: 5
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 216
Max: 217

# Offense count: 20
Metrics/CyclomaticComplexity:
Expand Down
16 changes: 8 additions & 8 deletions lib/faraday/adapter/em_http.rb
Expand Up @@ -104,17 +104,17 @@ def perform_request(env)
if parallel?(env)
manager = env[:parallel_manager]
manager.add {
perform_single_request(env).
callback { env[:response].finish(env) }
perform_single_request(env)
.callback { env[:response].finish(env) }
}
else
unless EventMachine.reactor_running?
error = nil
# start EM, block until request is completed
EventMachine.run do
perform_single_request(env).
callback { EventMachine.stop }.
errback { |client|
perform_single_request(env)
.callback { EventMachine.stop }
.errback { |client|
error = error_message(client)
EventMachine.stop
}
Expand All @@ -123,9 +123,9 @@ def perform_request(env)
else
# EM is running: instruct upstream that this is an async request
env[:parallel_manager] = true
perform_single_request(env).
callback { env[:response].finish(env) }.
errback {
perform_single_request(env)
.callback { env[:response].finish(env) }
.errback {
# TODO: no way to communicate the error in async mode
raise NotImplementedError
}
Expand Down
5 changes: 3 additions & 2 deletions lib/faraday/autoload.rb
Expand Up @@ -47,8 +47,9 @@ def load_autoloaded_constants
#
# @return [Array<Class, Module>]
def all_loaded_constants
constants.map { |c| const_get(c) }.
select { |a| a.respond_to?(:loaded?) && a.loaded? }
constants
.map { |c| const_get(c) }
.select { |a| a.respond_to?(:loaded?) && a.loaded? }
end
end

Expand Down
6 changes: 4 additions & 2 deletions lib/faraday/connection.rb
Expand Up @@ -549,8 +549,10 @@ def with_uri_credentials(uri)
end

def set_authorization_header(header_type, *args)
header = Faraday::Request.lookup_middleware(header_type).
header(*args)
header = Faraday::Request
.lookup_middleware(header_type)
.header(*args)

headers[Faraday::Request::Authorization::KEY] = header
end

Expand Down

0 comments on commit 3adf411

Please sign in to comment.