facebookresearch / RTFM
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 471 units with 2,828 lines of code in units (66.7% of code).
    • 0 very complex units (0 lines of code)
    • 0 complex units (0 lines of code)
    • 10 medium complex units (407 lines of code)
    • 19 simple units (416 lines of code)
    • 442 very simple units (2,005 lines of code)
0% | 0% | 14% | 14% | 70%
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% | 0% | 14% | 14% | 70%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
ROOT0% | 0% | 53% | 19% | 26%
rtfm/tasks0% | 0% | 14% | 18% | 66%
rtfm/dynamics0% | 0% | 8% | 17% | 73%
rtfm/dynamics/monster0% | 0% | 13% | 0% | 86%
rtfm/dynamics/item/weapon0% | 0% | 8% | 0% | 91%
rtfm/dynamics/item/armour0% | 0% | 13% | 0% | 86%
core0% | 0% | 0% | 34% | 65%
rtfm0% | 0% | 0% | 33% | 66%
model0% | 0% | 0% | 0% | 100%
rtfm/dynamics/item/modifier0% | 0% | 0% | 0% | 100%
rtfm/dynamics/item0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def train()
in run_exp.py
137 23 1
def resolve_collision()
in rtfm/dynamics/world.py
18 15 3
def act()
in rtfm/dynamics/monster/hostile.py
25 15 3
def get_random()
in rtfm/dynamics/item/weapon/base_weapon.py
20 14 4
def get_random()
in rtfm/dynamics/item/armour/base_armour.py
20 14 4
def run_turn()
in rtfm/dynamics/engine.py
27 13 2
def generate_all()
in rtfm/tasks/groups.py
41 13 3
def test()
in run_exp.py
58 12 2
def act()
in run_exp.py
41 11 6
def get_wiki_extract()
in rtfm/tasks/groups.py
20 11 1
def __init__()
in core/file_writer.py
65 10 5
def log()
in core/file_writer.py
26 8 4
def learn()
in run_exp.py
63 8 7
def featurize()
in rtfm/featurizer.py
13 8 2
def lookup_sentence()
in rtfm/featurizer.py
20 8 6
def get_neighbours()
in rtfm/dynamics/world.py
11 8 3
def from_str()
in rtfm/dynamics/dice.py
20 8 2
def link()
in rtfm/dynamics/world_object.py
13 8 3
def compute_labels()
in rtfm/tasks/rock_paper_scissors.py
14 8 2
def featurize()
in rtfm/featurizer.py
33 7 4