org.sonar.plugins.csharp.S3458.html Maven / Gradle / Ivy
Why is this an issue?
Empty case
clauses that fall through to the default are useless. Whether or not such a case
is present, the
default
clause will be invoked. Such case
s simply clutter the code, and should be removed.
Noncompliant code example
switch(ch)
{
case 'a' :
HandleA();
break;
case 'b' :
HandleB();
break;
case 'c' : // Noncompliant
default:
HandleTheRest();
break;
}
Compliant solution
switch(ch)
{
case 'a' :
HandleA();
break;
case 'b' :
HandleB();
break;
default:
HandleTheRest();
break;
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy