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

Rule S5720: "self" should be the first argument to instance methods

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.8
    • Component/s: Rules
    • Labels:

      Description

      Note that a before decorators existed, the only way to create a class method was:

      class MyClass:
          def old_style_class_method(cls):
              print("old_style_class_method")
          old_style_class_method = classmethod(old_style_class_method)
      

      classmethod is used after the method is defined to replace it with a decorated version.

      We shouldn't raise any issue when the method is used as an argument to classmethod.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              gyula.sallai Gyula Sallai
              Reporter:
              nicolas.harraudeau Nicolas Harraudeau (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: