facebook / wangle
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,315 units with 12,587 lines of code in units (57.7% of code).
    • 1 very long units (128 lines of code)
    • 13 long units (864 lines of code)
    • 141 medium size units (4,359 lines of code)
    • 200 small units (2,841 lines of code)
    • 960 very small units (4,395 lines of code)
1% | 6% | 34% | 22% | 34%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py2% | 11% | 35% | 22% | 28%
cpp0% | 6% | 45% | 26% | 22%
h0% | 0% | 15% | 17% | 66%
c0% | 0% | 100% | 0% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
build/fbcode_builder2% | 11% | 36% | 22% | 28%
wangle/ssl0% | 9% | 39% | 27% | 23%
wangle/acceptor0% | 3% | 36% | 24% | 35%
wangle/codec0% | 23% | 51% | 14% | 11%
wangle/bootstrap0% | 0% | 37% | 16% | 45%
wangle/example0% | 0% | 31% | 26% | 41%
wangle/client0% | 0% | 30% | 27% | 41%
wangle/channel0% | 0% | 16% | 15% | 68%
wangle/util0% | 0% | 43% | 24% | 31%
build0% | 0% | 100% | 0% | 0%
wangle/service0% | 0% | 0% | 9% | 90%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
128 13 3
82 14 7
78 1 1
78 7 0
76 25 4
73 19 2
65 15 4
64 1 2
63 1 1
62 22 1
59 13 2
57 1 2
55 16 4
52 10 6
50 9 4
50 6 1
50 12 4
50 6 3
49 10 4
49 4 0
47 8 2
47 5 0
47 8 2
46 5 4
46 8 1
46 8 2
45 10 0
44 9 2
44 9 4
44 3 4
44 16 3
43 12 2
43 8 2
43 1 2
43 6 3
43 10 2
43 7 3
42 2 2
42 6 4
41 9 1
41 15 2
41 17 1
40 4 4
40 7 2
40 19 2
40 5 0
39 6 2
38 6 3
37 5 2
37 6 4