facebookresearch / FixRes
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 234 units with 2,947 lines of code in units (82.4% of code).
    • 1 very long units (110 lines of code)
    • 2 long units (145 lines of code)
    • 39 medium size units (1,353 lines of code)
    • 48 small units (672 lines of code)
    • 144 very small units (667 lines of code)
3% | 4% | 45% | 22% | 22%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py3% | 4% | 45% | 22% | 22%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
imnet_finetune12% | 10% | 34% | 21% | 20%
imnet_resnet50_scratch0% | 22% | 37% | 19% | 20%
imnet_extract0% | 0% | 51% | 23% | 25%
imnet_evaluate0% | 0% | 46% | 28% | 25%
ROOT0% | 0% | 67% | 15% | 16%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def _train()
in imnet_finetune/train.py
110 15 1
def _init_state()
in imnet_finetune/train.py
86 26 1
def _train()
in imnet_resnet50_scratch/train.py
59 9 1
def _init_state()
in imnet_evaluate/train.py
50 11 1
def _init_state()
in imnet_extract/train.py
50 11 1
def __init__()
in imnet_evaluate/pnasnet.py
47 1 2
def __init__()
in imnet_extract/pnasnet.py
47 1 2
def __init__()
in imnet_finetune/pnasnet.py
47 1 2
def __init__()
in imnet_evaluate/pnasnet.py
46 6 8
def __init__()
in imnet_extract/pnasnet.py
46 6 8
def __init__()
in imnet_finetune/pnasnet.py
46 6 8
def _init_state()
in imnet_resnet50_scratch/train.py
43 2 1
def run()
in main_finetune.py
43 5 14
def get_transforms()
in transforms_v2.py
43 8 6
def __init__()
in imnet_evaluate/Res.py
42 13 9
def __init__()
in imnet_extract/Res.py
42 13 9
def __init__()
in imnet_finetune/Res.py
42 13 9
def run()
in main_extract.py
41 5 12
def run()
in main_resnet50_scratch.py
40 5 12
def run()
in main_evaluate_imnet.py
40 5 11