VHDL317: A function or procedure should not have too many parameters
Summary
| Reliability | Security | Maintainability | Code attribute | Effort to fix | Tags |
|---|---|---|---|---|---|
| - | - | MEDIUM | Adaptability | Focused | 20min | synthesis, vscode, linter, simulation |
Description
Noncompliant code example
With default maximum number of parameters: 3
function too_many_responsibilities (length, width, height, color: integer) return integer;
Compliant solution
With default maximum number of parameters: 3
function single_responsibility (length, width, height: integer) return integer;
A function or procedure should have a single and well-defined responsibility. Such a function is easier to understand, change, maintain, test and reuse. Too many parameters is an indication that the function/procedure has too many responsibilities.
Articles & blog posts
Parameters
| Parameter | Value | Description |
|---|---|---|
| max | 3 | The maximum allowed number of parameters. |