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
Warn when redefining a filter #310
Conversation
I am open to better wording. As is, it gives you enough information to figure out what's going on. But we may want to include more, like filter types. |
The build failed because RuboCop thinks |
Is there any case where you might intentionally redefine a filter? I can't really think of one. Maybe on some kind of conditional filter import? Should we just raise an error instead? Also, I don't think it needs to be so excited (i.e. we can drop the "!"). |
I can get behind raising an error instead of a warning. But that would be a major change to our API, right? And if we did raise an error, would we want to allow users to ignore it? There has never been an instance where I wanted to redefine a filter. I do sometimes want to modify them, but I use |
Maybe it's best that we just warn. There might be some situation we're not considering where it makes sense. BTW, the code looks 👍 |
@tfausak What if I have something like this
and another class that will inherit from
I got a warning |
I think you can use class ChildClass < Base
silence_warnings do
object :address, default: nil
end
end But I haven't written Ruby in a while, so I'm not sure. |
Thanks @tfausak, It worked |
This pull request makes it so that you get a warning when you redefine a filter. Issue #308 brought the need for this to my attention.
Here is an example of the warning: