mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-11-22 00:05:57 -05:00
updated rubocop, made necessary changes for syntax to be approved
This commit is contained in:
parent
a421fb121b
commit
c73d6ff3d9
@ -12,3 +12,14 @@ Layout/IndentHeredoc:
|
|||||||
|
|
||||||
Style/HashSyntax:
|
Style/HashSyntax:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
Naming/UncommunicativeMethodParamName:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Lint/HandleExceptions:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Metrics/LineLength:
|
||||||
|
Exclude:
|
||||||
|
- 'test/resolver/native_test.rb'
|
||||||
|
Max: 140
|
||||||
|
|||||||
@ -1,7 +1,18 @@
|
|||||||
inherit_from: .rubocop.yml
|
inherit_from: .rubocop.yml
|
||||||
|
|
||||||
|
require: rubocop-performance
|
||||||
|
|
||||||
# TODO: remove this if min supported version of ruby is 2.3
|
# TODO: remove this if min supported version of ruby is 2.3
|
||||||
Style/HashSyntax:
|
Style/HashSyntax:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
Naming/MethodParameterName:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Lint/SuppressedException:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Layout/LineLength:
|
||||||
|
Exclude:
|
||||||
|
- 'test/resolver/native_test.rb'
|
||||||
|
Max: 140
|
||||||
|
|||||||
@ -17,11 +17,6 @@ AllCops:
|
|||||||
- 'www/**/*'
|
- 'www/**/*'
|
||||||
- 'lib/httpx/extensions.rb'
|
- 'lib/httpx/extensions.rb'
|
||||||
|
|
||||||
Metrics/LineLength:
|
|
||||||
Exclude:
|
|
||||||
- 'test/resolver/native_test.rb'
|
|
||||||
Max: 140
|
|
||||||
|
|
||||||
Metrics/MethodLength:
|
Metrics/MethodLength:
|
||||||
Max: 200
|
Max: 200
|
||||||
|
|
||||||
@ -36,9 +31,6 @@ Naming/FileName:
|
|||||||
Layout/EndAlignment:
|
Layout/EndAlignment:
|
||||||
EnforcedStyleAlignWith: variable
|
EnforcedStyleAlignWith: variable
|
||||||
|
|
||||||
Lint/HandleExceptions:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
Lint/RescueException:
|
Lint/RescueException:
|
||||||
Exclude:
|
Exclude:
|
||||||
# starts the server in a new thread
|
# starts the server in a new thread
|
||||||
|
|||||||
@ -40,5 +40,3 @@ Style/Documentation:
|
|||||||
Naming/AccessorMethodName:
|
Naming/AccessorMethodName:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Naming/UncommunicativeMethodParamName:
|
|
||||||
Enabled: false
|
|
||||||
|
|||||||
3
Gemfile
3
Gemfile
@ -13,7 +13,8 @@ if RUBY_VERSION < "2.2"
|
|||||||
gem "net-ssh", "~> 4.2.0", require: false
|
gem "net-ssh", "~> 4.2.0", require: false
|
||||||
gem "rb-inotify", "~> 0.9.10", require: false
|
gem "rb-inotify", "~> 0.9.10", require: false
|
||||||
else
|
else
|
||||||
gem "rubocop", "~> 0.61.1", require: false
|
gem "rubocop", "~> 0.78.0", require: false
|
||||||
|
gem "rubocop-performance", "~> 1.5.2", require: false
|
||||||
end
|
end
|
||||||
|
|
||||||
platform :mri do
|
platform :mri do
|
||||||
|
|||||||
@ -195,16 +195,16 @@ module Faraday
|
|||||||
response_headers.merge!(response.headers)
|
response_headers.merge!(response.headers)
|
||||||
end
|
end
|
||||||
@app.call(env)
|
@app.call(env)
|
||||||
rescue OpenSSL::SSL::SSLError => err
|
rescue OpenSSL::SSL::SSLError => e
|
||||||
raise SSL_ERROR, err
|
raise SSL_ERROR, e
|
||||||
rescue Errno::ECONNABORTED,
|
rescue Errno::ECONNABORTED,
|
||||||
Errno::ECONNREFUSED,
|
Errno::ECONNREFUSED,
|
||||||
Errno::ECONNRESET,
|
Errno::ECONNRESET,
|
||||||
Errno::EHOSTUNREACH,
|
Errno::EHOSTUNREACH,
|
||||||
Errno::EINVAL,
|
Errno::EINVAL,
|
||||||
Errno::ENETUNREACH,
|
Errno::ENETUNREACH,
|
||||||
Errno::EPIPE => err
|
Errno::EPIPE => e
|
||||||
raise CONNECTION_FAILED_ERROR, err
|
raise CONNECTION_FAILED_ERROR, e
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@ -107,7 +107,7 @@ module HTTPX
|
|||||||
|
|
||||||
if qop || sess
|
if qop || sess
|
||||||
cnonce = make_cnonce
|
cnonce = make_cnonce
|
||||||
nc = format("%08x", nc)
|
nc = format("%<nonce>08x", nonce: nc)
|
||||||
end
|
end
|
||||||
|
|
||||||
a1 = if sess
|
a1 = if sess
|
||||||
|
|||||||
@ -77,7 +77,7 @@ module HTTPX
|
|||||||
case method
|
case method
|
||||||
when PASSWD
|
when PASSWD
|
||||||
transition(:authenticating)
|
transition(:authenticating)
|
||||||
return
|
nil
|
||||||
when NONE
|
when NONE
|
||||||
__on_socks5_error("no supported authorization methods")
|
__on_socks5_error("no supported authorization methods")
|
||||||
else
|
else
|
||||||
|
|||||||
@ -33,9 +33,9 @@ module HTTPX
|
|||||||
end
|
end
|
||||||
@timers.fire
|
@timers.fire
|
||||||
end
|
end
|
||||||
rescue StandardError => ex
|
rescue StandardError => e
|
||||||
@connections.each do |connection|
|
@connections.each do |connection|
|
||||||
connection.emit(:error, ex)
|
connection.emit(:error, e)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -94,11 +94,11 @@ module HTTPX
|
|||||||
|
|
||||||
def on_response(request, response)
|
def on_response(request, response)
|
||||||
response.raise_for_status
|
response.raise_for_status
|
||||||
rescue Error => ex
|
rescue Error => e
|
||||||
connection = @requests[request]
|
connection = @requests[request]
|
||||||
hostname = @queries.key(connection)
|
hostname = @queries.key(connection)
|
||||||
error = ResolveError.new("Can't resolve #{hostname}: #{ex.message}")
|
error = ResolveError.new("Can't resolve #{hostname}: #{e.message}")
|
||||||
error.set_backtrace(ex.backtrace)
|
error.set_backtrace(e.backtrace)
|
||||||
emit(:error, connection, error)
|
emit(:error, connection, error)
|
||||||
else
|
else
|
||||||
parse(response)
|
parse(response)
|
||||||
|
|||||||
@ -24,7 +24,7 @@ module MinitestExtensions
|
|||||||
module FirstFailedTestInThread
|
module FirstFailedTestInThread
|
||||||
def self.prepended(*)
|
def self.prepended(*)
|
||||||
super
|
super
|
||||||
HTTPX::Session.__send__(:include, SessionExtensions)
|
HTTPX::Session.include SessionExtensions
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
|
|||||||
@ -14,8 +14,8 @@ end
|
|||||||
|
|
||||||
require "httpx"
|
require "httpx"
|
||||||
|
|
||||||
Dir[File.join(".", "test", "support", "*.rb")].each { |f| require f }
|
Dir[File.join(".", "test", "support", "*.rb")].sort.each { |f| require f }
|
||||||
Dir[File.join(".", "test", "support", "**", "*.rb")].each { |f| require f }
|
Dir[File.join(".", "test", "support", "**", "*.rb")].sort.each { |f| require f }
|
||||||
|
|
||||||
# Ruby 2.3 openssl configuration somehow ignores SSL_CERT_FILE env var.
|
# Ruby 2.3 openssl configuration somehow ignores SSL_CERT_FILE env var.
|
||||||
# This adds it manually.
|
# This adds it manually.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user