Skip to content

Commit

Permalink
[Fix #7779] Fix a false positive for `Style/MultilineMethodCallIndent…
Browse files Browse the repository at this point in the history
…ation` (#7782)

Fixes #7779.

This PR fixes a false positive for `Style/MultilineMethodCallIndentation`
when using Ruby 2.7's numbered parameter.

Co-authored-by: Bozhidar Batsov <bozhidar@batsov.com>
  • Loading branch information
koic and bbatsov committed Mar 7, 2020
1 parent a07363d commit e9e0482
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -8,6 +8,7 @@

### Bug fixes

* [#7779](https://github.com/rubocop-hq/rubocop/issues/7779): Fix a false positive for `Style/MultilineMethodCallIndentation` when using Ruby 2.7's numbered parameter. ([@koic][])
* [#7733](https://github.com/rubocop-hq/rubocop/issues/7733): Fix rubocop-junit-formatter imcompatibility XML for JUnit formatter. ([@koic][])

## 0.80.1 (2020-02-29)
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/ast/node.rb
Expand Up @@ -291,7 +291,7 @@ def source_length
## Destructuring

def_node_matcher :receiver, <<~PATTERN
{(send $_ ...) (block (send $_ ...) ...)}
{(send $_ ...) ({block numblock} (send $_ ...) ...)}
PATTERN

def_node_matcher :str_content, '(str $_)'
Expand Down
11 changes: 11 additions & 0 deletions spec/rubocop/cop/layout/multiline_method_call_indentation_spec.rb
Expand Up @@ -248,6 +248,17 @@ def foo
RUBY
end

context '>= Ruby 2.7', :ruby27 do
it 'accepts methods being aligned with method that is an argument' \
'when using numbered parameter' do
expect_no_offenses(<<~RUBY)
File.read('data.yml')
.then { YAML.safe_load _1 }
.transform_values(&:downcase)
RUBY
end
end

it 'accepts methods being aligned with method that is an argument in ' \
'assignment' do
expect_no_offenses(<<~RUBY)
Expand Down

0 comments on commit e9e0482

Please sign in to comment.