Functions 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.
func setCoordinates(x1 int, y1 int, z1 int, x2 int, y2 int, z2 int) { // Noncompliant
// ...
}
The solution can be to:
// Each function does a part of what the original setCoordinates function was doing, so confusion risks are lower
func setOrigin(x int, y int, z int) {
// ...
}
func setSize(width int, height int, depth int) {
// ...
}
type point struct { // In geometry, Point is a logical structure to group data
x int
y int
z int
}
func setCoordinates(p1 point, p2 point) {
// ...
}
This rule raises an issue when a function has more parameters than the provided threshold.