Skip to content

Commit

Permalink
[Fix rubocop#7779] Fix a false positive for `Style/MultilineMethodCal…
Browse files Browse the repository at this point in the history
…lIndentation`

Fixes rubocop#7779.

This PR fixes a false positive for `Style/MultilineMethodCallIndentation`
when using Ruby 2.7's numbered parameter.
  • Loading branch information
koic committed Mar 7, 2020
1 parent 9687b88 commit d8bdede
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,10 @@

* [#7654](https://github.com/rubocop-hq/rubocop/issues/7654): Support `with_fixed_indentation` option for `Layout/ArrayAlignment` cop. ([@nikitasakov][])

### 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][])

## 0.80.1 (2020-02-29)

### Bug fixes
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 d8bdede

Please sign in to comment.