tuple-element-names-in-signatures
What it does
Section titled “What it does”Reports a tuple type in the signature of a method, constructor, property, indexer, conversion operator or delegate whose elements have no names. Overrides and implementations of interface members are not reported, since their names are not the member’s to choose. No fix.
Why it matters
Section titled “Why it matters”A caller sees (int, int) in the signature and Item1 and Item2 in the result, so it has to read the body to know which is which. Names ((int Width, int Height)) make the signature the documentation.
To fix, name the elements.
Example
Section titled “Example”...namespace A.B {... struct S { } interface I { (int, int) Pair(); } class P { public virtual void Run() { } } class Q : P, I { public (int, int) Pair() => (1, 2); public (int, int) Other() => (1, 2);......namespace A.B {... struct S { } interface I { (int, int) Pair(); } class P { public virtual void Run() { } } class Q : P, I { public (int, int) Pair() => (1, 2); public (int, int) Other() => (1, 2);...Configuration
Section titled “Configuration”csharp: lint: rules: tuple-element-names-in-signatures: warn # off (default), warn, errorEnabled by the presets: csharp/stylecop.
Suppress one line with sudsy-disable-next-line tuple-element-names-in-signatures in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| StyleCop | SA1414 |
full |