rspec/rules/S1871/csharp/noncompliant.adoc
2023-10-24 12:02:02 +00:00

37 lines
587 B
Plaintext

[source,csharp,diff-id=1,diff-type=noncompliant]
----
if (a >= 0 && a < 10)
{
DoFirst();
DoTheThing();
}
else if (a >= 10 && a < 20)
{
DoTheOtherThing();
}
else if (a >= 20 && a < 50) // Noncompliant; duplicates first condition
{
DoFirst();
DoTheThing();
}
----
[source,csharp,diff-id=2,diff-type=noncompliant]
----
switch (i)
{
case 1:
DoFirst();
DoSomething();
break;
case 2:
DoSomethingDifferent();
break;
case 3: // Noncompliant; duplicates case 1's implementation
DoFirst();
DoSomething();
break;
default:
DoTheRest();
}
----