facebookresearch / XLM
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 414 units with 7,413 lines of code in units (88.0% of code).
    • 2 very complex units (136 lines of code)
    • 12 complex units (774 lines of code)
    • 48 medium complex units (1,934 lines of code)
    • 82 simple units (1,794 lines of code)
    • 270 very simple units (2,775 lines of code)
1% | 10% | 26% | 24% | 37%
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
py1% | 10% | 26% | 24% | 37%
perl0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
xlm/data11% | 0% | 28% | 15% | 44%
src/data11% | 0% | 28% | 15% | 44%
xlm/model0% | 24% | 18% | 18% | 38%
src/model0% | 24% | 18% | 18% | 38%
xlm0% | 6% | 20% | 41% | 31%
src0% | 6% | 20% | 41% | 31%
xlm/evaluation0% | 0% | 46% | 21% | 32%
src/evaluation0% | 0% | 46% | 21% | 32%
ROOT0% | 0% | 36% | 0% | 63%
tools0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def check_data_params()
in xlm/data/loader.py
68 73 1
def check_data_params()
in src/data/loader.py
68 73 1
def check_model_params()
in xlm/model/__init__.py
49 39 1
def check_model_params()
in src/model/__init__.py
49 39 1
def generate_beam()
in xlm/model/transformer.py
86 35 8
def generate_beam()
in src/model/transformer.py
86 35 8
def build_model()
in xlm/model/__init__.py
49 33 2
def __init__()
in xlm/trainer.py
71 33 3
def build_model()
in src/model/__init__.py
49 33 2
def __init__()
in src/trainer.py
71 33 3
def __init__()
in xlm/model/memory/memory.py
83 32 4
def __init__()
in src/model/memory/memory.py
83 32 4
def check_params()
in xlm/model/memory/memory.py
49 31 1
def check_params()
in src/model/memory/memory.py
49 31 1
def load_data()
in xlm/evaluation/glue.py
44 23 2
def load_data()
in src/evaluation/glue.py
44 23 2
def load_mono_data()
in xlm/data/loader.py
33 22 2
def load_mono_data()
in src/data/loader.py
33 22 2
def run_all_evals()
in xlm/evaluation/evaluator.py
21 20 2
def evaluate_mlm()
in xlm/evaluation/evaluator.py
44 20 5