SEM004 : Cyclomatic complexity

The topic describes the SEM004 analysis rule.

Message

Cyclomatic complexity

Description

Metrics rule – calculates code cyclomatic complexity.

How to fix

The rule is only informational.

Scope

The rule has a Batch scope and is applied only on the SQL script.

Parameters

Rule has no parameters.

Remarks

The rule does not need Analysis Context or SQL Connection.

Effort To Fix
Not configured.
Categories

Metrics

Additional Information

There is no additional info for this rule.

Example Test SQL
SQL
 1BEGIN TRY
 2
 3    IF (12 <1 ) 
 4        SELECT 1
 5    ELSE
 6        SELECT 2
 7
 8END TRY
 9BEGIN CATCH
10
11    IF (12 <1 ) 
12        SELECT 1
13    ELSE
14        SELECT 2
15
16END CATCH
17
18IF (12 <1 ) 
19    SELECT 1
20ELSE
21    IF (12 <1 ) 
22        SELECT 1
23    ELSE
24        SELECT 2
25
26IF (12>1) 
27    SELECT 4
28ELSE
29    SELECT 5

Analysis Results
  Message Line Column
1 SEM004 : CyclomaticComplexity=7 0 0
See Also

Other Resources