Skip to content

Commit ee8948b

Browse files
authored
Merge pull request rails#43374 from nvasilevski/enable-duplicate-methods-name-cop
Enable Lint/DuplicateMethods rubocop rule
2 parents 1c2468f + 2a00c89 commit ee8948b

File tree

7 files changed

+9
-8
lines changed

7 files changed

+9
-8
lines changed

.rubocop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@ Lint/AmbiguousRegexpLiteral:
208208
Lint/DuplicateRequire:
209209
Enabled: true
210210

211+
Lint/DuplicateMethods:
212+
Enabled: true
213+
211214
Lint/ErbNewArguments:
212215
Enabled: true
213216

actionpack/test/controller/routing_test.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,8 +1917,6 @@ def test_generate_with_default_params
19171917

19181918
include ActionDispatch::RoutingVerbs
19191919

1920-
alias :routes :set
1921-
19221920
def test_generate_with_optional_params_recalls_last_request
19231921
@set = make_set false
19241922

activesupport/lib/active_support/core_ext/time/calculations.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ def minus_with_coercion(other)
305305
other.is_a?(DateTime) ? to_f - other.to_f : minus_without_coercion(other)
306306
end
307307
alias_method :minus_without_coercion, :-
308-
alias_method :-, :minus_with_coercion
308+
alias_method :-, :minus_with_coercion # rubocop:disable Lint/DuplicateMethods
309309

310310
# Layers additional behavior on Time#<=> so that DateTime and ActiveSupport::TimeWithZone instances
311311
# can be chronologically compared with a Time

activesupport/lib/active_support/notifications/instrumenter.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def now_cpu
153153
Process.clock_gettime(Process::CLOCK_THREAD_CPUTIME_ID, :float_millisecond)
154154
end
155155
rescue
156-
def now_cpu
156+
def now_cpu # rubocop:disable Lint/DuplicateMethods
157157
0.0
158158
end
159159
end
@@ -165,7 +165,7 @@ def now_allocations
165165
0
166166
end
167167
else
168-
def now_allocations
168+
def now_allocations # rubocop:disable Lint/DuplicateMethods
169169
GC.stat(:total_allocated_objects)
170170
end
171171
end

activesupport/test/array_inquirer_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def respond_to_missing?(name, include_private = false)
5555
ensure
5656
Array.class_eval do
5757
undef_method :respond_to_missing?
58-
def respond_to_missing?(name, include_private = false)
58+
def respond_to_missing?(name, include_private = false) # rubocop:disable Lint/DuplicateMethods
5959
super
6060
end
6161
end

activesupport/test/string_inquirer_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def respond_to_missing?(name, include_private = false)
3838
ensure
3939
String.class_eval do
4040
undef_method :respond_to_missing?
41-
def respond_to_missing?(name, include_private = false)
41+
def respond_to_missing?(name, include_private = false) # rubocop:disable Lint/DuplicateMethods
4242
super
4343
end
4444
end

activesupport/test/subscriber_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def another_open_party(event)
3434
# Monkey patch subscriber to test that only one subscriber per method is added.
3535
class TestSubscriber
3636
remove_method :open_party
37-
def open_party(event)
37+
def open_party(event) # rubocop:disable Lint/DuplicateMethods
3838
events << event
3939
end
4040
end

0 commit comments

Comments
 (0)