rspec/rules/S1226/python/rule.adoc
2021-06-02 20:44:38 +02:00

16 lines
498 B
Plaintext

While it is technically correct to assign to parameters from within function bodies, doing so before the parameter value is read is likely a bug. Instead, initial values of parameters should be, if not treated as read-only, then at least read before reassignment.
== Noncompliant Code Example
----
def foo(strings, param):
param = 1 # NonCompliant
----
ifdef::rspecator-view[]
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::rspecator-view[]