
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
44 lines
595 B
Plaintext
44 lines
595 B
Plaintext
== Why is this an issue?
|
|
|
|
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("");
|
|
}
|
|
----
|
|
|