hhvm / hack-codegen
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 441 units with 3,255 lines of code in units (84.5% of code).
    • 0 very long units (0 lines of code)
    • 3 long units (209 lines of code)
    • 17 medium size units (529 lines of code)
    • 39 small units (565 lines of code)
    • 382 very small units (1,952 lines of code)
0% | 6% | 16% | 17% | 59%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
hack0% | 6% | 16% | 17% | 59%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src0% | 4% | 17% | 19% | 58%
src/_Private0% | 48% | 0% | 0% | 51%
src/key-value-render0% | 0% | 11% | 9% | 78%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
81 20 2
66 15 0
62 14 0
48 9 1
41 9 4
38 4 2
37 8 1
35 9 2
34 6 1
33 6 3
32 4 3
32 3 2
28 7 2
27 1 2
26 8 0
26 5 1
24 5 3
24 5 1
22 12 1
22 12 1
20 3 0
20 5 1
19 2 1
18 1 1
18 1 1
18 3 0
18 5 1
17 3 3
17 3 0
17 3 1
17 2 1
15 4 0
15 3 1
15 3 2
15 3 2
15 5 1
15 1 1
14 5 1
14 5 2
14 2 1
14 3 1
14 2 1
14 1 2
14 6 0
14 5 0
13 2 2
13 1 1
13 3 2
13 1 2
12 4 1