Adjacent parameters of the same type each repeat the type instead of sharing it
What it finds
func move(x int, y int): Go lets adjacent parameters share their type, as in func move(x, y int), which is shorter and shows at a glance which parameters belong together.
Two adjacent named parameters, or results, are reported when their types consist of the same tokens and the first has one name. The fix removes the type of the first parameter and is safe, since the signature stays the same.
From the rule's source, ungrouped_parameters.rs.
package p func move(x int, y int) {}tx0 reports: this parameter can share the type int with the next one func scale(x, y int, f float64) {} func pair() (a string, b string) { return }tx0 reports: this parameter can share the type string with the next one Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/go:ungrouped-parameters" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/go:ungrouped-parameters] reason="..."tx0 explain tx0/go:ungrouped-parameters shows the same in the terminal. Found a false positive? Report it.