facebook / fb303
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 981 units with 8,814 lines of code in units (56.5% of code).
    • 2 very long units (236 lines of code)
    • 9 long units (606 lines of code)
    • 85 medium size units (2,634 lines of code)
    • 138 small units (1,951 lines of code)
    • 747 very small units (3,387 lines of code)
2% | 6% | 29% | 22% | 38%
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%
cpp7% | 0% | 27% | 31% | 33%
h0% | 0% | 12% | 14% | 72%
c0% | 0% | 100% | 0% | 0%
rs0% | 0% | 100% | 0% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
build/fbcode_builder7% | 23% | 29% | 16% | 21%
fb3033% | 0% | 15% | 22% | 58%
build/fbcode_builder/getdeps0% | 4% | 38% | 25% | 31%
build/fbcode_builder/CMake0% | 9% | 41% | 20% | 28%
fb303/detail0% | 0% | 62% | 13% | 24%
fb303/thrift0% | 0% | 100% | 0% | 0%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
128 13 3
108 9 3
78 1 1
78 7 0
76 25 4
73 19 2
64 1 2
63 1 1
62 22 1
57 1 2
55 16 4
50 12 4
50 6 3
47 5 0
47 8 2
46 8 2
45 10 2
45 10 6
44 16 3
43 1 2
43 6 3
43 10 2
43 7 3
42 2 0
41 9 1
41 15 2
41 17 1
40 19 2
40 5 0
40 10 2
38 6 3
38 6 4
37 6 3
37 17 5
36 1 2
36 7 1
34 9 3
34 7 3
33 1 1
33 2 1
33 4 3
33 11 3
32 3 1
32 4 3
31 4 1
31 12 3
31 11 4
31 11 2
31 6 3
30 4 1