Configuration | Metrics b := b1 AND b2 OR b3; //+2: one chain of AND operators and one chain of OR operators The expression has a chain of AND operators and a chain of OR operators. This results in an increment of 2. b := b1 AND b2 OR b3 AND b4 AND b5; //+3: one chain of AND operators, one chain of OR operators and another chain of AND operators The code snippet has an increment of 3. b := b1 AND NOT b2 AND b3; //+1: the unary NOT operator is not considered in the cognitive complexity The unary operator NOT is not taken into account in the cognitive complexity. Sample: Further statements with increment Structured Text has additional statements and expressions that change the control flow.
The following statements are penalized with an increment in cognitive complexity: aNewLabel: x := MUX(i, a,b,c); //+1 for MUX operator y := SEL(b, i,j); //+1 for SEL operator JMP aNewLabel; //+1 for JMP to label EXIT and RETURN statements do not increase cognitive complexity. 4.4.1.15 Depth of Inheritance Tree (DIT) | Depth of Inheritance Tree (DIT) Sample: FUNCTION_BLOCK FB_Base FUNCTION_BLOCK FB_Sub EXTENDS FB_Base FUNCTION_BLOCK FB_SubSub EXTENDS FB_Sub The metric Depth of Inheritance Tree is: For FB_Base : 0, as it is itself a function block that does not extend any other function block. For FB_Sub : 1, as one step is required to get to FB_Base . For FB_SubSub :
2, as one step to FB_Sub and another to FB_Base is required. 4.4.1.16 Number Of Children (NOC) | Number Of Children (NOC) Sample: TE1200 102 Version: 2.11.1 Title short form DIT Categories Maintainability Definition Number of inheritances until a function block is reached that does not extend any other function block Further information DIT = Depth of Inheritance Tree Title short form NOC Categories Reusability, maintainability Definition Number of function blocks that extend the given basic function block. Function blocks that indirectly extend a basic function block are not counted. Further information NOC = Number Of Children