-
-
Notifications
You must be signed in to change notification settings - Fork 263
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
Add new Rails/DefaultScope
cop
#267
Conversation
This was a long time ago, so I'd remove that line. |
# end | ||
# | ||
class DefaultScope < Cop | ||
MSG = 'Avoid using `default_scope`. It is better to use explicitly named scopes.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this can be phrased to indicate that using a named scope is not the only alternative. For example, hidden records could be moved to a separate table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, most of the time the solution is just to name a scope. I'm fine with message, but maybe it is better to just remove the second sentence.
A convention I've come across a number of times is to always put |
d6a941d
to
91406b1
Compare
@Drenmi |
a10c540
to
63faf56
Compare
58bddb0
to
cdfa9fc
Compare
cdfa9fc
to
d02b912
Compare
Thanks! |
Closes #76
Personally, I agree with everything stated in that issue and in numerous blog posts (including referenced in
Reference
), and do not finddefault_scope
as useful, but as a time bomb and a source of bugs to be explored in production.CI does not pass because there was a cop named
DefaultScope
in the past (but which did absolutely different thing, just checkeddefault_scope
style - lambda vs block).https://github.com/rubocop-hq/rubocop/blob/423323cc7f5af33cd2123bfcadb8eec4da4e0d5e/lib/rubocop/config_obsoletion.rb#L66
So should that line be removed, or this cop renamed, or something else?