Fixes Rubocop Style/SingleLineMethods.

This commit is contained in:
iMacTia 2019-03-02 16:33:29 +00:00
parent a41b6ac8d9
commit 15303a3415
9 changed files with 27 additions and 23 deletions

View File

@ -294,20 +294,6 @@ Style/SafeNavigation:
- 'lib/faraday/connection.rb' - 'lib/faraday/connection.rb'
- 'lib/faraday/options/proxy_options.rb' - 'lib/faraday/options/proxy_options.rb'
# Offense count: 9
# Cop supports --auto-correct.
# Configuration parameters: AllowIfMethodIsEmpty.
Style/SingleLineMethods:
Exclude:
- 'lib/faraday/adapter.rb'
- 'lib/faraday/adapter/em_http.rb'
- 'lib/faraday/rack_builder.rb'
- 'lib/faraday/utils.rb'
- 'spec/support/fake_safe_buffer.rb'
- 'test/adapters/em_http_test.rb'
- 'test/adapters/em_synchrony_test.rb'
- 'test/adapters/rack_test.rb'
# Offense count: 280 # Offense count: 280
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https # URISchemes: http, https

View File

@ -24,7 +24,9 @@ module Faraday
# This module marks an Adapter as supporting parallel requests. # This module marks an Adapter as supporting parallel requests.
module Parallelism module Parallelism
attr_writer :supports_parallel attr_writer :supports_parallel
def supports_parallel?() @supports_parallel end def supports_parallel?
@supports_parallel
end
def inherited(subclass) def inherited(subclass)
super super

View File

@ -206,7 +206,9 @@ module Faraday
end end
# @return [Boolean] # @return [Boolean]
def running?() @running end def running?
@running
end
def add def add
if running? if running?

View File

@ -36,9 +36,13 @@ module Faraday
@args, @block = args, block @args, @block = args, block
end end
def klass() @@constants[@name] end def klass
@@constants[@name]
end
def inspect() @name end def inspect
@name
end
def ==(other) def ==(other)
if other.is_a? Handler if other.is_a? Handler

View File

@ -23,7 +23,9 @@ module Faraday
end.tr(' ', '+') end.tr(' ', '+')
end end
def unescape(str) CGI.unescape str.to_s end def unescape(str)
CGI.unescape str.to_s
end
DEFAULT_SEP = /[&;] */n DEFAULT_SEP = /[&;] */n

View File

@ -2,7 +2,9 @@
# emulates ActiveSupport::SafeBuffer#gsub # emulates ActiveSupport::SafeBuffer#gsub
FakeSafeBuffer = Struct.new(:string) do FakeSafeBuffer = Struct.new(:string) do
def to_s; self end def to_s
self
end
def gsub(regex) def gsub(regex)
string.gsub(regex) do string.gsub(regex) do

View File

@ -4,7 +4,9 @@ require File.expand_path('integration', __dir__)
module Adapters module Adapters
class EMHttpTest < Faraday::TestCase class EMHttpTest < Faraday::TestCase
def adapter() :em_http end def adapter
:em_http
end
Integration.apply(self, :Parallel, :NonStreaming, :ParallelNonStreaming) do Integration.apply(self, :Parallel, :NonStreaming, :ParallelNonStreaming) do
# https://github.com/eventmachine/eventmachine/pull/289 # https://github.com/eventmachine/eventmachine/pull/289

View File

@ -4,7 +4,9 @@ require File.expand_path('integration', __dir__)
module Adapters module Adapters
class EMSynchronyTest < Faraday::TestCase class EMSynchronyTest < Faraday::TestCase
def adapter() :em_synchrony end def adapter
:em_synchrony
end
unless jruby? unless jruby?
Integration.apply(self, :Parallel, :NonStreaming, :ParallelNonStreaming) do Integration.apply(self, :Parallel, :NonStreaming, :ParallelNonStreaming) do

View File

@ -5,7 +5,9 @@ require File.expand_path('../live_server', __dir__)
module Adapters module Adapters
class RackTest < Faraday::TestCase class RackTest < Faraday::TestCase
def adapter() :rack end def adapter
:rack
end
def adapter_options def adapter_options
[Faraday::LiveServer] [Faraday::LiveServer]