Skip to content
Arthur van de Vondervoort edited this page Sep 21, 2024 · 5 revisions

Empty statements should be avoided or should have a leading or trailing comment explaining their use.

This rule detects and flags empty statement expressions (excess semicolons) for improved readability and cleaner code.

Example

local procedure Example(SomeVar: Boolean)
begin
    if SomeVar then begin
        ; <<-- this excess semicolon should be removed
        Message('hello');
        Message('world');
    end;
    ; <<-- same here
end;

Leading or trailing comment

case EnumValue of 
    SomeEnum::First:
       Message('Whatever');
    SomeEnum:Second:
        Message('Some message.');
    else
        ; // No other scenarios needs a message
end;

In some cases, an empty statement makes sense, and adding a comment justifying its existence will suppress the rule.

Read more:

Clone this wiki locally