facebookresearch / mmf
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 2,471 units with 24,818 lines of code in units (45.7% of code).
    • 2 very complex units (576 lines of code)
    • 9 complex units (930 lines of code)
    • 45 medium complex units (2,073 lines of code)
    • 151 simple units (4,031 lines of code)
    • 2,264 very simple units (17,208 lines of code)
2% | 3% | 8% | 16% | 69%
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
py2% | 3% | 8% | 16% | 69%
js0% | 0% | 0% | 0% | 100%
c0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
mmf/projects28% | 30% | 13% | 0% | 27%
projects/krisp34% | 37% | 16% | 0% | 12%
tools/scripts0% | 6% | 7% | 12% | 73%
mmf/utils0% | 2% | 14% | 22% | 60%
mmf/trainers0% | 7% | 8% | 16% | 67%
mmf/datasets0% | 0% | 9% | 17% | 72%
mmf/models0% | 0% | 6% | 14% | 78%
mmf/modules0% | 0% | 2% | 17% | 79%
mmf_cli0% | 0% | 20% | 39% | 40%
mmf/common0% | 0% | 5% | 8% | 86%
tools/sweeps0% | 0% | 0% | 49% | 50%
projects/m4c0% | 0% | 0% | 0% | 100%
ROOT0% | 0% | 0% | 0% | 100%
website/src0% | 0% | 0% | 0% | 100%
projects/m4c_captioner0% | 0% | 0% | 0% | 100%
website0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def forward()
in projects/krisp/graphnetwork_module.py
288 74 2
def forward()
in mmf/projects/krisp/graphnetwork_module.py
288 74 2
def __init__()
in projects/krisp/graphnetwork_module.py
149 35 3
def __init__()
in mmf/projects/krisp/graphnetwork_module.py
149 35 3
def get_dataset_info()
in projects/krisp/graphnetwork_module.py
67 31 2
def get_dataset_info()
in mmf/projects/krisp/graphnetwork_module.py
67 31 2
def from_pretrained()
in tools/scripts/features/frcnn/modeling_frcnn.py
159 30 4
def prepare_embeddings()
in projects/krisp/graphnetwork_module.py
92 28 3
def prepare_embeddings()
in mmf/projects/krisp/graphnetwork_module.py
92 28 3
def download()
in mmf/utils/download.py
79 27 5
def run_training_epoch()
in mmf/trainers/core/training_loop.py
76 26 1
def __call__()
in mmf/datasets/processors/processors.py
50 20 2
def add_sample_details()
in mmf/datasets/builders/textvqa/dataset.py
65 19 3
def save()
in mmf/utils/checkpoint.py
73 18 4
def forward()
in mmf/models/mmf_bert.py
88 18 2
def convert_gqa_to_vqa()
in tools/scripts/gqa/convert_gqa_to_vqa.py
63 17 2
def __init__()
in mmf/utils/vocab.py
28 17 3
def format_for_prediction()
in mmf/datasets/builders/okvqa/dataset.py
58 16 2
def load_state_dict()
in mmf/utils/checkpoint.py
36 16 1
def _infer_input_ids()
in mmf/models/mmf_transformer.py
27 16 3