Purpose (problem description)

This page describes the methodology to investigate cyclomatic complexity variation between two snapshots. For example, you want to understand the variation shown in the screenshot below:

Observed in CAST AIP


Release
Yes/No
8.3.x(tick)
Observed on RDBMS
RDBMS
Yes/No
CSS (tick)

Step by Step scenario

  1. Take a first snapshot of an application
  2. Take a second snapshot of the application keeping the same configuration 
  3. Connect to dashboard and observe a huge variation of cyclomatic complexity as shown in the screenshot above

Action Plan

To troubleshoot this issue, you need the following Relevant input

  1. Get the cyclomatic complexity by type of objects for both snapshots of the application
  2. Identify the type of objects having the highest variation of cyclomatic between two snapshots.
  3. If the variation of cyclomatic between two snapshot is proportional to the variation of number of objects, then this could be an expected behavior. Please review the configuration of your module to keep the same content between both snapshots. If you identify some missing objects in your module, you can refer to the following page to investigate this CMS Application - Modules - Incorrect module content - Missing objects
  4. If the variation cannot be explained by the variation of objects, check if you case is not explain in Special cases
  5. If you case is not explained with the special cases, please contact CAST Technical Support with the following input in addition to Relevant input:
    1. Example of object identified with high variation of cyclomatic
    2. Dumps corresponding to previous analysis
    3. Source code of latest analysis

Relevant input

Get the cyclomatic complexity by type of objects for both snapshots of the application

Follwing queries need to be run on the central database CB

Identify the two latest snapshots of the application

select *
from dss_snapshots
order by functional_date desc

Get the current_snapshot_id and previous_snapshot_id for your application

Get the cyclomatic complexity by type of objects for current and previous snapshots

 For this, please run the query available in this page SQL Queries - CAST Central Base - Queries on Metrics - How to get the cyclomatic complexity by type of objects for a specific snapshot for both current and previous snapshot identified above

If the query in the above page does not return any rows then please refer to the page - CAST Engineering Dashboard - Metrics - Cyclomatic Complexity - Incorrect Value - Cyclomatic Complexity displayed as zero on dashboard


Identify the type of objects having the highest variation of cyclomatic between two snapshots

Once you have the total cyclomatic complexity by type of objects, identify the one with the highest variation. For example:

12;101;"Java Constructor";2182;3060
13;101;"Java Constructor";2446;3590
12;102;"Java Method";45310;118172
13;102;"Java Method";47317;122798
12;105;"Java Initializer";65;171
13;105;"Java Initializer";69;191
12;137746;"Javascript Client Side Method";9008;974128
13;137746;"Javascript Client Side Method";9001;1028
12;138220;"Oracle dml trigger";178;203
13;138220;"Oracle dml trigger";178;203
12;138244;"Oracle procedure";38;325
13;138244;"Oracle procedure";38;325
12;138245;"Oracle function";11;39
13;138245;"Oracle function";11;39
12;140119;"Oracle private stored function";1;4
13;140119;"Oracle private stored function";1;4

You can see in the example above that the cyclomatic complexity for "Javascript Client Side Method" objects has been decreased from 974128 to 10281 between snapshot 12 and snapshot 13

Special cases

CASE #1

Decrease of cyclomatic complexity for Javascript Client Side Method after migration from 7.0.x version

If you observe a huge decrease of cyclomatic complexity for "Javascript Client Side Method" type after migration from 7.0.x, with no corresponding decrease in the number of objects on which cyclomatic has been computed as for example :

12;137746;"Javascript Client Side Method";9008;974128
13;137746;"Javascript Client Side Method";9001;1028

This is an expected behavior due to a correction done fixed in 7.2.0 on JS objects position that in leading to a decrease of the cyclomatic complexity associated to JS objects.

Notes/comments

 Ticket 4359

The issue about JS objects position  has been fixed in an internal report and is not referenced in the bug fix list note

Related Pages