Uploaded image for project: 'SonarPython'
  1. SonarPython
  2. SONARPY-581

FP on S3827: Set comprehension variable inside f-string

    XMLWordPrintable

    Details

    • Type: False-Positive
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5
    • Component/s: None
    • Labels:
      None

      Description

      S3827 is reporting a false positive for variables created in set comprehension inside f-strings.

      f"{ {x for x in []} }" # FP : x is not defined
      

      Related community thread: https://community.sonarsource.com/t/variable-defined-in-python-set-comprehension-is-incorrectly-reported-as-undefined/19784

        Attachments

          Activity

            People

            Assignee:
            elena.vilchik Elena Vilchik
            Reporter:
            andrea.guarino Andrea Guarino
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved: