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

30 lines
547 B
Plaintext

[source,ruby,diff-id=1,diff-type=noncompliant]
----
if a >= 0 && a < 10
doFirstThing()
doTheThing()
elsif a >= 10 && a < 20
doTheOtherThing()
elsif a >= 20 && a < 50
doFirstThing()
doTheThing() # Noncompliant; duplicates first condition
else
doTheRest()
end
----
[source,ruby,diff-id=2,diff-type=noncompliant]
----
case i
when 1
doFirstThing()
doSomething()
when 2
doSomethingDifferent()
when 3 # Noncompliant; duplicates case 1's implementation
doFirstThing()
doSomething()
else
doTheRest()
end
----