18 lines
538 B
Plaintext
18 lines
538 B
Plaintext
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.
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
[source,text]
|
|
----
|
|
if(foo); //Noncompliant, the semi-colon must be removed
|
|
trigger(action1); // executes unconditionally
|
|
else if (bar); //Noncompliant, the semi-colon must be removed
|
|
trigger(action2); // executes unconditionally
|
|
|
|
while (condition); // Noncompliant
|
|
doTheThing(); // executes once, unconditionally
|
|
----
|
|
|
|
|