updated rubocop, made necessary changes for syntax to be approved

This commit is contained in:
HoneyryderChuck 2019-12-30 02:40:26 +00:00
parent a421fb121b
commit c73d6ff3d9
12 changed files with 38 additions and 25 deletions

View File

@ -12,3 +12,14 @@ Layout/IndentHeredoc:
Style/HashSyntax:
Enabled: false
Naming/UncommunicativeMethodParamName:
Enabled: false
Lint/HandleExceptions:
Enabled: false
Metrics/LineLength:
Exclude:
- 'test/resolver/native_test.rb'
Max: 140

View File

@ -1,7 +1,18 @@
inherit_from: .rubocop.yml
require: rubocop-performance
# TODO: remove this if min supported version of ruby is 2.3
Style/HashSyntax:
Enabled: false
Naming/MethodParameterName:
Enabled: false
Lint/SuppressedException:
Enabled: false
Layout/LineLength:
Exclude:
- 'test/resolver/native_test.rb'
Max: 140

View File

@ -17,11 +17,6 @@ AllCops:
- 'www/**/*'
- 'lib/httpx/extensions.rb'
Metrics/LineLength:
Exclude:
- 'test/resolver/native_test.rb'
Max: 140
Metrics/MethodLength:
Max: 200
@ -36,9 +31,6 @@ Naming/FileName:
Layout/EndAlignment:
EnforcedStyleAlignWith: variable
Lint/HandleExceptions:
Enabled: false
Lint/RescueException:
Exclude:
# starts the server in a new thread

View File

@ -40,5 +40,3 @@ Style/Documentation:
Naming/AccessorMethodName:
Enabled: false
Naming/UncommunicativeMethodParamName:
Enabled: false

View File

@ -13,7 +13,8 @@ if RUBY_VERSION < "2.2"
gem "net-ssh", "~> 4.2.0", require: false
gem "rb-inotify", "~> 0.9.10", require: false
else
gem "rubocop", "~> 0.61.1", require: false
gem "rubocop", "~> 0.78.0", require: false
gem "rubocop-performance", "~> 1.5.2", require: false
end
platform :mri do

View File

@ -195,16 +195,16 @@ module Faraday
response_headers.merge!(response.headers)
end
@app.call(env)
rescue OpenSSL::SSL::SSLError => err
raise SSL_ERROR, err
rescue OpenSSL::SSL::SSLError => e
raise SSL_ERROR, e
rescue Errno::ECONNABORTED,
Errno::ECONNREFUSED,
Errno::ECONNRESET,
Errno::EHOSTUNREACH,
Errno::EINVAL,
Errno::ENETUNREACH,
Errno::EPIPE => err
raise CONNECTION_FAILED_ERROR, err
Errno::EPIPE => e
raise CONNECTION_FAILED_ERROR, e
end
private

View File

@ -107,7 +107,7 @@ module HTTPX
if qop || sess
cnonce = make_cnonce
nc = format("%08x", nc)
nc = format("%<nonce>08x", nonce: nc)
end
a1 = if sess

View File

@ -77,7 +77,7 @@ module HTTPX
case method
when PASSWD
transition(:authenticating)
return
nil
when NONE
__on_socks5_error("no supported authorization methods")
else

View File

@ -33,9 +33,9 @@ module HTTPX
end
@timers.fire
end
rescue StandardError => ex
rescue StandardError => e
@connections.each do |connection|
connection.emit(:error, ex)
connection.emit(:error, e)
end
end

View File

@ -94,11 +94,11 @@ module HTTPX
def on_response(request, response)
response.raise_for_status
rescue Error => ex
rescue Error => e
connection = @requests[request]
hostname = @queries.key(connection)
error = ResolveError.new("Can't resolve #{hostname}: #{ex.message}")
error.set_backtrace(ex.backtrace)
error = ResolveError.new("Can't resolve #{hostname}: #{e.message}")
error.set_backtrace(e.backtrace)
emit(:error, connection, error)
else
parse(response)

View File

@ -24,7 +24,7 @@ module MinitestExtensions
module FirstFailedTestInThread
def self.prepended(*)
super
HTTPX::Session.__send__(:include, SessionExtensions)
HTTPX::Session.include SessionExtensions
end
def setup

View File

@ -14,8 +14,8 @@ end
require "httpx"
Dir[File.join(".", "test", "support", "*.rb")].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 }
Dir[File.join(".", "test", "support", "**", "*.rb")].sort.each { |f| require f }
# Ruby 2.3 openssl configuration somehow ignores SSL_CERT_FILE env var.
# This adds it manually.