-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cop idea: prefer symbol proc to if:
and unless:
filter lambdas
#335
Comments
I think this can be proposed to the style guide first. If accepted by the style guide, it could be implemented in RuobCop Rails. So, I'll transfer this issue to the style guide repo. |
A PR is welcome! Related: https://guides.rubyonrails.org/active_record_callbacks.html#conditional-callbacks I would be interested in how it's used in the wild, say, real-world-rails repo. With a single predicate - fine, but what is your take on multiple ones, e.g. |
Model hooks and controller filters that receive
if:
andunless:
lambdas can be written more succinctly using symbols if the lambda consists of a single method call. This cop would enforce either style consistently based on configuration.The text was updated successfully, but these errors were encountered: