A switch statement has no default section

tx0/csharp:switch-without-defaultallwarningstyle/conventionsdepth faststyle

What it finds

A switch without default silently does nothing for values nobody thought of, such as an enum member added later. A default that throws or states that nothing is to be done makes the decision visible.

From the rule's source, switch_without_default.rs.

Example from the rule's tests
class Days{    string Name(int day)    {        switch (day)tx0 reports: this switch has no default section        {            case 0:                return "Sunday";            case 1:                return "Monday";        }        switch (day)        {            case 0:                return "zero";            default:                return "other";        }    }}
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 all tier up. To turn it on in a lower tier, give it a level in tx0.toml:

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

tx0 explain tx0/csharp:switch-without-default shows the same in the terminal. Found a false positive? Report it.