facebookresearch / corefnmn
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 237 units with 4,451 lines of code in units (80.6% of code).
    • 1 very complex units (152 lines of code)
    • 4 complex units (414 lines of code)
    • 18 medium complex units (1,100 lines of code)
    • 39 simple units (896 lines of code)
    • 175 very simple units (1,889 lines of code)
3% | 9% | 24% | 20% | 42%
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
py3% | 9% | 24% | 20% | 42%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
loader_vd49% | 0% | 17% | 5% | 27%
util0% | 21% | 23% | 17% | 37%
vis0% | 54% | 0% | 10% | 34%
models_vd0% | 7% | 29% | 29% | 33%
models_mnist0% | 0% | 25% | 20% | 54%
loader_mnist0% | 0% | 51% | 9% | 39%
exp_vd0% | 0% | 0% | 0% | 100%
exp_mnist0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def load_one_batch()
in loader_vd/data_reader.py
152 56 2
def main()
in vis/visualize_dialogs.py
115 37 1
def build_imdb()
in util/build_imdb.py
126 36 1
def extract_set()
in util/convert_nmn_layouts.py
67 30 1
def __init__()
in models_vd/generator.py
106 27 4
def __init__()
in loader_vd/data_reader.py
55 24 3
def assemble()
in models_vd/assembler.py
48 22 4
def build_imdb()
in util/build_imdb_mnist.py
52 19 5
def __init__()
in models_vd/decoder.py
80 18 4
def segregrate_outputs()
in models_vd/executor.py
53 17 2
def load_one_batch()
in loader_mnist/data_reader.py
49 16 2
def _build_validity_mats()
in models_vd/assembler.py
42 15 1
def collapse()
in util/parse.py
21 15 1
def __init__()
in loader_mnist/data_reader.py
47 15 3
def _build_validity_mats()
in models_mnist/assembler.py
42 15 1
def finalize()
in util/parse.py
35 14 2
def __init__()
in models_mnist/generator.py
41 14 4
def _build_decoder()
in models_vd/generator_attnet.py
123 12 5
def _build_decoder()
in models_mnist/generator_attnet.py
123 12 5
def _build_memory_encoder()
in models_vd/generator_attnet.py
70 11 4