- Operating system: macOS 12.4
- IDE name and flavor/env: PyCharm 2022.3.1 RC, Python 3.11.0
from typing import Generator
from typing import TypeAlias
StepGenerator: TypeAlias = Generator[str, None, None]
Foo: TypeAlias = str
def ordered_steps() -> StepGenerator:
for i in range(10):
def main() -> None:
if __name__ == '__main__':
SonarLint falsely reports line 10 as
Remove this yield statement or annotate function “ordered_steps” with “typing.Generator” or one of its supertypes.
Thanks for reporting this false-positive!
Since all the necessary information has been included, we’ve flagged this for attention by an expert. This means that somebody will look at your report, maybe ask some follow-up questions, and try and determine if it’s really a false-positive that should be fixed.
This review could be done hours, days, or even weeks from now. If it takes a while – it doesn’t mean your report isn’t important to us, it just means that our teams are already hard-at-work developing new language analysis features, and your report is in the queue.
If you’re using SonarQube or SonarCloud – an issue administrator can always mark an issue as a false-positive in the UI (this also suppresses it in SonarLint when using Connected Mode). The rule can also be disabled in your Quality Profile if it’s particularly noisy.
Hi @Pavel_Karateev ,
Sorry for the late reply and thanks a lot for reporting this false positive.
I created the following ticket to keep track of this problem SONARPY-1252.