1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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: Lint/DuplicateRequire:
Enabled: true Enabled: true
Lint/DuplicateMethods:
Enabled: true
Lint/ErbNewArguments: Lint/ErbNewArguments:
Enabled: true Enabled: true

View file

@ -1917,8 +1917,6 @@ class RouteSetTest < ActiveSupport::TestCase
include ActionDispatch::RoutingVerbs include ActionDispatch::RoutingVerbs
alias :routes :set
def test_generate_with_optional_params_recalls_last_request def test_generate_with_optional_params_recalls_last_request
@set = make_set false @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) other.is_a?(DateTime) ? to_f - other.to_f : minus_without_coercion(other)
end end
alias_method :minus_without_coercion, :- 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 # Layers additional behavior on Time#<=> so that DateTime and ActiveSupport::TimeWithZone instances
# can be chronologically compared with a Time # 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) Process.clock_gettime(Process::CLOCK_THREAD_CPUTIME_ID, :float_millisecond)
end end
rescue rescue
def now_cpu def now_cpu # rubocop:disable Lint/DuplicateMethods
0.0 0.0
end end
end end
@ -165,7 +165,7 @@ module ActiveSupport
0 0
end end
else else
def now_allocations def now_allocations # rubocop:disable Lint/DuplicateMethods
GC.stat(:total_allocated_objects) GC.stat(:total_allocated_objects)
end end
end end

View file

@ -55,7 +55,7 @@ class ArrayInquirerTest < ActiveSupport::TestCase
ensure ensure
Array.class_eval do Array.class_eval do
undef_method :respond_to_missing? 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 super
end end
end end

View file

@ -38,7 +38,7 @@ class StringInquirerTest < ActiveSupport::TestCase
ensure ensure
String.class_eval do String.class_eval do
undef_method :respond_to_missing? 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 super
end end
end end

View file

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