Open Horrih opened 7 months ago
Hi @Horrih, thank you for the issue. What do you think about it @jhertout ?
Hi @Horrih, I try to reproduce the problem but without success.
Here is my tests.
using strictly your example => NO PROBLEM on local Unit test
from collections.abc import Sequence from typing import TypeVar
U = TypeVar('U')
def second(l: Sequence[U]) -> U: return l[1]`
with a new line added => there is a real problem as expected at the line with "#noncompliant"
from collections.abc import Sequence from typing import TypeVar
U = TypeVar('U')
def second(l: Sequence[U]) -> U: print(U) #Noncompliant return l[1]
Do you still have the problem ? Can you give me a screenshot of the problem, please ? Can you give me the version of SonarQube and the version of your installed python plugin, please ?
Describe the bug When using python's TypeVar mechanism for type annotations, EC4 code smell is triggered. This should not be considered a code smell since using it in global scope is the standard way.
To Reproduce Example straight from the python official documentation
Expected behavior Do not flag this as an error