facebookresearch / SWAG
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 80 units with 824 lines of code in units (59.0% of code).
    • 0 very complex units (0 lines of code)
    • 0 complex units (0 lines of code)
    • 1 medium complex units (61 lines of code)
    • 6 simple units (192 lines of code)
    • 73 very simple units (571 lines of code)
0% | 0% | 7% | 23% | 69%
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% | 0% | 7% | 23% | 69%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
ROOT0% | 0% | 37% | 26% | 35%
models0% | 0% | 0% | 22% | 77%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def main_worker()
in imagenet_1k_eval.py
61 15 3
def get_expanded_params()
in models/regnet.py
29 8 1
6 7 3
def load_state_dict()
in models/vision_transformer.py
50 7 3
def __init__()
in models/regnet.py
63 6 2
def main()
in imagenet_1k_eval.py
16 6 0
def validate()
in imagenet_1k_eval.py
28 6 4
def forward()
in models/regnet.py
12 5 2
def init_weights()
in models/regnet.py
11 5 1
def init_weights()
in models/regnet.py
11 5 1
def forward()
in models/vision_transformer.py
22 5 2
def summary()
in imagenet_1k_eval.py
13 5 1
def init_weights()
in models/vision_transformer.py
9 3 1
def forward()
in models/vision_transformer.py
5 3 2
def is_pos_int()
in models/regnet.py
2 2 1
def forward()
in models/regnet.py
6 2 2
def forward()
in models/regnet.py
6 2 3
def forward()
in models/regnet.py
2 2 2
def forward()
in models/regnet.py
7 2 4
def forward()
in models/regnet.py
7 2 4