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

RSPEC-1481 (UnusedLocalVars) should not raise on vars used inside f-strings containing conditional expressions

    XMLWordPrintable

    Details

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

      Description

      def f_string_conditional_expr(p):
          x = 42 # FP here
          f"<tr {x if p != 0 else 0}>"
      

        Attachments

          Activity

            People

            Assignee:
            guillaume.dequenne Guillaume Dequenne
            Reporter:
            andrea.guarino Andrea Guarino
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved: