The indentation around a body without braces suggests other statements belong to it than do

tx0/csharp:misleading-indentationrecommendedwarningreliability/control-flowdepth fastbug

What it finds

Without braces, the body of an if, else or loop is one statement, whatever the indentation says. Two layouts mislead: a body on its own line that is not indented deeper than its statement, which reads as if it always ran, and a statement after the body that is indented like the body, which reads as if it ran only with it. Bodies that are themselves control statements, as in loops stacked at one depth, are left alone. Indentations are compared only when one is a prefix of the other, so that lines indented with tabs and lines indented with spaces, whose depths depend on the editor, are never compared; preprocessor directives between the lines, and for the second layout comment lines, which often hold code taken out, also leave the place alone.

From the rule's source, misleading_indentation.rs.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

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

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