Open andyw8 opened 2 years ago
It's a controversial topic. https://github.com/rubocop/ruby-style-guide/pull/730 has been recently merged. Also related https://github.com/rubocop/ruby-style-guide/pull/785
While .. and ..
is now permitted by the default RuboCop settings, the main problem I see with the render ... and return
pattern is that it incorrectly suggests we should not return if the render
part somehow fails.
Should we recommend return render …
?
I think it's better for the return
to be a separate statement. Returning a value would suggest that it's used for something.
Previously this pattern was used in the Rails docs examples but is now discouraged:
https://github.com/rails/rails/pull/45927/files