Functions, methods, or lambdas with a long parameter list are difficult to use, as maintainers must figure out the role of each parameter and keep track of their position.
=== on 15 May 2019, 12:21:20 Marcel Vingerling wrote:
In my opinion this rule should ignore mandatory named arguments that have been separated in the function definition by a {color:#FF0000}``++*++``{color} in the argument list.
In this case the {{*}} marker in the function definition dictates that the param5 parameter should always be passed as a named argument. Therefore the maximum number of positional parameters for this function is 4 and should be compliant as named parameters self document the method call and cause less brain-overload.
This should be compliant because the function can only be called like this:
----
do_something(1, 2, 3, 4, param5=5){code}
This could either be implemented in this rule or added as an additional rule, then the maximum total number of parameters can also still be validated. Maybe it makes sense to also limit the maximum number ofmandatory named arguments using a rule configuration setting.
=== on 9 Mar 2020, 13:55:53 Nicolas Harraudeau wrote:
Hi [~sjaak],
Thank you for your suggestion, and sorry for the late reply. Could you post it on https://community.sonarsource.com/c/bug/fp/7[the community forum] please? This will enable other people to contribute to this discussion more easily.