facebookresearch / minihack
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 444 units with 4,762 lines of code in units (57.2% of code).
    • 0 very complex units (0 lines of code)
    • 2 complex units (315 lines of code)
    • 11 medium complex units (775 lines of code)
    • 24 simple units (837 lines of code)
    • 407 very simple units (2,835 lines of code)
0% | 6% | 16% | 17% | 59%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
py0% | 6% | 16% | 17% | 59%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
minihack/agent/polybeast/models0% | 18% | 58% | 2% | 20%
minihack/agent/rllib0% | 35% | 20% | 14% | 30%
minihack/scripts0% | 0% | 20% | 17% | 62%
minihack/agent/common/util0% | 0% | 58% | 41% | 0%
minihack/envs0% | 0% | 3% | 4% | 91%
minihack/agent/polybeast0% | 0% | 0% | 48% | 51%
minihack0% | 0% | 0% | 21% | 78%
minihack/agent/polybeast/core0% | 0% | 0% | 62% | 37%
minihack/agent/common/envs0% | 0% | 0% | 26% | 73%
minihack/agent/common/models0% | 0% | 0% | 8% | 91%
minihack/tiles0% | 0% | 0% | 0% | 100%
minihack/agent0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def __init__()
in minihack/agent/polybeast/models/base.py
161 28 5
def __init__()
in minihack/agent/rllib/models.py
154 27 3
def __init__()
in minihack/agent/polybeast/models/intrinsic.py
122 22 5
def forward()
in minihack/agent/polybeast/models/intrinsic.py
149 20 4
def get_cudnn_version()
in minihack/scripts/collect_env.py
25 16 1
def forward()
in minihack/agent/polybeast/models/base.py
80 14 4
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 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/polybeast/models/intrinsic.py
84 11 4
def train()
in minihack/agent/rllib/train.py
88 11 1
def get_pip_packages()
in minihack/scripts/collect_env.py
21 11 1
def __init__()
in minihack/agent/polybeast/core/file_writer.py
73 10 3
def main()
in minihack/agent/polybeast/polyhydra.py
32 10 1
def id_pairs_func()
in minihack/agent/common/util/id_pairs.py
28 10 1
def forward()
in minihack/agent/rllib/models.py
53 10 2
def process_json()
in minihack/wiki.py
47 10 2
def gather_metadata()
in minihack/agent/polybeast/core/file_writer.py
33 9 0
def add_monster()
in minihack/level_generator.py
23 9 5