2023-05-03 11:06:20 +02:00
|
|
|
== Why is this an issue?
|
|
|
|
|
2020-06-30 12:47:33 +02:00
|
|
|
include::description.adoc[]
|
|
|
|
|
2023-05-25 14:18:12 +02:00
|
|
|
=== Noncompliant code example
|
2020-06-30 12:47:33 +02:00
|
|
|
|
2023-05-25 14:18:12 +02:00
|
|
|
[source,text]
|
|
|
|
----
|
|
|
|
if(condition)
|
|
|
|
{
|
|
|
|
doSomething();
|
|
|
|
}
|
|
|
|
----
|
|
|
|
|
|
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
|
|
|
|
[source,text]
|
|
|
|
----
|
|
|
|
if(condition) {
|
|
|
|
doSomething();
|
|
|
|
}
|
|
|
|
----
|
|
|
|
|
|
|
|
|
|
|
|
=== Exceptions
|
|
|
|
|
|
|
|
When blocks are inlined (left and right curly braces on the same line), no issue is triggered.
|
|
|
|
|
|
|
|
|
|
|
|
[source,text]
|
|
|
|
----
|
|
|
|
if(condition) {doSomething();}
|
|
|
|
----
|
2020-06-30 12:47:33 +02:00
|
|
|
|