Skip to content
Discussion options

You must be logged in to vote

I was actually looking into doing that after I made that comment but there are reasons that the AST could change without changing operator precedence.

For instance, this test:

it 'autocorrects do-end with `ensure` to {} if it is a functional block' do
expect_offense(<<~RUBY)
x = map do |a|
^^ Prefer `{...}` over `do...end` for functional blocks.
do_something
ensure
puts 'oh no'
end
RUBY
expect_correction(<<~RUBY)
x = map { |a|
begin
do_something
ensure
puts 'oh no'
end
}
RUBY
end

T…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@stdedos
Comment options

@dvandersluis
Comment options

Answer selected by stdedos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants