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

Layout/BlockAlignment does not recognize "start of line" containing endless method #12795

Open
jedediah opened this issue Mar 17, 2024 · 1 comment

Comments

@jedediah
Copy link

Based on the rule description for Layout/BlockAlignment with start_of_line

the end shall be aligned with the start of the line where the expression started

I would expect this

def foo = bar(123,
              456) do
  # ...
end

to be allowed, but it isn't. It seems that "start of the line" actually means the start of the method body, and not the actual line.


Expected behavior

No offense

Actual behavior

woot.rb:4:1: C: [Correctable] Layout/BlockAlignment: end at 4, 0 is not aligned with bar(123, at 1, 10 or 456) do at 2, 14.
end
^^^

Steps to reproduce the problem

  • Enable Layout/BlockAlignment with EnforcedStyleAlignWith set to start_of_line or either
  • Lint the code block above

RuboCop version

1.62.1 (using Parser 3.3.0.5, rubocop-ast 1.31.2, running on ruby 3.2.2) [arm64-darwin21]
  - rubocop-rails 2.22.1
@jedediah
Copy link
Author

ElseAlignment also has this issue, but not EndAlignment or BeginEndAlignment, interestingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant