Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.4k
Control flow keywords should begin their line#785
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
The following idioms exist for
For example, Rails framework will show users an error message using this idiom.
https://github.com/rails/rails/blob/v6.0.2.1/actionpack/lib/abstract_controller/rendering.rb#L10 So I think these cases need to be accepted. |
Agreed. I guess we can word this better and provide more examples. |
Hm. I would add a note about its usage in Rails, but I would be hesitant to recommend it in the style guide. It being used in the wild I think should not be seen as an indication that it's good. 😬 I would further argue Will update the PR with the rationale for this rule, as well as notes on the usage of |
Rationale
Breaking control flow is almost certainly the most significant thing that is going on in that line of code, and so it deserves the most prominent spot, at the beginning of the line.
Hiding away control flow in the middle of a long line makes it unnecessarily hard to parse, and Ruby gives us a slew of forms in which we can rewrite the line with the change in flow emphasized.