.. _NoRedundantArgumentsSuperRule:

=============================
NoRedundantArgumentsSuperRule
=============================

Remove redundant arguments when using super for readability.

-------
Message
-------
Do not use arguments when calling super for the parent class. See https://www.python.org/dev/peps/pep-3135/

----------------
Has Autofix: Yes
----------------

-------------------
VALID Code Examples
-------------------

# 1:







.. code-block:: python


    class Foo(Bar):
        def foo(self, bar):
            super().foo(bar)





# 2:







.. code-block:: python


    class Foo(Bar):
        def foo(self, bar):
            super(Bar, self).foo(bar)





# 3:







.. code-block:: python


    class Foo(Bar):
        @classmethod
        def foo(cls, bar):
            super(Bar, cls).foo(bar)





.. container:: toggle


    # 4:







    .. code-block:: python


        class Foo:
            class InnerBar(Bar):
                def foo(self, bar):
                    pass

            class InnerFoo(InnerBar):
                def foo(self, bar):
                    super(InnerBar, self).foo(bar)






---------------------
INVALID Code Examples
---------------------

# 1:







.. code-block:: python


    class Foo(Bar):
        def foo(self, bar):
            super(Foo, self).foo(bar)





Autofix:

.. code-block:: python

    --- 
    +++ 
    @@ -1,4 +1,4 @@
 
     class Foo(Bar):
         def foo(self, bar):
    -        super(Foo, self).foo(bar)
    +        super().foo(bar)

# 2:







.. code-block:: python


    class Foo(Bar):
        @classmethod
        def foo(cls, bar):
            super(Foo, cls).foo(bar)





Autofix:

.. code-block:: python

    --- 
    +++ 
    @@ -2,4 +2,4 @@
     class Foo(Bar):
         @classmethod
         def foo(cls, bar):
    -        super(Foo, cls).foo(bar)
    +        super().foo(bar)

# 3:







.. code-block:: python


    class Foo:
        class InnerFoo(Bar):
            def foo(self, bar):
                super(Foo.InnerFoo, self).foo(bar)





Autofix:

.. code-block:: python

    --- 
    +++ 
    @@ -2,4 +2,4 @@
     class Foo:
         class InnerFoo(Bar):
             def foo(self, bar):
    -            super(Foo.InnerFoo, self).foo(bar)
    +            super().foo(bar)

.. container:: toggle


    # 4:







    .. code-block:: python


        class Foo:
            class InnerFoo(Bar):
                class InnerInnerFoo(Bar):
                    def foo(self, bar):
                        super(Foo.InnerFoo.InnerInnerFoo, self).foo(bar)





    Autofix:

    .. code-block:: python

        --- 
        +++ 
        @@ -3,4 +3,4 @@
             class InnerFoo(Bar):
                 class InnerInnerFoo(Bar):
                     def foo(self, bar):
        -                super(Foo.InnerFoo.InnerInnerFoo, self).foo(bar)
        +                super().foo(bar)

