facebookincubator / Glean
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 996 units with 8,832 lines of code in units (13.1% of code).
    • 5 very long units (810 lines of code)
    • 12 long units (737 lines of code)
    • 68 medium size units (2,064 lines of code)
    • 129 small units (1,920 lines of code)
    • 782 very small units (3,301 lines of code)
9% | 8% | 23% | 21% | 37%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp11% | 9% | 25% | 24% | 29%
h0% | 3% | 6% | 11% | 78%
rs0% | 0% | 100% | 0% | 0%
py0% | 0% | 0% | 69% | 30%
js0% | 0% | 0% | 56% | 44%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
glean/lang18% | 5% | 22% | 27% | 26%
glean/rts8% | 10% | 21% | 17% | 43%
glean/rocksdb0% | 13% | 27% | 25% | 32%
glean/config0% | 0% | 100% | 0% | 0%
glean/tools0% | 0% | 54% | 31% | 14%
glean/interprocess0% | 0% | 15% | 34% | 49%
glean/cpp0% | 0% | 9% | 29% | 61%
glean/website0% | 0% | 0% | 56% | 44%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
301 41 1
162 18 13
130 26 2
109 22 3
108 34 3
76 6 1
73 9 4
68 17 2
67 14 4
65 7 1
61 10 6
59 12 3
57 5 2
53 12 5
53 9 2
53 17 1
52 9 2
49 7 1
49 6 1
47 2 11
47 18 2
46 13 4
46 8 4
46 12 2
44 7 3
43 2 0
42 2 0
42 2 0
42 2 0
41 7 5
38 5 2
37 6 2
37 6 4
36 13 2
35 6 1
35 9 1
34 11 1
33 5 4
33 3 3
33 5 2
31 3 1
31 8 2
31 10 1
30 4 3
30 7 1
29 3 3
29 9 2
28 2 2
27 11 1
27 9 1