33 lines
567 B
Plaintext
33 lines
567 B
Plaintext
[source,scala,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
if (a >= 0 && a < 10) {
|
|
doFirstThing
|
|
doTheThing
|
|
}
|
|
else if (a >= 10 && a < 20) {
|
|
doTheOtherThing
|
|
}
|
|
else if (a >= 20 && a < 50) {
|
|
doFirstThing
|
|
doTheThing // Noncompliant; duplicates first condition
|
|
}
|
|
else {
|
|
doTheRest
|
|
}
|
|
----
|
|
|
|
[source,scala,diff-id=2,diff-type=noncompliant]
|
|
----
|
|
value match {
|
|
case 1 =>
|
|
doFirstThing
|
|
doSomething
|
|
case 2 =>
|
|
doSomethingDifferent
|
|
case 3 => // Noncompliant; duplicates case 1's implementation
|
|
doFirstThing
|
|
doSomething
|
|
case _ =>
|
|
doTheRest
|
|
}
|
|
---- |