Merge pull request #891 from olleolleolle/fix/rubocop-linting-more

chore: RuboCop linting Lint/UselessAssignment, Lint/StringConversionInInterpolation
This commit is contained in:
risk danger olson 2019-02-27 14:19:45 -07:00 committed by GitHub
commit d3fc6ec365
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 33 deletions

View File

@ -16,13 +16,6 @@ Lint/ReturnInVoidContext:
Exclude:
- 'lib/faraday/options/env.rb'
# Offense count: 2
# Cop supports --auto-correct.
Lint/StringConversionInInterpolation:
Exclude:
- 'lib/faraday/response/logger.rb'
- 'test/live_server.rb'
# Offense count: 2
# Cop supports --auto-correct.
Lint/UnneededRequireStatement:
@ -51,11 +44,6 @@ Lint/UnusedMethodArgument:
- 'script/generate_certs'
- 'spec/faraday/response/middleware_spec.rb'
# Offense count: 1
Lint/UselessAssignment:
Exclude:
- 'lib/faraday/adapter/net_http.rb'
# Offense count: 1
# Configuration parameters: CheckForMethodsWithNoSideEffects.
Lint/Void:
@ -101,13 +89,6 @@ Naming/ConstantName:
- 'lib/faraday/options/env.rb'
- 'lib/faraday/response/raise_error.rb'
# Offense count: 1
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
# SupportedStylesForLeadingUnderscores: disallowed, required, optional
Naming/MemoizedInstanceVariableName:
Exclude:
- 'lib/faraday/adapter/httpclient.rb'
# Offense count: 2
# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist, MethodDefinitionMacros.
# NamePrefix: is_, has_, have_

View File

@ -121,13 +121,11 @@ module Faraday
return ssl[:cert_store] if ssl[:cert_store]
# Memoize the cert store so that the same one is passed to
# HTTPClient each time, to avoid resyncing SSL sesions when
# HTTPClient each time, to avoid resyncing SSL sessions when
# it's changed
@cert_store ||= begin
@ssl_cert_store ||= begin
# Use the default cert store by default, i.e. system ca certs
cert_store = OpenSSL::X509::Store.new
cert_store.set_default_paths
cert_store
OpenSSL::X509::Store.new.tap(&:set_default_paths)
end
end

View File

@ -32,7 +32,7 @@ module Faraday
NET_HTTP_EXCEPTIONS << Net::OpenTimeout if defined?(Net::OpenTimeout)
def initialize(app = nil, opts = {}, &block)
@cert_store = nil
@ssl_cert_store = nil
super(app, opts, &block)
end
@ -98,7 +98,7 @@ module Faraday
http_response.body = nil
http_response
else
http_response = perform_request_with_wrapped_block(http, env)
perform_request_with_wrapped_block(http, env)
end
end
@ -168,12 +168,11 @@ module Faraday
def ssl_cert_store(ssl)
return ssl[:cert_store] if ssl[:cert_store]
return @cert_store if @cert_store
# Use the default cert store by default, i.e. system ca certs
@cert_store = OpenSSL::X509::Store.new
@cert_store.set_default_paths
@cert_store
@ssl_cert_store ||= begin
# Use the default cert store by default, i.e. system ca certs
OpenSSL::X509::Store.new.tap(&:set_default_paths)
end
end
def ssl_verify_mode(ssl)

View File

@ -29,7 +29,7 @@ module Faraday
end
def on_complete(env)
info('response') { "Status #{env.status.to_s}" }
info('response') { "Status #{env.status}" }
debug('response') { apply_filters(dump_headers env.response_headers) } if log_headers?(:response)
debug('response') { apply_filters(dump_body env[:body]) } if env[:body] && log_body?(:response)
end

View File

@ -80,7 +80,7 @@ module Faraday
end
error do |e|
"#{e.class}\n#{e.to_s}\n#{e.backtrace.join("\n")}"
"#{e.class}\n#{e}\n#{e.backtrace.join("\n")}"
end
end
end