microsoft / TextWorld
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 1,021 units with 8,289 lines of code in units (78.6% of code).
    • 5 very long units (872 lines of code)
    • 5 long units (330 lines of code)
    • 63 medium size units (1,736 lines of code)
    • 144 small units (1,994 lines of code)
    • 804 very small units (3,357 lines of code)
10% | 3% | 20% | 24% | 40%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py10% | 4% | 20% | 24% | 40%
c0% | 0% | 74% | 9% | 15%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
textworld/challenges56% | 15% | 8% | 12% | 7%
textworld/render43% | 0% | 12% | 23% | 20%
textworld/generator3% | 5% | 23% | 28% | 38%
textworld/logic0% | 0% | 10% | 17% | 71%
scripts0% | 0% | 71% | 18% | 9%
textworld/envs0% | 0% | 17% | 34% | 47%
textworld0% | 0% | 28% | 28% | 42%
textworld/gym0% | 0% | 43% | 32% | 24%
src0% | 0% | 74% | 9% | 15%
benchmark0% | 0% | 47% | 34% | 18%
textworld/agents0% | 0% | 21% | 0% | 78%
textworld/textgen0% | 0% | 0% | 15% | 84%
ROOT0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def make()
in textworld/challenges/tw_cooking/cooking.py
319 116 3
def make()
in textworld/challenges/tw_simple/simple.py
199 8 3
def load_state()
in textworld/render/render.py
132 58 6
def show_graph()
in textworld/render/graph.py
120 8 4
def assign_description_to_room()
in textworld/generator/text_generation.py
102 37 3
def make_game()
in textworld/challenges/tw_treasure_hunter/treasure_hunter.py
81 10 2
def populate_room()
in textworld/generator/world.py
77 40 6
def make_game()
in textworld/challenges/tw_coin_collector/coin_collector.py
58 18 2
def generate_instruction()
in textworld/generator/text_generation.py
58 23 4
def compile_inform7_game()
in textworld/generator/inform7/world2inform7.py
56 12 3
def populate_room_with()
in textworld/generator/world.py
49 27 4
def _process_rooms()
in textworld/generator/world.py
48 21 1
def describe_event()
in textworld/generator/text_generation.py
42 6 3
def _gather_infos()
in textworld/envs/tw.py
40 12 1
def generate_name()
in textworld/generator/text_grammar.py
39 14 5
def get_webdriver()
in textworld/render/render.py
39 6 1
def benchmark()
in benchmark/benchmark.py
38 5 3
def benchmark()
in scripts/benchmark_framework.py
36 11 2
static int init_mq()
in src/glk_comm.c
36 6 1
def gen_source()
in textworld/generator/inform7/world2inform7.py
36 14 2