One declaration introduces several fields or local variables
What it finds
int width, height; declares two variables in one statement. Separate declarations are easier to read, to comment and to change one at a time. The header of a for loop is left alone.
From the rule's source, several_declarators.rs.
class Size{ private int width, height;tx0 reports: this declaration declares several variables void Run() { for (int i = 0, j = 1; i < j; i++) { } }} Turn it on, off or suppress it
The rule runs from the all tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/csharp:several-declarators" = "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:several-declarators] reason="..."tx0 explain tx0/csharp:several-declarators shows the same in the terminal. Found a false positive? Report it.