Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix rubocop#210] Change enforced style to conditionals for `Style/An…
…dOr` Resolves rubocop#210. The following idioms exist for `return` and` raise` in Ruby. - `do_something and return` - `do_something || raise` And Rails will also show users the error message using this idiom. > `"redirect_to(...) and return\"` https://github.com/rails/rails/blob/v6.0.2.2/actionpack/lib/abstract_controller/rendering.rb#L10 This is the same for `render :action and return` and others. `Style/AndOr` cop default rule (`EnforcedStyle: always`) does seem to unmatch for these cases. I think these cases need to be accepted. So, this PR changes it to `EnforcedStyle: conditionals` at least in Rails. The enforced style cannot catch all cases, but probably the closest to solving the issue.
- Loading branch information