-
-
Notifications
You must be signed in to change notification settings - Fork 3.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
Add warning for IO.select
with single argument.
#9061
Labels
Comments
Here is an example PR: redis/redis-rb#960 |
koic
added a commit
to koic/rubocop
that referenced
this issue
Sep 11, 2021
…er` cop Fixes rubocop#9061. This PR adds new `Lint/IncompatibleIoSelectWithFiberScheduler` cop. It checks for `IO.select` that is incompatible with Fiber Scheduler since Ruby 3.0. ```ruby # bad IO.select([io], [], [], timeout) # good io.wait_readable(timeout) # bad IO.select([], [io], [], timeout) # good io.wait_writable(timeout) ``` Ref: `Fiber Scheduler` section of https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/ This PR will make it possible to detect proven cases with redis/redis-rb#960.
8 tasks
bbatsov
pushed a commit
that referenced
this issue
Sep 12, 2021
Fixes #9061. This PR adds new `Lint/IncompatibleIoSelectWithFiberScheduler` cop. It checks for `IO.select` that is incompatible with Fiber Scheduler since Ruby 3.0. ```ruby # bad IO.select([io], [], [], timeout) # good io.wait_readable(timeout) # bad IO.select([], [io], [], timeout) # good io.wait_writable(timeout) ``` Ref: `Fiber Scheduler` section of https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/ This PR will make it possible to detect proven cases with redis/redis-rb#960.
This is amazing thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe this is a crazy idea, but it would be awesome if we could automatically rewrite the following:
And finally, every other usage of
IO.select
becomes warning/error.Because it is very hard to make it compatible with Ruby 3 scheduler.
It could be disabled by default if it's too inconvenient.
The text was updated successfully, but these errors were encountered: