Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.
Noncompliant Code Example
def do_something(a, b): # "b" is unused
return compute(a)
Compliant Solution
def do_something(a):
return compute(a)
Exceptions
Overriding methods are ignored.
class C(B):
def do_something(self, a, b): # no issue reported on b
return self.compute(a)
}
Throwaway variables _
.
def do_something(a, _): # no issue reported on _
return compute(a)