Rules / missing-comments
A POU without a single comment: the minimum PLC code needs
The rule flags a POU with substantial logic and no comment at all. The minimum is a header with the block's purpose and notes on setpoints, protections and anything non-obvious.
Severity: Minor
Rule id: missing-comments
POU without a single comment
What the rule checks
A POU with substantial logic and not a single comment is a nightmare when troubleshooting six months later. At least a purpose header and notes on the non-obvious parts.
What it does to the plant
A commissioning engineer cannot see the intent and "fixes" something that was working correctly.
Example
PROGRAM BoilerVAR xRun : BOOL; xFlame : BOOL; xFault : BOOL; rTemp : REAL; rSet : REAL; xBurner : BOOL; xPump : BOOL;END_VARxPump := xRun;IF xRun AND NOT xFault THEN IF rTemp < rSet - 2.0 THEN xBurner := TRUE; ELSIF rTemp > rSet + 2.0 THEN xBurner := FALSE; END_IFELSE xBurner := FALSE;END_IFIF xBurner AND NOT xFlame THEN xFault := TRUE;END_IFIF NOT xRun THEN xFault := FALSE;END_IF
PROGRAM BoilerVAR xRun : BOOL; xFlame : BOOL; xFault : BOOL; rTemp : REAL; rSet : REAL; xBurner : BOOL; xPump : BOOL;END_VAR// Boiler: two-position control with a 2 degC band, flame loss trips the burnerxPump := xRun;IF xRun AND NOT xFault THEN IF rTemp < rSet - 2.0 THEN xBurner := TRUE; ELSIF rTemp > rSet + 2.0 THEN xBurner := FALSE; END_IFELSE xBurner := FALSE;END_IF// burner on but no flame: latch the fault until the boiler is stoppedIF xBurner AND NOT xFlame THEN xFault := TRUE;END_IFIF NOT xRun THEN xFault := FALSE;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
- Add a POU purpose header and comments on setpoints/guards and non-obvious parts.
Upload a PLCopen XML or CODESYS .export file: the report is free and the code is not stored.
The same linter without uploading a file: command line and GitHub Action.
Related rules
2026-11-26