Skip to main content

Detectors

iec-checker ships with 27 detectors out of the box. Each detector has a stable rule ID that appears in the analyzer's output.

The detectors fall into two groups:

  • Built-in detectors — general correctness checks (out-of-bounds access, unused variables) that always run.
  • PLCOpen detectors — checks implementing rules from the PLCOpen Software Construction Guidelines.

Built-in detectors

#Rule IDDescription
1OutOfBoundsOut-of-range array index, subrange initializer, or string/array initializer length
2UnusedVariableLocal variable declared in a POU but never read or written

PLCOpen detectors

These checks implement rules from the PLCOpen Software Construction Guidelines, an industry-standard set of best practices for safe and maintainable Structured Text. Rule IDs follow the PLCOpen numbering: CP* for code construction, L* for language usage, N* for naming.

See the PLCOpen coverage matrix for the full list of standard rules and which ones are implemented.

#Rule IDDescription
1PLCOPEN-CP1Access to a member shall be by name
2PLCOPEN-CP2All code shall be used in the application
3PLCOPEN-CP3All variables shall be initialized before being used
4PLCOPEN-CP4Direct addressing should not overlap
5PLCOPEN-CP6Avoid external variables in functions, function blocks and classes
6PLCOPEN-CP8Floating point comparison shall not be equality or inequality
7PLCOPEN-CP9Limit the complexity of POU code
8PLCOPEN-CP13POUs shall not call themselves directly or indirectly
9PLCOPEN-CP16Tasks shall only call program POUs and not function blocks
10PLCOPEN-CP25Data types conversion should be explicit
11PLCOPEN-CP26A global variable may be written only by one PROGRAM
12PLCOPEN-CP28Time and physical measures comparison shall not be equality or inequality
13PLCOPEN-L10Usage of CONTINUE and EXIT instruction should be avoided
14PLCOPEN-L13FOR loop variable should not be used outside the FOR loop
15PLCOPEN-L17Each IF instruction should have an ELSE clause
16PLCOPEN-L22Loop variables should not be modified inside a FOR loop
17PLCOPEN-N1Avoid physical addresses
18PLCOPEN-N2Define type prefixes for variables
19PLCOPEN-N3Define the names to avoid
20PLCOPEN-N4Define the use of case (capitals)
21PLCOPEN-N5Local names shall not shadow global names
22PLCOPEN-N6Define an acceptable name length
23PLCOPEN-N8Define the acceptable character set
24PLCOPEN-N9Different element types should not bear the same name
25PLCOPEN-N10Define name prefixes for user defined types