facebookresearch / clutrr
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 142 units with 1,722 lines of code in units (79.1% of code).
    • 1 very long units (150 lines of code)
    • 3 long units (167 lines of code)
    • 20 medium size units (579 lines of code)
    • 28 small units (389 lines of code)
    • 90 very small units (437 lines of code)
8% | 9% | 33% | 22% | 25%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py8% | 9% | 33% | 22% | 25%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
clutrr28% | 21% | 34% | 4% | 10%
clutrr/relations0% | 8% | 29% | 30% | 32%
clutrr/utils0% | 0% | 34% | 28% | 37%
clutrr/actors0% | 0% | 47% | 28% | 23%
clutrr/store0% | 0% | 0% | 100% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def generate_rows()
in clutrr/generator.py
150 47 5
def extract_placeholder()
in clutrr/template_mturk.py
60 1 1
def add_facts_to_puzzle()
in clutrr/relations/builder.py
55 27 2
def store()
in clutrr/main.py
52 12 4
def generate_webpage()
in clutrr/utils/web.py
48 7 1
def generate_text()
in clutrr/relations/puzzle.py
41 31 5
def get_args()
in clutrr/args.py
41 3 1
def generate()
in clutrr/main.py
35 3 7
def add_work_relations()
in clutrr/actors/ancestry.py
34 10 2
def main()
in clutrr/template_mturk.py
33 10 0
def display()
in clutrr/relations/puzzle.py
31 2 1
def __init__()
in clutrr/relations/puzzle.py
30 3 8
def info_job()
in clutrr/utils/data_backend.py
28 4 0
def setup()
in clutrr/main.py
28 5 1
def get_peer()
in clutrr/utils/data_backend.py
27 9 3
def upload()
in clutrr/utils/data_backend.py
25 10 3
def next_flip()
in clutrr/actors/ancestry.py
25 8 1
def run_task()
in clutrr/main.py
24 7 1
def __init__()
in clutrr/relations/builder.py
23 1 4
def simulate()
in clutrr/actors/ancestry.py
22 9 1