Skip to content

Gendarme.Rules.Smells.AvoidLongParameterListsRule(2.10)

Sebastien Pouliot edited this page Jan 15, 2011 · 2 revisions

AvoidLongParameterListsRule

Assembly: Gendarme.Rules.Smells
Version: 2.10

Description

This rule allows developers to measure the parameter list size in a method. If you have methods with a lot of parameters, perhaps you have a Long Parameter List smell. This rule counts the method's parameters, and compares it against a maximum value. If you have an overloaded method, then the rule will get the shortest overload and compare the shortest overload against the maximum value. Other time, it's quite hard determine a long parameter list. By default, a method with 6 or more arguments will be flagged as a defect.

Examples

Bad example:

public void MethodWithLongParameterList (int x, char c, object obj, bool j, string f,
float z, double u, short s, int v, string[] array)
{
    // Method body ...
}

Good example:

public void MethodWithoutLongParameterList (int x, object obj)
{
    // Method body....
}

Feedback

Note that this page was autogenerated (1/15/2011 12:27:17 PM) based on the xmldoc comments inside the rules source code and cannot be edited from this wiki. Please report any documentation errors, typos or suggestions to the Gendarme Google Group. Thanks!

Clone this wiki locally