facebookresearch / nbref
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 234 units with 4,250 lines of code in units (88.6% of code).
    • 0 very complex units (0 lines of code)
    • 7 complex units (845 lines of code)
    • 14 medium complex units (1,037 lines of code)
    • 27 simple units (597 lines of code)
    • 186 very simple units (1,771 lines of code)
0% | 19% | 24% | 14% | 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
py0% | 19% | 24% | 14% | 41%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
baseline_model/data_utils0% | 29% | 9% | 11% | 49%
preprocess0% | 24% | 27% | 21% | 26%
baseline_model0% | 0% | 61% | 9% | 29%
preprocess/cram_vul_dataset0% | 0% | 100% | 0% | 0%
baseline_model/modules0% | 0% | 0% | 12% | 87%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def evaluation()
in baseline_model/data_utils/train_tree_encoder_v2.py
122 39 10
def __ins_node__()
in preprocess/asm_mips.py
92 37 1
def eval_training()
in baseline_model/data_utils/train_tree_encoder_v2.py
117 35 12
def train_eval_tree()
in baseline_model/data_utils/train_tree_encoder.py
134 33 8
def test_tree()
in baseline_model/data_utils/train_tree_encoder.py
140 33 8
def __get_nodes__()
in preprocess/asm_mips.py
137 26 3
def extract_from_solution()
in preprocess/extract_obj.py
103 26 1
def main()
in preprocess/asm_mips.py
101 25 0
def processing_data()
in baseline_model/data_utils/train_tree_encoder.py
95 25 2
def __ins_node__()
in preprocess/asm_obj.py
40 21 1
def process()
in preprocess/cram_vul_dataset/src2asm.py
89 18 2
def __get_nodes__()
in preprocess/asm_obj.py
103 17 3
def main()
in baseline_model/run_tree_transformer.py
133 17 0
def __init__()
in preprocess/asm_obj.py
41 16 3
def __init__()
in preprocess/asm_mips.py
40 14 5
def main()
in baseline_model/run_tree_transformer_multi_gpu.py
72 14 0
def _gc_dataloader()
in baseline_model/data_utils/ggnn_utils.py
73 13 8
def main()
in baseline_model/run_vulnerability_detection.py
117 13 0
def Graphs_build_mips()
in preprocess/asm_mips.py
33 12 2
def content2list()
in preprocess/asm_obj.py
18 11 3