You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When switch statements have large sets of case clauses, it is usually an attempt to map two sets of data. A real map structure would be more readable and maintainable
But empty, fall-through cases argue against this interpretation. So at the very least they should be ignored by the count. E.G.:
switch (i) {
case 1: // ignored
case 2: // ignored
case 3: // fallthrough but NOT ignored
DoTheThing();
case 4: // counted as usual
DoTheFinalThing();
break;
case 5:
//...
The text was updated successfully, but these errors were encountered:
valhristov
changed the title
S1479 (switch with too many cases) should ignore empty, fall-through cases
Update S1479: "Switch with too many cases" should ignore empty, fall-through cases
May 31, 2017
Rule S1479
The reasoning behind this rule is
But empty, fall-through cases argue against this interpretation. So at the very least they should be ignored by the count. E.G.:
The text was updated successfully, but these errors were encountered: