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

Fix an error for Layout/BlockAlignment when using Ruby 3.1.0-dev #10213

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/rubocop/cop/layout/block_alignment.rb
Expand Up @@ -101,11 +101,11 @@ def start_for_block_node(block_node)
def block_end_align_target(node)
lineage = [node, *node.ancestors]

target = lineage.each_cons(2) do |current, parent|
break current if end_align_target?(current, parent)
lineage.each_cons(2) do |current, parent|
return current if end_align_target?(current, parent)
end

target || lineage.last
lineage.last
end

def end_align_target?(node, parent)
Expand Down