microsoft / graph-based-code-modelling
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 698 units with 7,928 lines of code in units (83.8% of code).
    • 1 very complex units (226 lines of code)
    • 0 complex units (0 lines of code)
    • 19 medium complex units (965 lines of code)
    • 48 simple units (1,612 lines of code)
    • 630 very simple units (5,125 lines of code)
2% | 0% | 12% | 20% | 64%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
py6% | 0% | 10% | 28% | 53%
cs0% | 0% | 13% | 14% | 72%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
Models/exprsynth7% | 0% | 10% | 30% | 52%
DataExtraction/SourceGraphExtractionUtils0% | 0% | 20% | 8% | 71%
DataExtraction/SourceGraphExtractionUtils/Utils0% | 0% | 9% | 17% | 72%
Models/utils0% | 0% | 15% | 15% | 69%
DataExtraction/ExpressionDataExtractor0% | 0% | 0% | 15% | 84%
DataExtraction/TestProject0% | 0% | 0% | 52% | 47%
Models/exprsynth/metadata0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def generate_suggestions_for_one_sample()
in Models/exprsynth/nagdecoder.py
226 60 9
public static Dictionary CreateNodeToTokenMap()
in DataExtraction/SourceGraphExtractionUtils/Utils/RoslynUtils.cs
89 21 3
private static IDictionary ComputeNodeCompressionMap()
in DataExtraction/SourceGraphExtractionUtils/GraphDataExtractor.cs
65 20 1
def __load_contextgraph_data_from_sample()
in Models/exprsynth/contextgraphmodel.py
75 20 9
public void ExtractAllSamplesFromSemanticModel()
in DataExtraction/SourceGraphExtractionUtils/GraphDataExtractor.cs
75 17 2
public static void AddDataFlowEdges()
in DataExtraction/SourceGraphExtractionUtils/Utils/VariableUseGraph.cs
61 17 4
private static void CopySubgraphAroundHole()
in DataExtraction/SourceGraphExtractionUtils/GraphDataExtractor.cs
52 16 5
private static bool IsDeclaringNode()
in DataExtraction/SourceGraphExtractionUtils/Utils/DataFlowGraph.cs
38 16 1
def init_minibatch()
in Models/exprsynth/nagdecoder.py
30 16 3
public void Add()
in DataExtraction/SourceGraphExtractionUtils/TypeHierarchy.cs
55 15 1
def __raw_batches_from_chunks_iterator()
in Models/exprsynth/model.py
38 14 3
62 14 5
def finalise_metadata()
in Models/exprsynth/nagdecoder.py
45 13 5
private static void GetReachableNodes()
in DataExtraction/SourceGraphExtractionUtils/GraphDataExtractor.cs
46 12 7
public static IEnumerable GetSimpleExpressions()
in DataExtraction/SourceGraphExtractionUtils/GraphDataExtractor.cs
23 12 1
def __make_train_placeholders()
in Models/exprsynth/nagdecoder.py
76 12 1
private static SourceGraph GetCompressedGraph()
in DataExtraction/SourceGraphExtractionUtils/GraphDataExtractor.cs
42 11 1
private void VisitTypeDeclaration()
in DataExtraction/SourceGraphExtractionUtils/Utils/DataFlowGraph.cs
43 11 1
public override void Visit()
in DataExtraction/SourceGraphExtractionUtils/Utils/RoslynUtils.cs
15 11 1
def split_file()
in Models/utils/dataset_split.py
35 11 7