Enable Lint/DuplicateMethods rubocop rule

This commit is contained in:
Nikita Vasilevsky 2021-11-15 13:51:28 -05:00
parent 27f17b98d6
commit 2a00c89a7d
No known key found for this signature in database
GPG Key ID: 6A08045F084AAC9C
7 changed files with 9 additions and 8 deletions

View File

@ -208,6 +208,9 @@ Lint/AmbiguousRegexpLiteral:
Lint/DuplicateRequire:
Enabled: true
Lint/DuplicateMethods:
Enabled: true
Lint/ErbNewArguments:
Enabled: true

View File

@ -1917,8 +1917,6 @@ class RouteSetTest < ActiveSupport::TestCase
include ActionDispatch::RoutingVerbs
alias :routes :set
def test_generate_with_optional_params_recalls_last_request
@set = make_set false

View File

@ -305,7 +305,7 @@ class Time
other.is_a?(DateTime) ? to_f - other.to_f : minus_without_coercion(other)
end
alias_method :minus_without_coercion, :-
alias_method :-, :minus_with_coercion
alias_method :-, :minus_with_coercion # rubocop:disable Lint/DuplicateMethods
# Layers additional behavior on Time#<=> so that DateTime and ActiveSupport::TimeWithZone instances
# can be chronologically compared with a Time

View File

@ -153,7 +153,7 @@ module ActiveSupport
Process.clock_gettime(Process::CLOCK_THREAD_CPUTIME_ID, :float_millisecond)
end
rescue
def now_cpu
def now_cpu # rubocop:disable Lint/DuplicateMethods
0.0
end
end
@ -165,7 +165,7 @@ module ActiveSupport
0
end
else
def now_allocations
def now_allocations # rubocop:disable Lint/DuplicateMethods
GC.stat(:total_allocated_objects)
end
end

View File

@ -55,7 +55,7 @@ class ArrayInquirerTest < ActiveSupport::TestCase
ensure
Array.class_eval do
undef_method :respond_to_missing?
def respond_to_missing?(name, include_private = false)
def respond_to_missing?(name, include_private = false) # rubocop:disable Lint/DuplicateMethods
super
end
end

View File

@ -38,7 +38,7 @@ class StringInquirerTest < ActiveSupport::TestCase
ensure
String.class_eval do
undef_method :respond_to_missing?
def respond_to_missing?(name, include_private = false)
def respond_to_missing?(name, include_private = false) # rubocop:disable Lint/DuplicateMethods
super
end
end

View File

@ -34,7 +34,7 @@ end
# Monkey patch subscriber to test that only one subscriber per method is added.
class TestSubscriber
remove_method :open_party
def open_party(event)
def open_party(event) # rubocop:disable Lint/DuplicateMethods
events << event
end
end