Variable defined in Python set comprehension is incorrectly reported as undefined

Using SonarCloud, a line similar to this:

f"       count={len({m.foo.bar.id for m in self.data})}\n"

is incorrectly reported as L329, m is not defined.

Hi @shields-fn,
Thank you for reporting this false positive.
I created https://jira.sonarsource.com/browse/SONARPY-581 to keep track of it.
We plan to have a fix for it in the next release of our Python analyzer (v2.5).

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.