facebookresearch / impact-driven-exploration
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 406 units with 5,297 lines of code in units (77.9% of code).
    • 8 very long units (1,310 lines of code)
    • 9 long units (655 lines of code)
    • 41 medium size units (1,304 lines of code)
    • 53 small units (737 lines of code)
    • 295 very small units (1,291 lines of code)
24% | 12% | 24% | 13% | 24%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py24% | 12% | 24% | 13% | 24%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/algos74% | 22% | 2% | 0% | 0%
gym-minigrid/gym_minigrid/envs0% | 9% | 32% | 19% | 38%
src0% | 8% | 41% | 16% | 33%
src/core0% | 21% | 51% | 10% | 17%
gym-minigrid/gym_minigrid0% | 0% | 29% | 28% | 41%
gym-minigrid0% | 0% | 59% | 0% | 40%
ROOT0% | 0% | 0% | 100% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def train()
in src/algos/ride.py
200 26 1
def train()
in src/algos/curiosity.py
198 27 1
def train()
in src/algos/no_episodic_counts.py
189 24 1
def train()
in src/algos/rnd.py
173 27 1
def train()
in src/algos/count.py
154 25 1
def train()
in src/algos/only_episodic_counts.py
148 23 1
def train()
in src/algos/torchbeast.py
144 23 1
def learn()
in src/algos/curiosity.py
104 8 15
def learn()
in src/algos/ride.py
100 5 15
def learn()
in src/algos/no_episodic_counts.py
92 4 15
def act()
in src/utils.py
83 16 9
def learn()
in src/algos/rnd.py
81 5 12
def learn()
in src/algos/only_episodic_counts.py
67 4 9
def learn()
in src/algos/count.py
62 4 8
def _gen_grid()
in gym-minigrid/gym_minigrid/envs/lockedroom.py
60 12 3
def __init__()
in src/core/file_writer.py
56 9 4
def _gen_grid()
in gym-minigrid/gym_minigrid/envs/multiroom_noisytv.py
54 10 3
def learn()
in src/algos/torchbeast.py
50 3 8
def _gen_grid()
in gym-minigrid/gym_minigrid/envs/multiroom.py
46 9 3
def _gen_grid()
in gym-minigrid/gym_minigrid/envs/putnear.py
46 13 3