free quality report for PLCopenXML exports

Rules / empty-branch

Empty IF branch or empty loop in Structured Text

An IF/ELSIF/ELSE branch or a loop body is empty. The logic was either never written or removed during an edit while the construct stayed.

Severity: Warning Rule id: empty-branch Empty IF/loop branch

What the rule checks

An IF/ELSIF/ELSE branch or a loop body is empty (THEN END_IF, DO END_FOR): the logic was either never written or cut out during an edit and the construct left behind.

What it does to the plant

A reaction everyone assumes exists is missing: the alarm is raised, the horn never sounds.

Example

Bad: the rule fires
PROGRAM AlarmsVAR    xAlarm : BOOL;    xHorn : BOOL;END_VARIF xAlarm THENEND_IF
Fixed: the rule is silent
PROGRAM AlarmsVAR    xAlarm : BOOL;    xHorn : BOOL;END_VARIF xAlarm THEN    xHorn := TRUE;END_IF

Both listings are run through the linter by an automated test: the rule fires on the first and stays silent on the second.

How to fix

  1. Fill the branch with logic or remove the empty IF/loop.
  2. If it is empty on purpose, leave an explanatory comment.
Check your project

Upload a PLCopen XML or CODESYS .export file: the report is free and the code is not stored.

Local version on GitHub →

The same linter without uploading a file: command line and GitHub Action.

Related rules

2026-11-26

Processing happens in memory, and the uploaded code is not stored. The tool advises; code changes are up to the engineer (see what the linter can't see). What happens to your code → · Rule reference · Your code & privacy · Industry benchmark · Feedback · GitHub