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

FP on S5720 when using the method as a decorator

    Details

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

      Description

      Rule RSPEC-5720 shouldn't raise an issue when the method is used as a decorator inside the class. It should count as a "reference to the method" for which we already do an exception.

      class MethodReferencedInBody:
          def used_as_decorator(method):  # False Positive. Used as a decorator
              return method
      
          @used_as_decorator
          def decorated(self):
              """"""
              pass
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                andrea.guarino Andrea Guarino
                Reporter:
                nicolas.harraudeau Nicolas Harraudeau
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: