Skip to content

Commit

Permalink
Enable Lint/DuplicateMethods rubocop rule
Browse files Browse the repository at this point in the history
  • Loading branch information
nvasilevski committed Nov 15, 2021
1 parent 27f17b9 commit 2a00c89
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Expand Up @@ -208,6 +208,9 @@ Lint/AmbiguousRegexpLiteral:
Lint/DuplicateRequire:
Enabled: true

Lint/DuplicateMethods:
Enabled: true

Lint/ErbNewArguments:
Enabled: true

Expand Down
2 changes: 0 additions & 2 deletions actionpack/test/controller/routing_test.rb
Expand Up @@ -1917,8 +1917,6 @@ def test_generate_with_default_params

include ActionDispatch::RoutingVerbs

alias :routes :set

def test_generate_with_optional_params_recalls_last_request
@set = make_set false

Expand Down
Expand Up @@ -305,7 +305,7 @@ def minus_with_coercion(other)
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
Expand Down
Expand Up @@ -153,7 +153,7 @@ def now_cpu
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
Expand All @@ -165,7 +165,7 @@ def now_allocations
0
end
else
def now_allocations
def now_allocations # rubocop:disable Lint/DuplicateMethods
GC.stat(:total_allocated_objects)
end
end
Expand Down
2 changes: 1 addition & 1 deletion activesupport/test/array_inquirer_test.rb
Expand Up @@ -55,7 +55,7 @@ def respond_to_missing?(name, include_private = false)
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
Expand Down
2 changes: 1 addition & 1 deletion activesupport/test/string_inquirer_test.rb
Expand Up @@ -38,7 +38,7 @@ def respond_to_missing?(name, include_private = false)
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
Expand Down
2 changes: 1 addition & 1 deletion activesupport/test/subscriber_test.rb
Expand Up @@ -34,7 +34,7 @@ def another_open_party(event)
# 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
Expand Down

0 comments on commit 2a00c89

Please sign in to comment.