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
# when method name and first argument are not on same line
create(
:user
)
build(
:user,
name: 'foo'
)
It would be nice to have an option that allows backslashes even when enforcing parentheses on single-line calls. For example, the following should both be allowed:
Can you please elaborate?
Do you mean that the cop in omit_parentheses mode should add a backslash in its autocorrection instead of just raising an offence and skipping autocorrection?
would any other cop suggest fixing the layout after that?
See Style/MethodCallWithArgsParentheses which is a broader cop around the use of parens and backslashes. See AllowParenthesesInMultilineCall option, which allows granular control over multiline argument lists. Following the example of the broader cop, it might be best to add another option called MultilineStyle and allow values like [parentheses backslashes either]. Then if the MethodCallWithArgsParentheses cop was enabled at all, this would default to either. I'm sure there are other ways of doing this as well, including splitting this cop into two cops: one for single lines and one for multiline. The autocorrector would then know exactly what to do.
ydah
transferred this issue from rubocop/rubocop-rspec
May 6, 2023
Currently from the docs:
It would be nice to have an option that allows backslashes even when enforcing parentheses on single-line calls. For example, the following should both be allowed:
The text was updated successfully, but these errors were encountered: