rspec/rules/S3955/rule.adoc

20 lines
567 B
Plaintext
Raw Normal View History

== Why is this an issue?
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
2022-02-04 17:28:24 +01:00
[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
----