== Why is this an issue?

Property getter, setter and deleter methods are called by the python interpreter with a specific number or arguments:

* only "self" for property getter and deleter methods.
* "self" and a value for setter methods.

Adding any other parameter, or removing these mandatory parameters will make method calls fail.


This rule raises an issue when:

* too many parameters are defined in a property getter, setter or deleter method.
* the value parameter is missing in a property setter method.


=== Noncompliant code example

[source,python]
----
class A:
    @property
    def foo(self, unexpected, unexpected2):  # Noncompliant. Too many parameters.
        return self._foo

    @foo.setter
    def foo(self, value, unexpected):  # Noncompliant. Too many parameters.
        self._foo = value

    @foo.deleter
    def foo(self, unexpected):  # Noncompliant. Too many parameters.
        del self._foo

class B:
    def get_foo(self, unexpected):  # Noncompliant. Too many parameters.
        return self._foo

    def set_foo(self, value, unexpected):  # Noncompliant. Too many parameters.
        self._foo = value

    def del_foo(self, unexpected):  # Noncompliant. Too many parameters.
        del self._foo

    foo = property(get_foo, set_foo, del_foo, "'foo' property.")
----


=== Compliant solution

[source,python]
----
class A:
    @property
    def foo(self):
        return self._foo

    @foo.setter
    def foo(self, value):
        self._foo = value

    @foo.deleter
    def foo(self):
        del self._foo

class B:
    def get_foo(self):
        return self._foo

    def set_foo(self, value):
        self._foo = value

    def del_foo(self):
        del self._foo

    foo = property(get_foo, set_foo, del_foo, "'foo' property.")
----


== Resources

*  https://docs.python.org/3/library/functions.html#property[Python Documentation - Built-in Functions - property]


ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

* Remove XXX parameters; property getter methods receive only "self".
* Remove XXX parameters; property deleter methods receive only "self".
* Remove XXX parameters; property setter methods receive "self" and a value.
* Add the value parameter; property setter methods receive "self" and a value.


=== Highlighting

The method signature.


'''
== Comments And Links
(visible only on this page)

=== on 11 Feb 2020, 18:24:23 Nicolas Harraudeau wrote:
Note that we don't raise any issue for missing "self" parameter because this is already covered by RSPEC-5720.

endif::env-github,rspecator-view[]
