free quality report for PLCopenXML exports

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

Bad: the rule fires
<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>
Fixed: the rule is silent
<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

  1. Restore the protective logic: CheckDivReal must test IF divisor = 0 THEN … := 1;
  2. CheckBounds/CheckRange… must clamp the value to lower..upper. Compare with the default CODESYS implementation.
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

In-depth article

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