facebookresearch / anli
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 140 units with 2,472 lines of code in units (68.9% of code).
    • 0 very complex units (0 lines of code)
    • 2 complex units (600 lines of code)
    • 4 medium complex units (227 lines of code)
    • 15 simple units (311 lines of code)
    • 119 very simple units (1,334 lines of code)
0% | 24% | 9% | 12% | 53%
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% | 24% | 9% | 12% | 53%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
src/nli0% | 47% | 7% | 6% | 38%
src/modeling0% | 0% | 19% | 15% | 64%
src/flint/data_utils0% | 0% | 21% | 35% | 42%
src/flint0% | 0% | 0% | 28% | 71%
src/utils0% | 0% | 0% | 30% | 69%
src/dataset_tools0% | 0% | 0% | 0% | 100%
src/hg_api0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def train()
in src/nli/training.py
303 46 2
def train()
in src/nli/training_extra.py
297 41 2
def load_tf_weights_in_xlnet()
in src/modeling/dummy_modeling_xlnet.py
50 16 3
def evaluation()
in src/nli/evaluation.py
97 14 0
def move_to_device()
in src/flint/data_utils/batchbuilder.py
15 13 2
def build_tf_xlnet_to_pytorch_map()
in src/modeling/dummy_modeling_xlnet.py
65 12 3
def pack_for_rnn_seq()
in src/flint/torch_util.py
45 10 4
def _init_weights()
in src/modeling/dummy_modeling_xlnet.py
23 9 2
def append_subfield_from_list_to_dict()
in src/utils/list_dict_data_tool.py
17 8 6
def reverse_indice_for_state()
in src/flint/torch_util.py
13 8 2
def inference()
in src/nli/inference_debug.py
48 7 6
def relative_positional_encoding()
in src/modeling/dummy_modeling_xlnet.py
29 7 4
def start_and_end_token_handling()
in src/flint/torch_util.py
17 7 6
def collate_tokens()
in src/flint/data_utils/fields.py
16 7 6
def sample_data_list()
in src/nli/training_extra.py
16 6 2
def sample_data_list()
in src/nli/training.py
16 6 2
def append_item_from_dict_to_list()
in src/utils/list_dict_data_tool.py
13 6 4
def append_item_from_dict_to_list_hotpot_style()
in src/utils/list_dict_data_tool.py
12 6 4
def forward()
in src/modeling/res_encoder.py
21 6 4
def forward()
in src/modeling/res_encoder.py
16 6 4