Skip to content

Commit

Permalink
Make Naming/MethodParameterName cop aware of argument forwarding
Browse files Browse the repository at this point in the history
  • Loading branch information
Drenmi authored and bbatsov committed Jan 2, 2020
1 parent 6f096c2 commit 2c0eec6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* [#7576](https://github.com/rubocop-hq/rubocop/issues/7576): Fix an error for `Gemspec/OrderedDependencies` when using a local variable in an argument of dependent gem. ([@koic][])
* [#7595](https://github.com/rubocop-hq/rubocop/issues/7595): Make `Style/NumericPredicate` aware of ignored methods when specifying ignored methods. ([@koic][])
* [#7607](https://github.com/rubocop-hq/rubocop/issues/7607): Fix `Style/FrozenStringLiteralComment` infinite loop when magic comments are newline-separated. ([@pirj][])
* [#7602](https://github.com/rubocop-hq/rubocop/pull/7602): Ensure proper handling of Ruby 2.7 syntax. ([@drenmi][])

## 0.78.0 (2019-12-18)

Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/naming/method_parameter_name.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class MethodParameterName < Cop
def on_def(node)
return unless node.arguments?

check(node, node.arguments)
check(node, node.arguments.reject(&:forward_args_type?))
end
alias on_defs on_def
end
Expand Down
8 changes: 8 additions & 0 deletions spec/rubocop/cop/naming/method_parameter_name_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
}
end

context 'when using argument forwarding', :ruby27 do
it 'does not register an offense' do
expect_no_offenses(<<~RUBY)
def foo(...); end
RUBY
end
end

it 'does not register for method without parameters' do
expect_no_offenses(<<~RUBY)
def something
Expand Down

0 comments on commit 2c0eec6

Please sign in to comment.