facebookresearch / hsd3
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 333 units with 5,598 lines of code in units (58.5% of code).
    • 9 very long units (1,681 lines of code)
    • 15 long units (1,181 lines of code)
    • 38 medium size units (1,123 lines of code)
    • 40 small units (548 lines of code)
    • 231 very small units (1,065 lines of code)
30% | 21% | 20% | 9% | 19%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py30% | 21% | 20% | 9% | 19%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
hucc/agents35% | 26% | 19% | 4% | 12%
ROOT58% | 26% | 9% | 3% | 1%
hucc/envs0% | 13% | 39% | 24% | 22%
hucc0% | 0% | 34% | 29% | 36%
hucc/models0% | 0% | 0% | 10% | 89%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def _update()
in hucc/agents/hsd3.py
305 48 1
247 1 1
def _update()
in hucc/agents/sacmt.py
223 25 1
def _update()
in hucc/agents/hsdb.py
190 33 1
def eval()
in train.py
168 51 2
def _update_hi()
in hucc/agents/hiro.py
156 8 1
def estimate_ctrlb()
in pretrain.py
144 17 1
def eval_mfdim()
in pretrain.py
133 31 2
def __init__()
in hucc/agents/hsd3.py
115 21 3
def _update()
in hucc/agents/sacse.py
100 2 1
def _update()
in hucc/agents/sac.py
97 15 1
def train_loop()
in train.py
90 16 1
def _update_lo()
in hucc/agents/hiro.py
90 6 1
def _update()
in hucc/agents/sachrl.py
88 20 1
def action()
in hucc/agents/hsd3.py
88 10 3
def action()
in hucc/agents/hsdb.py
88 10 3
def _update()
in hucc/agents/diayn.py
84 8 1
82 6 1
76 30 1
def step()
in hucc/envs/ctrlgs.py
73 29 2