facebookresearch / MultipleAttributeTextRewriting
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 243 units with 3,962 lines of code in units (73.7% of code).
    • 1 very complex units (167 lines of code)
    • 2 complex units (289 lines of code)
    • 21 medium complex units (945 lines of code)
    • 35 simple units (934 lines of code)
    • 184 very simple units (1,627 lines of code)
4% | 7% | 23% | 23% | 41%
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
py4% | 7% | 23% | 23% | 41%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
code/src8% | 12% | 13% | 27% | 37%
code/src/model0% | 3% | 32% | 21% | 41%
code/src/data0% | 0% | 41% | 21% | 36%
code/src/modules0% | 0% | 32% | 9% | 58%
code/scripts0% | 0% | 0% | 0% | 100%
data0% | 0% | 0% | 0% | 100%
code0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def eval_swap_bleu_clf()
in code/src/evaluator.py
167 84 3
def generate()
in code/src/sequence_generator.py
238 47 7
def check_ae_model_params()
in code/src/model/__init__.py
51 44 1
def generate()
in code/src/model/attention.py
66 24 6
def eval_back()
in code/src/evaluator.py
58 23 4
def generate()
in code/src/model/seq2seq.py
56 22 6
def __init__()
in code/src/model/attention.py
55 18 3
def __init__()
in code/src/trainer.py
37 18 3
def forward()
in code/src/modules/multihead_attention.py
78 18 9
def index_data()
in code/src/data/dictionary.py
68 17 6
def generate()
in code/src/model/lm.py
39 15 4
def __init__()
in code/src/model/seq2seq.py
53 15 3
def load_binarized()
in code/src/data/loader.py
48 15 2
def get_dump_path()
in code/src/utils.py
26 14 1
def get_optimizer()
in code/src/utils.py
46 14 2
def set_parameters()
in code/src/data/loader.py
27 13 3
def check_all_data_params()
in code/src/data/loader.py
21 13 1
def call_async()
in code/src/multiprocessing_event_loop.py
33 12 6
def reload_model()
in code/src/utils.py
31 12 3
def forward()
in code/src/model/attention.py
36 12 3