Rules / plcopen-naming
PLCopen variable naming: x, i, r, t prefixes
An optional profile: the rule checks that a variable name starts with the prefix for its type (BOOL → x, INT → i, REAL → r, TIME → t and so on). Turn it on only if your team has adopted this standard.
Severity: Minor
Rule id: plcopen-naming
Name off the PLCopen standard
This rule belongs to the optional "PLCopen naming" profile and only runs when the profile is enabled.
What the rule checks
PLCopen standard: a variable name starts with a type prefix (BOOL→x, INT→i, REAL→r, DINT→di, TIME→t, WORD→w …). An optional conformance check.
What it does to the plant
No risk to the plant. Consistent names make other people's code and reviews faster to read.
Example
PROGRAM ScaleVAR rRaw : REAL; value : REAL;END_VARvalue := rRaw * 2.0;
PROGRAM ScaleVAR rRaw : REAL; rValue : REAL;END_VARrValue := rRaw * 2.0;
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
- Rename by the prefix table:
value : REAL→rValue,cnt : INT→iCnt. - If you do not need PLCopen naming, simply leave this profile off.
Standard
PLCopen standard: a type prefix at the start of a variable name (as stated in the rule description; the prefix table is above).
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