facebook / componentkit
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 988 units with 9,660 lines of code in units (19.0% of code).
    • 8 very long units (1,970 lines of code)
    • 12 long units (785 lines of code)
    • 45 medium size units (1,454 lines of code)
    • 145 small units (2,091 lines of code)
    • 778 very small units (3,360 lines of code)
20% | 8% | 15% | 21% | 34%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
h40% | 8% | 9% | 9% | 32%
mm4% | 8% | 19% | 31% | 35%
swift0% | 0% | 10% | 33% | 55%
m0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ComponentKit27% | 9% | 18% | 20% | 24%
RenderCore6% | 7% | 10% | 21% | 54%
CKSwiftTests0% | 0% | 20% | 38% | 40%
ComponentTextKit0% | 0% | 5% | 34% | 59%
ComponentKitTests0% | 0% | 0% | 24% | 75%
CKSwift0% | 0% | 0% | 28% | 71%
ComponentKitTestHelpers0% | 0% | 0% | 26% | 73%
ComponentKitApplicationTests0% | 0% | 0% | 0% | 100%
ComponentKitPerfTests0% | 0% | 0% | 0% | 100%
ComponentTextKitApplicationTests0% | 0% | 0% | 0% | 100%
ComponentKitApplicationTestsHost0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
638 23 1
330 3 1
243 1 1
228 1 1
175 8 1
132 29 3
114 1 1
110 19 3
92 1 1
79 8 13
76 3 1
66 22 2
64 2 1
61 21 3
61 7 5
61 10 6
59 9 9
57 1 1
55 4 1
54 3 3
46 4 1
46 6 2
46 2 1
45 6 7
45 2 1
44 3 3
42 10 5
39 2 2
39 2 1
38 8 3
37 9 4
37 5 2
37 2 1
36 6 1
36 8 2
35 4 2
35 1 1
35 3 1
34 8 0
34 6 3
34 5 2
34 8 2
34 5 2
32 4 6
31 6 2
31 8 1
30 10 1
30 1 2
29 8 5
28 9 8