You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first case shows that multiline lambdas get formatted with do/end
The second case shows that multiline lambdas get formatted with do/end inside methods
The third case shows that multiline lambdas get formatted with do/end when nested
The fourth case shows that multiline lambdas get formatted with do/end when passed as a block in a method call without arguments (parsed as a method_add_block)
The fifth case shows that multiline lambdas get formatted with do/end when passed as a block in a method call with arguments but with parentheses (parsed as a method_add_block)
The sixth case is failing, shows that multiline lambdas get formatted with braces when passed as a block in a method call with arguments but no parentheses (which is parsed as a command)
If we remove that special handling, Rubocop will always enforce using do/end for multiline blocks, but stree write will force braces, when called in a method call with arguments but no parentheses, typically in tests in Rails with ActiveSupport::Testing::Declarative:
That makes rubocop and stree incompatible for that rule. Once the formatting is fixed to always generate do/end for multiline lambdas, we could add this to config/rubocop.yml to make them compatible:
Style/BlockDelimiters:
AllowedMethods: []
The text was updated successfully, but these errors were encountered:
This shows the issue with fixtures:
method_add_block
)method_add_block
)command
)Additionally, Rubocop is fine with braces for multiline lambdas because method calls to
lambda
(including stabby lambdas),proc
andit
are special-cased: https://github.com/rubocop/rubocop/blob/1884a46d9284b47a07763e2506276662c7c1ae6e/config/default.yml#L3212-L3214If we remove that special handling, Rubocop will always enforce using do/end for multiline blocks, but
stree write
will force braces, when called in a method call with arguments but no parentheses, typically in tests in Rails withActiveSupport::Testing::Declarative
:That makes rubocop and stree incompatible for that rule. Once the formatting is fixed to always generate do/end for multiline lambdas, we could add this to
config/rubocop.yml
to make them compatible:The text was updated successfully, but these errors were encountered: