rspec/rules/S3923/javascript/code-example.adoc
Fred Tingaud 1d958ef229
Modify rule S3923: LaYC identical branches
Co-authored-by: Amélie Renard <44666826+amelie-renard-sonarsource@users.noreply.github.com>
2023-06-08 17:06:21 +02:00

26 lines
358 B
Plaintext

[source,javascript]
----
if (b == 0) { // Noncompliant
doOneMoreThing();
}
else {
doOneMoreThing();
}
let a = (b == 0) ? getValue() : getValue(); // Noncompliant
switch (i) { // Noncompliant
case 1:
doSomething();
break;
case 2:
doSomething();
break;
case 3:
doSomething();
break;
default:
doSomething();
}
----