facebookresearch / level-replay
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 167 units with 1,595 lines of code in units (73.3% of code).
    • 1 very long units (179 lines of code)
    • 2 long units (120 lines of code)
    • 14 medium size units (453 lines of code)
    • 24 small units (333 lines of code)
    • 126 very small units (510 lines of code)
11% | 7% | 28% | 20% | 31%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py11% | 7% | 28% | 20% | 31%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT58% | 39% | 0% | 0% | 1%
level_replay0% | 0% | 38% | 24% | 37%
level_replay/algo0% | 0% | 70% | 29% | 0%
custom_envs0% | 0% | 0% | 34% | 65%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def train()
in train.py
179 36 2
63 10 9
def evaluate()
in test.py
57 11 11
def recurrent_generator()
in level_replay/storage.py
50 3 3
def update()
in level_replay/algo/ppo.py
48 4 2
def make_lr_venv()
in level_replay/envs.py
41 6 5
def _update_with_rollouts()
in level_replay/level_sampler.py
39 9 3
def feed_forward_generator()
in level_replay/storage.py
35 4 4
def gather_metadata()
in level_replay/file_writer.py
33 8 0
def _forward_gru()
in level_replay/model.py
33 2 4
def __init__()
in level_replay/model.py
30 3 5
def __init__()
in level_replay/level_sampler.py
26 3 16
def sample()
in level_replay/level_sampler.py
24 11 2
def _score_transform()
in level_replay/level_sampler.py
24 8 4
def forward()
in level_replay/model.py
24 4 2
def log()
in level_replay/file_writer.py
23 8 4
def __init__()
in level_replay/storage.py
23 4 7
def __init__()
in level_replay/algo/ppo.py
20 1 11
def update_with_rollouts()
in level_replay/level_sampler.py
18 8 2
def __init__()
in custom_envs/obstructedmaze_gamut.py
18 1 4