2023-05-03 11:06:20 +02:00
== Why is this an issue?
2021-06-08 14:23:48 +02:00
There is no point in creating a branch in the code only to execute an empty statement. Such code can only be due to the presence of an unexpected trailing semi-colon.
2023-05-03 11:06:20 +02:00
=== Noncompliant code example
2021-06-08 14:23:48 +02:00
2022-02-04 17:28:24 +01:00
[source,text]
2021-06-08 14:23:48 +02:00
----
2024-05-31 17:08:01 +02:00
if(foo); // Noncompliant, the semi-colon must be removed
2021-06-08 14:23:48 +02:00
trigger(action1); // executes unconditionally
2024-05-31 17:08:01 +02:00
else if (bar); // Noncompliant, the semi-colon must be removed
2021-06-08 14:23:48 +02:00
trigger(action2); // executes unconditionally
while (condition); // Noncompliant
doTheThing(); // executes once, unconditionally
----