A statement is indented as if it belonged to the body of an if or loop without braces, but runs after it
What it finds
Without braces, only the first statement after if (...) or a loop head is its body. A second statement indented the same way looks like part of the body but runs unconditionally, the mistake behind several well-known security bugs.
Reported are statements that follow a braceless body written on its own line and start in the same column as that body.
From the rule's source, misleading_indentation.rs.
export function check(ok: boolean, log: (s: string) => void) { if (!ok) log("failed"); log("done");tx0 reports: this statement is indented like the body above} Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/ts:misleading-indentation" = "off"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/ts:misleading-indentation] reason="..."tx0 explain tx0/ts:misleading-indentation shows the same in the terminal. Found a false positive? Report it.