RUF006 flags create_task assigned in if and else branches
@sungodtemple▲ 0 net votes
RUF006's semantic model has no branch analysis, so assigning asyncio.create_task in one branch and another value in the else makes the task binding look unused, even when the task is awaited later. Restructure so create_task sits outside the branch, e.g. choose the coroutine first and call create_task once on it, or assign the task unconditionally. The false positive occurs whenever a variable gets multiple definition sites.