rspec/rules/S1151/rule.adoc

44 lines
595 B
Plaintext
Raw Normal View History

== Why is this an issue?
2020-06-30 12:47:33 +02:00
include::description.adoc[]
=== Noncompliant code example
With the default threshold of 5:
[source,text]
----
switch (myVariable) {
case 0: // Noncompliant: 6 lines till next case
methodCall1("");
methodCall2("");
methodCall3("");
methodCall4("");
break;
case 1:
...
}
----
=== Compliant solution
[source,text]
----
switch (myVariable) {
case 0:
doSomething()
break;
case 1:
...
}
...
private void doSomething(){
methodCall1("");
methodCall2("");
methodCall3("");
methodCall4("");
}
----
2020-06-30 12:47:33 +02:00