-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix warning on using Channel.select #8454
Conversation
should there be a test for this? |
If deprecated code is not tested it is not guaranteed to stay working. I prefer a CI with warnings rather than untested deprecated methods. But If I'm the only one who thinks that way, we can go ahead. |
Oh, I didn't know that was the reason it was kept. |
Maybe we could consider adding comments for such specs that are explicitly meant to test deprecated behaviour. Otherwise I expect we will eventually get more "fix warning" PRs in the future. |
I'll award bonus points for having a mechanism for designating a spec as testing a specific deprecated method and disabling deprecation warnings for this method inside the spec's body. |
Definitely. But is either be
So, something like this? pragma(allow_deprecated: true) { expr } |
I don't think this is worth our efforts. After all it's just a warning. |
I agree. It was just an idea that popped into my head but should be filed under "in case you're bored and have nothing else to do". |
I don't know why I kept thinking about this. But it bugged me. And I think this could actually be very simple to implement. Because this really only affects specs and deprecated methods should only be called directly in the spec body, a naive static filter should be enough. require "spec"
@[Deprecated]
def deprecated
end
it "test deprecated method" do
deprecated
end This is the warning:
Obviously this won't work if the deprecated method is called indirectly. But that should be avoided anyway because it would mean the deprecated method is used in some code other than specs. |
The warnings are reported during compilation, not at runtime. I don't know if you took that into account. |
Yes. Runtime doesn't matter. The |
The warnings code already has a check for which directories to ignore warnings in ( |
This off-topic discussion should be continued in #8477 |
#8409 (comment)