rspec/rules/S1151/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
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.
2023-05-25 14:18:12 +02:00

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("");
}
----