Asyncio Coroutine False Positive

With this code:

from typing import Coroutine
import asyncio

async def foo(func: Coroutine):
    await asyncio.gather(
            func()
    )

I get the following false positive warning from sonarlint:

Fix this call; Previous type checks suggest that “func” has type Coroutine and it is not callable.sonarlint(python:S5864)

This is usually correct but we need to add a special case to silence the warning when a Coroutine is called inside an asyncio.gather call.

Hello @amin-nejad,

First, welcome to this community and sorry for the late answer.
This is indeed a false positive for S5864, thank you for reporting it. I’ve create this ticket to track it.

Cheers,
Guillaume