chore: Fix RuboCop Layout/AlignParameters (#867)

This commit is contained in:
htwroclau 2019-02-25 22:38:48 +09:00 committed by Mattia
parent b427091f0e
commit de0e96054d
8 changed files with 46 additions and 60 deletions

View File

@ -1,25 +1,11 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2019-02-23 11:03:41 +0100 using RuboCop version 0.65.0.
# on 2019-02-24 10:08:41 +0100 using RuboCop version 0.65.0.
# 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
# versions of RuboCop, may require this file to be generated again.
# Offense count: 12
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: with_first_parameter, with_fixed_indentation
Layout/AlignParameters:
Exclude:
- 'lib/faraday.rb'
- 'lib/faraday/adapter.rb'
- 'lib/faraday/adapter/httpclient.rb'
- 'lib/faraday/autoload.rb'
- 'lib/faraday/rack_builder.rb'
- 'lib/faraday/request.rb'
- 'lib/faraday/response.rb'
# Offense count: 2
# Cop supports --auto-correct.
Layout/BlockEndNewline:

View File

@ -152,7 +152,7 @@ module Faraday
end
require_libs "utils", "options", "connection", "rack_builder", "parameters",
"middleware", "adapter", "request", "response", "upload_io", "error"
"middleware", "adapter", "request", "response", "upload_io", "error"
if !ENV["FARADAY_NO_AUTOLOAD"]
require_lib 'autoload'

View File

@ -10,16 +10,16 @@ module Faraday
CONTENT_LENGTH = 'Content-Length'
register_middleware File.expand_path('../adapter', __FILE__),
:test => [:Test, 'test'],
:net_http => [:NetHttp, 'net_http'],
:net_http_persistent => [:NetHttpPersistent, 'net_http_persistent'],
:typhoeus => [:Typhoeus, 'typhoeus'],
:patron => [:Patron, 'patron'],
:em_synchrony => [:EMSynchrony, 'em_synchrony'],
:em_http => [:EMHttp, 'em_http'],
:excon => [:Excon, 'excon'],
:rack => [:Rack, 'rack'],
:httpclient => [:HTTPClient, 'httpclient']
:test => [:Test, 'test'],
:net_http => [:NetHttp, 'net_http'],
:net_http_persistent => [:NetHttpPersistent, 'net_http_persistent'],
:typhoeus => [:Typhoeus, 'typhoeus'],
:patron => [:Patron, 'patron'],
:em_synchrony => [:EMSynchrony, 'em_synchrony'],
:em_http => [:EMHttp, 'em_http'],
:excon => [:Excon, 'excon'],
:rack => [:Rack, 'rack'],
:httpclient => [:HTTPClient, 'httpclient']
# This module marks an Adapter as supporting parallel requests.
module Parallelism

View File

@ -40,8 +40,8 @@ module Faraday
env[:body] = env[:body].read if env[:body].respond_to? :read
resp = client.request env[:method], env[:url],
:body => env[:body],
:header => env[:request_headers]
:body => env[:body],
:header => env[:request_headers]
if (req = env[:request]).stream_response?
warn "Streaming downloads for #{self.class.name} are not yet implemented."

View File

@ -55,34 +55,34 @@ module Faraday
class Adapter
extend AutoloadHelper
autoload_all 'faraday/adapter',
:NetHttp => 'net_http',
:NetHttpPersistent => 'net_http_persistent',
:EMSynchrony => 'em_synchrony',
:EMHttp => 'em_http',
:Typhoeus => 'typhoeus',
:Patron => 'patron',
:Excon => 'excon',
:Test => 'test',
:Rack => 'rack',
:HTTPClient => 'httpclient'
:NetHttp => 'net_http',
:NetHttpPersistent => 'net_http_persistent',
:EMSynchrony => 'em_synchrony',
:EMHttp => 'em_http',
:Typhoeus => 'typhoeus',
:Patron => 'patron',
:Excon => 'excon',
:Test => 'test',
:Rack => 'rack',
:HTTPClient => 'httpclient'
end
class Request
extend AutoloadHelper
autoload_all 'faraday/request',
:UrlEncoded => 'url_encoded',
:Multipart => 'multipart',
:Retry => 'retry',
:Authorization => 'authorization',
:BasicAuthentication => 'basic_authentication',
:TokenAuthentication => 'token_authentication',
:Instrumentation => 'instrumentation'
:UrlEncoded => 'url_encoded',
:Multipart => 'multipart',
:Retry => 'retry',
:Authorization => 'authorization',
:BasicAuthentication => 'basic_authentication',
:TokenAuthentication => 'token_authentication',
:Instrumentation => 'instrumentation'
end
class Response
extend AutoloadHelper
autoload_all 'faraday/response',
:RaiseError => 'raise_error',
:Logger => 'logger'
:RaiseError => 'raise_error',
:Logger => 'logger'
end
end

View File

@ -199,9 +199,9 @@ module Faraday
# :ssl - Hash of options for configuring SSL requests.
def build_env(connection, request)
Env.new(request.method, request.body,
connection.build_exclusive_url(request.path, request.params, request.options.params_encoder),
request.options, request.headers, connection.ssl,
connection.parallel_manager)
connection.build_exclusive_url(request.path, request.params, request.options.params_encoder),
request.options, request.headers, connection.ssl,
connection.parallel_manager)
end
private

View File

@ -28,13 +28,13 @@ module Faraday
extend MiddlewareRegistry
register_middleware File.expand_path('../request', __FILE__),
:url_encoded => [:UrlEncoded, 'url_encoded'],
:multipart => [:Multipart, 'multipart'],
:retry => [:Retry, 'retry'],
:authorization => [:Authorization, 'authorization'],
:basic_auth => [:BasicAuthentication, 'basic_authentication'],
:token_auth => [:TokenAuthentication, 'token_authentication'],
:instrumentation => [:Instrumentation, 'instrumentation']
:url_encoded => [:UrlEncoded, 'url_encoded'],
:multipart => [:Multipart, 'multipart'],
:retry => [:Retry, 'retry'],
:authorization => [:Authorization, 'authorization'],
:basic_auth => [:BasicAuthentication, 'basic_authentication'],
:token_auth => [:TokenAuthentication, 'token_authentication'],
:instrumentation => [:Instrumentation, 'instrumentation']
# @param request_method [String]
# @yield [request] for block customization, if block given
@ -130,7 +130,7 @@ module Faraday
# @return [Env] the Env for this Request
def to_env(connection)
Env.new(method, body, connection.build_exclusive_url(path, params),
options, headers, connection.ssl, connection.parallel_manager)
options, headers, connection.ssl, connection.parallel_manager)
end
end
end

View File

@ -23,8 +23,8 @@ module Faraday
extend MiddlewareRegistry
register_middleware File.expand_path('../response', __FILE__),
:raise_error => [:RaiseError, 'raise_error'],
:logger => [:Logger, 'logger']
:raise_error => [:RaiseError, 'raise_error'],
:logger => [:Logger, 'logger']
def initialize(env = nil)
@env = Env.from(env) if env