facebookresearch / minihack
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 444 units with 4,762 lines of code in units (57.2% of code).
    • 6 very long units (885 lines of code)
    • 8 long units (604 lines of code)
    • 28 medium size units (818 lines of code)
    • 65 small units (877 lines of code)
    • 337 very small units (1,578 lines of code)
18% | 12% | 17% | 18% | 33%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py18% | 12% | 17% | 18% | 33%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
minihack/agent/polybeast/models50% | 26% | 6% | 4% | 11%
minihack/agent/polybeast58% | 0% | 14% | 16% | 9%
minihack/agent/rllib35% | 32% | 8% | 6% | 18%
minihack/scripts0% | 29% | 30% | 18% | 20%
minihack/agent/polybeast/core0% | 34% | 28% | 13% | 23%
minihack/envs0% | 0% | 15% | 28% | 55%
minihack0% | 0% | 21% | 24% | 54%
minihack/agent/common/util0% | 0% | 100% | 0% | 0%
minihack/agent/common/envs0% | 0% | 26% | 27% | 45%
minihack/tiles0% | 0% | 0% | 60% | 39%
minihack/agent/common/models0% | 0% | 0% | 12% | 87%
minihack/agent0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def train()
in minihack/agent/polybeast/polybeast_learner.py
193 6 1
def __init__()
in minihack/agent/polybeast/models/base.py
161 28 5
def __init__()
in minihack/agent/rllib/models.py
154 27 3
def forward()
in minihack/agent/polybeast/models/intrinsic.py
149 20 4
def __init__()
in minihack/agent/polybeast/models/intrinsic.py
122 22 5
def main()
in minihack/agent/polybeast/evaluate.py
106 4 0
def main()
in minihack/scripts/play.py
99 5 0
def train()
in minihack/agent/rllib/train.py
88 11 1
def forward()
in minihack/agent/polybeast/models/intrinsic.py
84 11 4
def forward()
in minihack/agent/polybeast/models/base.py
80 14 4
def __init__()
in minihack/agent/polybeast/core/file_writer.py
73 10 3
def pretty_str()
in minihack/scripts/collect_env.py
65 13 1
def __init__()
in minihack/agent/polybeast/models/intrinsic.py
62 11 5
def forward()
in minihack/agent/rllib/models.py
53 10 2
def main()
in minihack/scripts/play_gui.py
48 6 0
def process_json()
in minihack/wiki.py
47 10 2
def get_env_info()
in minihack/scripts/collect_env.py
46 5 0
def id_pairs_table()
in minihack/agent/common/util/id_pairs.py
40 14 0
def get_env_map()
in minihack/envs/minigrid.py
39 14 2
def forward()
in minihack/agent/polybeast/models/base.py
35 3 3