amazon-research / exponential-moving-average-normalization
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 149 units with 2,285 lines of code in units (78.1% of code).
    • 5 very long units (750 lines of code)
    • 2 long units (145 lines of code)
    • 17 medium size units (517 lines of code)
    • 32 small units (453 lines of code)
    • 93 very small units (420 lines of code)
32% | 6% | 22% | 19% | 18%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py32% | 6% | 22% | 19% | 18%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT57% | 11% | 21% | 8% | 1%
data0% | 0% | 21% | 26% | 52%
backbone0% | 0% | 33% | 53% | 12%
utils0% | 0% | 27% | 26% | 46%
models0% | 0% | 19% | 39% | 41%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main_worker()
in main_fixmatch.py
170 23 3
def main_worker()
in main_cls.py
169 14 3
def main_worker()
in main_lincls.py
142 49 3
def main_worker()
in main_byol.py
136 36 3
def main_worker()
in main_moco.py
133 38 3
def train()
in main_fixmatch.py
84 14 6
def ss_validate()
in engine.py
61 8 4
def train()
in main_byol.py
46 10 5
def __init__()
in backbone/resnet.py
42 13 9
def train()
in main_moco.py
42 9 6
def get_augmentations()
in data/transforms.py
41 6 1
def step()
in utils/LARS.py
40 10 2
def train()
in main_cls.py
35 8 6
def train()
in main_lincls.py
32 6 6
def get_byol_tranforms()
in data/transforms.py
30 1 0
def validate()
in engine.py
29 5 4
def main()
in main_cls.py
26 8 0
def main()
in main_lincls.py
24 7 0
def __init__()
in utils/LARS.py
23 9 8
def forward()
in models/moco.py
23 7 3