facebookresearch / Mask-Predict
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 1,020 units with 10,743 lines of code in units (79.8% of code).
    • 0 very complex units (0 lines of code)
    • 11 complex units (1,358 lines of code)
    • 32 medium complex units (1,527 lines of code)
    • 73 simple units (1,787 lines of code)
    • 904 very simple units (6,071 lines of code)
0% | 12% | 14% | 16% | 56%
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
py0% | 12% | 14% | 16% | 56%
cpp0% | 0% | 0% | 25% | 75%
lua0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
ROOT0% | 57% | 9% | 12% | 20%
fairseq_cli0% | 58% | 11% | 13% | 17%
fairseq/modules0% | 9% | 7% | 21% | 61%
fairseq0% | 4% | 22% | 21% | 51%
fairseq/models0% | 0% | 17% | 12% | 69%
fairseq/optim0% | 0% | 15% | 9% | 74%
scripts0% | 0% | 22% | 28% | 48%
fairseq/data0% | 0% | 6% | 13% | 79%
fairseq/tasks0% | 0% | 22% | 7% | 69%
fairseq/criterions0% | 0% | 0% | 23% | 76%
fairseq/clib0% | 0% | 0% | 25% | 75%
fairseq/strategies0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def main()
in generate.py
128 43 1
def main()
in fairseq_cli/generate.py
128 43 1
def train_step()
in fairseq/trainer.py
119 39 4
def main()
in fairseq_cli/eval_lm.py
133 38 1
def main()
in eval_lm.py
133 38 1
def forward()
in fairseq/modules/multihead_attention.py
134 37 9
def main()
in preprocess.py
148 35 1
def main()
in fairseq_cli/preprocess.py
148 35 1
def main()
in generate_cmlm.py
93 32 1
def main()
in fairseq_cli/interactive.py
97 31 1
def main()
in interactive.py
97 31 1
def save_checkpoint()
in fairseq/checkpoint_utils.py
56 24 4
def main()
in fairseq_cli/train.py
48 24 2
def main()
in train.py
48 24 2
def filter_by_size()
in fairseq/data/data_utils.py
36 23 4
def _register_grad_hook()
in fairseq/legacy_distributed_data_parallel.py
70 21 1
def finalize_hypos()
in fairseq/sequence_generator.py
56 20 4
def load_dataset()
in fairseq/tasks/translation_self.py
67 19 4
def step()
in fairseq/optim/adam.py
59 19 5
def generate()
in fairseq/sequence_scorer.py
82 19 4