mirror of
https://github.com/lostisland/faraday.git
synced 2025-10-04 00:02:03 -04:00
Merge pull request #891 from olleolleolle/fix/rubocop-linting-more
chore: RuboCop linting Lint/UselessAssignment, Lint/StringConversionInInterpolation
This commit is contained in:
commit
d3fc6ec365
@ -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_
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user