A public method returns a value through an out parameter

tx0/csharp:out-parameterstrictwarningmaintainability/designdepth fastsmell

What it finds

out parameters make a method harder to call and to compose: the caller has to declare a variable first, and the call cannot be used in an expression. A tuple or a small result type returns several values directly. The Try... pattern and Deconstruct methods are the accepted uses, and are left alone, as are overrides and extern methods.

From the rule's source, out_parameter.rs.

Example from the rule's tests
public class Geometry{    public void Split(string text, out string head)tx0 reports: Split returns head through an out parameter    {        head = text;    }     public bool TryParse(string text, out int value)    {        value = 0;        return true;    }}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

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:

tx0.toml
[rules]
"tx0/csharp:out-parameter" = "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/csharp:out-parameter] reason="..."

tx0 explain tx0/csharp:out-parameter shows the same in the terminal. Found a false positive? Report it.