Rules / broken-implicit-check
CheckDivReal or CheckBounds exists but does not protect: a hollowed-out check
The implicit check function is registered and the runtime calls it, but its body is empty or the zero or bounds test was removed. It catches nothing while the project looks protected.
Severity: Critical
Rule id: broken-implicit-check
Implicit check does not protect
What the rule checks
An implicit check function (Check…) exists, but its protective logic is gutted: an empty body, or the check (divisor=0 / bounds) removed. The runtime calls it, but it catches nothing, which is a false sense of safety, more dangerous than its absence.
What it does to the plant
False sense of safety: division by zero or out-of-range access goes through as if there were no protection, while everyone believes there is.
Example
<pou name="CheckDivReal" pouType="function"> <interface> <returnType><REAL/></returnType> <inputVars><variable name="divisor"><type><REAL/></type></variable></inputVars> </interface> <body> <ST><xhtml xmlns="http://www.w3.org/1999/xhtml">CheckDivReal := divisor;</xhtml></ST> <addData><data name="cf"><CheckFunction>CheckDivReal32</CheckFunction></data></addData> </body></pou>
<pou name="CheckDivReal" pouType="function"> <interface> <returnType><REAL/></returnType> <inputVars><variable name="divisor"><type><REAL/></type></variable></inputVars> </interface> <body> <ST><xhtml xmlns="http://www.w3.org/1999/xhtml">IF divisor = 0 THEN CheckDivReal := 1;ELSE CheckDivReal := divisor;END_IF</xhtml></ST> <addData><data name="cf"><CheckFunction>CheckDivReal32</CheckFunction></data></addData> </body></pou>
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
- Restore the protective logic:
CheckDivRealmust testIF divisor = 0 THEN … := 1; CheckBounds/CheckRange…must clamp the value tolower..upper. Compare with the default CODESYS implementation.
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
In-depth article
2026-11-26