mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-03 07:04:53 +00:00
![]() This rule guards against `asyncio.create_task` usages of the form: ```py asyncio.create_task(coordinator.ws_connect()) # Error ``` ...which can lead to unexpected bugs due to the lack of a strong reference to the created task. See Will McGugan's blog post for reference: https://textual.textualize.io/blog/2023/02/11/the-heisenbug-lurking-in-your-async-code/. Note that we can't detect issues like: ```py def f(): # Stored as `task`, but never used... task = asyncio.create_task(coordinator.ws_connect()) ``` So that would be a false negative. But this catches the common case of failing to assign the task in any way. Closes #2809. |
||
---|---|---|
.. | ||
flake8_to_ruff | ||
ruff | ||
ruff_cli | ||
ruff_dev | ||
ruff_formatter | ||
ruff_macros | ||
ruff_python | ||
ruff_python_formatter | ||
ruff_text_size |