Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocorrect for Layout/MultilineMethodCallBraceLayout breaks some code with heredocs #11200

Closed
stephensolis opened this issue Nov 24, 2022 · 0 comments · Fixed by #11201
Closed
Labels

Comments

@stephensolis
Copy link

Here is an example of some code which is broken after autocorrect:

ERB.new(<<~TEMPLATE, trim_mode: '<>'
  Test
TEMPLATE
).result(binding)

Expected behavior

This should be the correct result:

ERB.new(<<~TEMPLATE, trim_mode: '<>').result(binding)
  Test
TEMPLATE

Actual behavior

This is the actual result which is a syntax error:

ERB.new(<<~TEMPLATE, trim_mode: '<>')
  Test
TEMPLATE.result(binding)

Steps to reproduce the problem

  1. Run rubocop -A on the example file above.
  2. Look at the file.

RuboCop version

$ rubocop -V
1.39.0 (using Parser 3.1.2.1, rubocop-ast 1.23.0, running on ruby 2.7.2) [x86_64-linux]
@koic koic added the bug label Nov 25, 2022
koic added a commit to koic/rubocop that referenced this issue Nov 25, 2022
…eMethodCallBraceLayout`

Fixes rubocop#11200.

This PR fixes an incorrect autocorrect for `Layout/MultilineMethodCallBraceLayout`
when using method chain for heredoc argument in multiline literal brace layout.
koic added a commit that referenced this issue Nov 26, 2022
…layout_multiline_method_call_brace_layout

[Fix #11200] Fix an incorrect autocorrect for `Layout/MultilineMethodCallBraceLayout`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants