facebookincubator / reindeer
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 606 units with 6,486 lines of code in units (50.7% of code).
    • 2 very long units (402 lines of code)
    • 10 long units (682 lines of code)
    • 71 medium size units (2,196 lines of code)
    • 100 small units (1,416 lines of code)
    • 423 very small units (1,790 lines of code)
6% | 10% | 33% | 21% | 27%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
rs25% | 6% | 23% | 19% | 25%
py2% | 11% | 35% | 22% | 28%
c0% | 0% | 100% | 0% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src27% | 7% | 21% | 18% | 25%
build/fbcode_builder7% | 23% | 29% | 16% | 21%
build/fbcode_builder/getdeps0% | 4% | 38% | 25% | 31%
build/fbcode_builder/CMake0% | 9% | 41% | 20% | 28%
src/fixups0% | 0% | 39% | 39% | 20%
example/project0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
274 28 3
128 13 3
78 1 1
78 7 0
76 25 4
76 11 3
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
44 16 3
43 1 2
43 6 3
43 10 2
43 7 3
43 2 0
41 9 1
41 15 2
41 17 1
40 19 2
40 5 0
38 6 3
37 6 3
37 17 5
36 1 2
34 9 3
33 1 1
33 2 1
33 4 3
32 3 1
32 4 3
31 4 1
31 12 3
31 11 4
31 11 2
31 3 2
30 4 1
30 5 4
29 9 2
29 10 3
29 3 1
29 6 3
28 1 0