Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: RuboCop Layout/DotPosition #880

Merged
merged 1 commit into from Feb 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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