Convention: Inheritance Depth Limit

User Description

IEC-61131-3 provides language features to extend function blocks or implement interfaces. This is called inheritance and can result in a chain of inheritances. In theory, there is no limit for the inheritance depth, but nesting can become too complex to understand the inheritance tree of interfaces and function blocks.

For the application maintainability reasons, the inheritance depth limit can be verified and reported via convention violation rules.

Convention Verification Rule

The keyword extends between function blocks and function blocks, or interfaces and other interfaces is used to verify the chain length.

Example

The inheritance depth of the example is 6.

FB_Test1 extends FB_Test2
FB_Test2 extends FB_Test3
FB_Test3 extends FB_Test4
FB_Test4 extends FB_Test5
FB_Test5 extends FB_Test6
FB_Test6 extends FB_Test7