chore: rubocop lint Style/StructInheritance (#904)

This commit is contained in:
risk danger olson 2019-03-02 02:01:04 -07:00 committed by Olle Jonsson
parent c9fcbcc048
commit c1febd329f
4 changed files with 9 additions and 9 deletions

View File

@ -424,14 +424,7 @@ Style/StringLiteralsInInterpolation:
- 'lib/faraday/options/env.rb'
- 'spec/faraday/utils_spec.rb'
# Offense count: 3
Style/StructInheritance:
Exclude:
- 'lib/faraday/adapter/test.rb'
- 'lib/faraday/request.rb'
- 'spec/faraday/rack_builder_spec.rb'
# Offense count: 272
# Offense count: 271
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:

View File

@ -132,7 +132,10 @@ module Faraday
end
end
# rubocop:disable Style/StructInheritance
class Stub < Struct.new(:host, :path, :params, :headers, :body, :block)
# rubocop:enable Style/StructInheritance
def initialize(host, full, headers, body, block)
path, query = full.respond_to?(:split) ? full.split('?') : full
params = query ?

View File

@ -24,7 +24,11 @@ module Faraday
# @return [Hash] body
# @!attribute options
# @return [RequestOptions] options
#
# rubocop:disable Style/StructInheritance
class Request < Struct.new(:method, :path, :params, :headers, :body, :options)
# rubocop:enable Style/StructInheritance
extend MiddlewareRegistry
register_middleware File.expand_path('request', __dir__),

View File

@ -2,7 +2,7 @@
RSpec.describe Faraday::RackBuilder do
# mock handler classes
class Handler < Struct.new(:app)
(Handler = Struct.new(:app)).class_eval do
def call(env)
env[:request_headers]['X-Middleware'] ||= ''
env[:request_headers]['X-Middleware'] += ":#{self.class.name.split('::').last}"