facebookresearch / adversarially-motivated-intrinsic-goals
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 64 units with 912 lines of code in units (63.6% of code).
    • 1 very long units (172 lines of code)
    • 3 long units (197 lines of code)
    • 9 medium size units (262 lines of code)
    • 4 small units (58 lines of code)
    • 47 very small units (223 lines of code)
18% | 21% | 28% | 6% | 24%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py18% | 21% | 28% | 6% | 24%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
monobeast/minigrid28% | 32% | 21% | 2% | 15%
torchbeast/core0% | 0% | 41% | 23% | 35%
ROOT0% | 0% | 46% | 0% | 53%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def train()
in monobeast/minigrid/monobeast_amigo.py
172 25 1
def act()
in monobeast/minigrid/monobeast_amigo.py
89 20 8
def forward()
in monobeast/minigrid/monobeast_amigo.py
57 9 3
def __init__()
in monobeast/minigrid/monobeast_amigo.py
51 6 6
def __init__()
in monobeast/minigrid/monobeast_amigo.py
48 3 7
def step()
in env_utils.py
35 6 2
def forward()
in monobeast/minigrid/monobeast_amigo.py
31 4 2
def gather_metadata()
in torchbeast/core/file_writer.py
29 7 0
def get_batch()
in monobeast/minigrid/monobeast_amigo.py
28 9 7
def create_buffers()
in monobeast/minigrid/monobeast_amigo.py
25 4 6
def log()
in torchbeast/core/file_writer.py
23 8 4
def initial()
in env_utils.py
22 3 1
def step()
in torchbeast/core/environment.py
21 2 2
def reached_goal_func()
in monobeast/minigrid/monobeast_amigo.py
17 4 4
def initial()
in torchbeast/core/environment.py
15 1 1
def summary()
in torchbeast/core/prof.py
14 2 2
def time()
in torchbeast/core/prof.py
12 1 2
def from_logits()
in torchbeast/core/vtrace.py
10 1 0
def __init__()
in env_utils.py
10 1 3
def compute_policy_gradient_loss()
in monobeast/minigrid/monobeast_amigo.py
10 1 3