Normally, syntax_tree will convert single-line do...end into braces. For example:
- expect do blah end.to(eq(5))
+ expect { blah }.to(eq(5))
However, if the parenthesis are missing from to() (as they often are in rspec code), no attempt is made to use braces. The code remains as
expect do blah end.to eq(5)
Context: in Discourse we previously had a number of things like
expect do
blah
end.to eq(5)
That reads ok.
After syntax_tree formatting this has been moved onto a single line, and maintained the do ... end
expect do blah end.to eq(5)
which is not ideal.
Normally, syntax_tree will convert single-line
do...endinto braces. For example:However, if the parenthesis are missing from
to()(as they often are in rspec code), no attempt is made to use braces. The code remains asContext: in Discourse we previously had a number of things like
That reads ok.
After syntax_tree formatting this has been moved onto a single line, and maintained the
do ... endwhich is not ideal.