rspec/rules/S1172/python/rule.adoc

56 lines
878 B
Plaintext

Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.
== Noncompliant Code Example
[source,python]
----
def do_something(a, b): # "b" is unused
return compute(a)
----
== Compliant Solution
[source,python]
----
def do_something(a):
return compute(a)
----
== Exceptions
Overriding methods are ignored.
[source,python]
----
class C(B):
def do_something(self, a, b): # no issue reported on b
return self.compute(a)
}
----
Throwaway variables `_`.
[source,python]
----
def do_something(a, _): # no issue reported on _
return compute(a)
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]