MB ESQL Cyclomatic complexity
Cyclomatic complexity is a measure of the number of paths through a section of code.
The higher a piece of codes complexity the more difficult it is to understand, maintain, test and usually limits reuse.
For the following piece of code (that has a complexity score of 1), we have broken down how that score has been calculated.
CREATE COMPUTE MODULE GenericRule_AnonymousFieldRefChecks CREATE FUNCTION Main() RETURNS BOOLEAN – R232 rule: Anonymous field reference tests RETURN TRUE; |
For the following piece of code (that has a complexity score of 7), we have broken down how that score has been calculated.
CREATE COMPUTE MODULE GenericRule_MultipleIFs DECLARE size CHARACTER; IF I = 0 THEN (2) RETURN TRUE; |
For the following piece of code (that has a complexity score of 9), we have broken down how that score has been calculated.
CREATE FUNCTION unreachableLeaveContinue () RETURNS BOOLEAN ITERATE X; (3) IF i IN(2, 3) THEN (4) UNTIL X : REPEAT (6) LEAVE X; (7) IF i IN(2, 3) THEN (8) UNTIL |