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 ID | Description |
|---|---|---|
| 1 | OutOfBounds | Out-of-range array index, subrange initializer, or string/array initializer length |
| 2 | UnusedVariable | Local 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 ID | Description |
|---|---|---|
| 1 | PLCOPEN-CP1 | Access to a member shall be by name |
| 2 | PLCOPEN-CP2 | All code shall be used in the application |
| 3 | PLCOPEN-CP3 | All variables shall be initialized before being used |
| 4 | PLCOPEN-CP4 | Direct addressing should not overlap |
| 5 | PLCOPEN-CP6 | Avoid external variables in functions, function blocks and classes |
| 6 | PLCOPEN-CP8 | Floating point comparison shall not be equality or inequality |
| 7 | PLCOPEN-CP9 | Limit the complexity of POU code |
| 8 | PLCOPEN-CP13 | POUs shall not call themselves directly or indirectly |
| 9 | PLCOPEN-CP16 | Tasks shall only call program POUs and not function blocks |
| 10 | PLCOPEN-CP25 | Data types conversion should be explicit |
| 11 | PLCOPEN-CP26 | A global variable may be written only by one PROGRAM |
| 12 | PLCOPEN-CP28 | Time and physical measures comparison shall not be equality or inequality |
| 13 | PLCOPEN-L10 | Usage of CONTINUE and EXIT instruction should be avoided |
| 14 | PLCOPEN-L13 | FOR loop variable should not be used outside the FOR loop |
| 15 | PLCOPEN-L17 | Each IF instruction should have an ELSE clause |
| 16 | PLCOPEN-L22 | Loop variables should not be modified inside a FOR loop |
| 17 | PLCOPEN-N1 | Avoid physical addresses |
| 18 | PLCOPEN-N2 | Define type prefixes for variables |
| 19 | PLCOPEN-N3 | Define the names to avoid |
| 20 | PLCOPEN-N4 | Define the use of case (capitals) |
| 21 | PLCOPEN-N5 | Local names shall not shadow global names |
| 22 | PLCOPEN-N6 | Define an acceptable name length |
| 23 | PLCOPEN-N8 | Define the acceptable character set |
| 24 | PLCOPEN-N9 | Different element types should not bear the same name |
| 25 | PLCOPEN-N10 | Define name prefixes for user defined types |