amazon-research / BartGraphSumm
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,260 units with 23,736 lines of code in units (70.5% of code).
    • 2 very complex units (418 lines of code)
    • 7 complex units (758 lines of code)
    • 80 medium complex units (4,105 lines of code)
    • 168 simple units (4,268 lines of code)
    • 2,003 very simple units (14,187 lines of code)
1% | 3% | 17% | 17% | 59%
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% | 3% | 17% | 18% | 59%
cpp0% | 0% | 0% | 12% | 87%
lua0% | 0% | 0% | 0% | 100%
pyx0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
src/fairseq/fairseq_cli35% | 21% | 14% | 14% | 13%
src/fairseq/fairseq0% | 10% | 20% | 19% | 49%
src0% | 11% | 48% | 17% | 21%
src/fairseq/fairseq/data0% | 1% | 11% | 11% | 76%
src/fairseq/fairseq/models0% | 0% | 17% | 15% | 66%
src/fairseq/fairseq/tasks0% | 0% | 28% | 19% | 51%
src/fairseq/fairseq/optim0% | 0% | 21% | 12% | 65%
src/fairseq/fairseq/criterions0% | 0% | 20% | 30% | 48%
src/fairseq/fairseq/modules0% | 0% | 5% | 28% | 66%
src/fairseq/scripts0% | 0% | 21% | 36% | 41%
src/fairseq/fairseq/logging0% | 0% | 0% | 18% | 81%
src/fairseq/fairseq/clib0% | 0% | 0% | 18% | 81%
src/fairseq/fairseq/model_parallel0% | 0% | 0% | 5% | 94%
src/fairseq/fairseq/benchmark0% | 0% | 0% | 0% | 100%
src/fairseq0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def main()
in src/fairseq/fairseq_cli/preprocess.py
239 54 1
def _main()
in src/fairseq/fairseq_cli/generate.py
179 53 2
def train_step()
in src/fairseq/fairseq/trainer.py
137 48 3
def main()
in src/fairseq/fairseq_cli/eval_lm.py
151 41 2
def generate()
in src/fairseq/fairseq/iterative_refinement_generator.py
141 38 4
def save_checkpoint()
in src/fairseq/fairseq/checkpoint_utils.py
76 32 4
def main()
in src/fairseq/fairseq_cli/interactive.py
104 32 1
def cluster_docs()
in src/graph_utils.py
98 27 7
def __getitem__()
in src/fairseq/fairseq/data/language_pair_dataset.py
51 26 2
def build_model()
in src/fairseq/fairseq/models/multilingual_transformer.py
91 25 3
def main()
in src/fairseq/fairseq_cli/train.py
65 25 2
def forward()
in src/fairseq/fairseq/criterions/binary_cross_entropy.py
58 24 5
def load_dataset()
in src/fairseq/fairseq/tasks/semisupervised_translation.py
139 23 4
def _generate_sentence_pair()
in src/fairseq/fairseq/data/legacy/block_pair_dataset.py
44 23 5
def generate()
in src/fairseq/fairseq/sequence_scorer.py
93 22 4
def create_data()
in src/prepare_data.py
72 22 1
def _register_grad_hook()
in src/fairseq/fairseq/legacy_distributed_data_parallel.py
70 21 1
def construct_graph()
in src/graph_construction.py
91 21 3
def load_dataset()
in src/fairseq/fairseq/tasks/multilingual_denoising.py
113 20 5
def upgrade_state_dict_named()
in src/fairseq/fairseq/models/bart/model.py
75 20 3