
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
66 lines
1.4 KiB
Plaintext
66 lines
1.4 KiB
Plaintext
== Why is this an issue?
|
|
|
|
You're allowed to make function calls with positionally-identified parameters or with named parameters. In long parameter lists, explicitly naming your parameters both eliminates the risk of swapping parameter values and makes the call clearer to maintainers.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
With the default threshold of 3:
|
|
|
|
[source,python]
|
|
----
|
|
def coordinateSurpriseParty(self, hostName, guestOfHonor, caterer, invitees, peopleNotToInvite):
|
|
# ...
|
|
|
|
host="John"
|
|
guestOfHonor="Fred"
|
|
caterer="Barry"
|
|
invitees="Thea, Will, Mark, Mary"
|
|
peopleToExclude="Susan, Alberta, Frank, Larry"
|
|
|
|
coordinateSurpriseParty(caterer, host, guestOfHonor, peopleToExclude, invitees) # Noncompliant; this party will be a train wreck!
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,python]
|
|
----
|
|
def coordinateSurpriseParty(self, hostName, guestOfHonor, caterer, invitees, peopleNotToInvite):
|
|
# ...
|
|
|
|
host="John"
|
|
guestOfHonor="Fred"
|
|
caterer="Barry"
|
|
invitees="Thea, Will, Mark, Mary"
|
|
peopleToExclude="Susan, Alberta, Frank, Larry"
|
|
|
|
coordinateSurpriseParty(caterer=caterer, hostName=host, geustOfHonor=guestOfHonor, peopleNotToInvite=peopleToExclude, invitees=invitees)
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Specify the argument names for these n unnamed parameters
|
|
|
|
|
|
=== Parameters
|
|
|
|
.threshold
|
|
****
|
|
|
|
----
|
|
3
|
|
----
|
|
|
|
Maximum number of unnamed arguments
|
|
****
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|