Class has too many parameters
objectscriptQuality release
Id
OS0073
Rule type
Code Smell
Severity
Major
Major
SQALE characteristic
- Changeability
- Logic
Remediation function
Constant/issue
Remediation cost
1d
A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the class is doing too many things.
Noncompliant Code Example
The following code snippet illustrates this rule with a maximum number of 10 parameters:
Class Sample.Foobar { Parameter A = "a"; Parameter B = "b"; Parameter C = "c"; Parameter D = "d"; Parameter E = "e"; Parameter F = "f"; Parameter G = "g"; Parameter H = "h"; Parameter I = "i"; Parameter J = "j"; Parameter K = "k"; }
Compliant Solution
Class Sample.Foobar { Parameter A = "a"; Parameter B = "b"; Parameter C = "c"; Parameter D = "d"; Parameter E = "e"; Parameter F = "f"; Parameter G = "g"; Parameter H = "h"; Parameter I = "i"; Parameter J = "j"; }
Parameters
Name | Description | Default value |
---|---|---|
nrParametersThreshold
| Maximum allowed number of parameters (inclusive)
| 10
|