2020-06-30 12:50:28 +02:00
|
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
|
|
|
|
With a maximum number of 4 parameters:
|
2020-06-30 14:49:38 +02:00
|
|
|
|
2020-06-30 12:50:28 +02:00
|
|
|
----
|
|
|
|
def do_something(param1, param2, param3, param4, param5): # Noncompliant
|
|
|
|
...
|
|
|
|
----
|
|
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
|
|
|
|
----
|
|
|
|
def do_something(param1, param2, param3, param4):
|
|
|
|
...
|
|
|
|
|
|
|
|
# Or
|
|
|
|
|
|
|
|
def do_something(param1, param2, param3, param4, param5="a default value"):
|
|
|
|
...
|
|
|
|
----
|
|
|
|
|
|
|
|
== Exceptions
|
|
|
|
|
2021-01-27 13:42:22 +01:00
|
|
|
The first argument of non-static methods, i.e. ``++self++`` or ``++cls++``, is not counted as it is mandatory and it is passed automatically.
|