You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Code that correctly confirms to the Layout/MultilineMethodCallIndentation cop's default "aligned" enforced style while making use of blocks with Ruby 2.7's new numbered parameters feature should not raise an offense.
Actual behavior
Lines that follow the numbered parameter block are reported as being indented incorrectly.
Steps to reproduce the problem
Given the following example.rb file:
File.read('data.yml').then{ |file| YAML.safe_loadfile}# normal block param.transform_values(&:downcase).freezeFile.read('data.yml').then{YAML.safe_load_1}# numbered param.transform_values(&:downcase).freeze
Running rubocop cop gives the following results:
$ rubocop example.rb --only Layout/MultilineMethodCallIndentation
Inspecting 1 file
C
Offenses:
example.rb:8:5: C: Layout/MultilineMethodCallIndentation: Use 2 (not 4) spaces for indenting an expression spanning multiple lines.
.transform_values(&:downcase)
^^^^^^^^^^^^^^^^^
example.rb:9:5: C: Layout/MultilineMethodCallIndentation: Use 2 (not 4) spaces for indenting an expression spanning multiple lines.
.freeze
^^^^^^^
1 file inspected, 2 offenses detected
Note how the first version of the code in the file (using normal block params) is considered correct while the second version (using Ruby 2.7 numbered params) is considered incorrect.
…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>
Expected behavior
Code that correctly confirms to the Layout/MultilineMethodCallIndentation cop's default "aligned" enforced style while making use of blocks with Ruby 2.7's new numbered parameters feature should not raise an offense.
Actual behavior
Lines that follow the numbered parameter block are reported as being indented incorrectly.
Steps to reproduce the problem
Given the following
example.rb
file:Running rubocop cop gives the following results:
Note how the first version of the code in the file (using normal block params) is considered correct while the second version (using Ruby 2.7 numbered params) is considered incorrect.
RuboCop version
The text was updated successfully, but these errors were encountered: