facebookincubator / zk
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 322 units with 3,925 lines of code in units (83.4% of code).
    • 1 very long units (104 lines of code)
    • 5 long units (312 lines of code)
    • 38 medium size units (1,136 lines of code)
    • 78 small units (1,159 lines of code)
    • 200 very small units (1,214 lines of code)
2% | 7% | 28% | 29% | 30%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go2% | 7% | 28% | 29% | 30%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
internal/proto3% | 4% | 24% | 34% | 31%
flw0% | 70% | 0% | 10% | 19%
internal/data0% | 11% | 26% | 20% | 40%
ROOT0% | 0% | 54% | 14% | 31%
integration0% | 0% | 64% | 21% | 14%
example0% | 0% | 100% | 0% | 0%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
104 29 1
68 19 1
67 24 1
65 9 1
59 6 1
53 14 1
48 13 1
46 12 1
45 16 1
45 12 1
43 12 1
42 14 1
41 8 0
39 11 1
38 9 1
38 11 1
36 12 1
35 10 1
32 11 1
31 9 1
30 9 1
29 8 1
29 10 1
28 8 1
28 8 1
27 8 1
26 9 1
26 5 1
25 7 1
25 7 1
24 8 1
23 8 1
23 8 1
23 6 1
22 5 1
21 6 1
21 6 1
21 6 1
21 7 1
21 6 1
21 6 1
21 7 1
21 6 1
21 6 2
20 5 2
20 7 1
20 7 1
20 7 1
20 5 1
20 5 1