A local variable has the name of a variable or parameter of an enclosing scope in the same function

tx0/cpp:shadowed-variablestrictwarningstyle/namingdepth fastsmell

What it finds

int i; ... for (...) { int i; ... }: the inner variable hides the outer one, and code in the inner block that was meant to use the outer one silently uses the new one.

From the rule's source, shadowed_variable.rs.

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/cpp:shadowed-variable" = "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/cpp:shadowed-variable] reason="..."

tx0 explain tx0/cpp:shadowed-variable shows the same in the terminal. Found a false positive? Report it.