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

FP on S1226 and S1481 when the parameter is used in a raw f-string

    Details

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

      Description

      SonarPython raises an issue on the following code for RSPEC-1226 (Method parameters, caught exceptions and foreach variables' initial values should not be ignored) and RSPEC-1481 (Unused local variables should be removed):

      def foo(param):  # False Positive
          param = rf'{param}'
      

      There is no issue when the string is a non-raw f-string

      def foo(param):
          param = f'{param}'
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pierre-yves.nicolas Pierre-Yves Nicolas
                Reporter:
                nicolas.harraudeau Nicolas Harraudeau
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: