facebookresearch / SWAG
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 80 units with 824 lines of code in units (59.0% of code).
    • 0 very long units (0 lines of code)
    • 2 long units (124 lines of code)
    • 4 medium size units (129 lines of code)
    • 15 small units (193 lines of code)
    • 59 very small units (378 lines of code)
0% | 15% | 15% | 23% | 45%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 15% | 15% | 23% | 45%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
models0% | 9% | 15% | 23% | 52%
ROOT0% | 37% | 17% | 25% | 20%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def __init__()
in models/regnet.py
63 6 2
def main_worker()
in imagenet_1k_eval.py
61 15 3
def load_state_dict()
in models/vision_transformer.py
50 7 3
def get_expanded_params()
in models/regnet.py
29 8 1
def validate()
in imagenet_1k_eval.py
28 6 4
def forward()
in models/vision_transformer.py
22 5 2
def __init__()
in models/regnet.py
17 1 0
def __init__()
in models/regnet.py
16 1 0
def flops()
in models/vision_transformer.py
16 1 2
def main()
in imagenet_1k_eval.py
16 6 0
def __init__()
in models/vision_transformer.py
13 1 0
def summary()
in imagenet_1k_eval.py
13 5 1
def forward()
in models/regnet.py
12 5 2
def __init__()
in models/regnet.py
12 1 0
def accuracy()
in imagenet_1k_eval.py
12 2 3
def __init__()
in models/regnet.py
11 1 0
def __init__()
in models/regnet.py
11 1 0
def __init__()
in models/regnet.py
11 1 0
def init_weights()
in models/regnet.py
11 5 1
def init_weights()
in models/regnet.py
11 5 1