Skip to content
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

RUF006 not emitted for low-level loop.create_task #3237

Closed
layday opened this issue Feb 26, 2023 · 1 comment · Fixed by #7562
Closed

RUF006 not emitted for low-level loop.create_task #3237

layday opened this issue Feb 26, 2023 · 1 comment · Fixed by #7562
Assignees
Labels
bug Something isn't working type-inference Requires more advanced type inference.

Comments

@layday
Copy link

layday commented Feb 26, 2023

AFAIK, the same pitfall applies to the lower level loop.create_task:

import asyncio


async def foo():
    asyncio.create_task(bar())  # Warning here
    loop = asyncio.get_running_loop()
    loop.create_task(bar())  # No warning here

async def bar():
    pass

It would be great if ruff could support this too in some way.

Ruff version: 0.0.252

@charliermarsh charliermarsh added the bug Something isn't working label Feb 26, 2023
@charliermarsh
Copy link
Member

This requires more static analysis than we're currently capable of doing, but I'd like to support these kinds of checks so I'm leaving this open.

@charliermarsh charliermarsh added the type-inference Requires more advanced type inference. label Feb 27, 2023
@charliermarsh charliermarsh self-assigned this Sep 21, 2023
charliermarsh added a commit that referenced this issue Sep 21, 2023
## Summary

We can do a good enough job detecting this with our existing semantic
model.

Closes #3237.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working type-inference Requires more advanced type inference.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants