facebookincubator / below
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 521 units with 10,098 lines of code in units (49.6% of code).
    • 6 very long units (818 lines of code)
    • 36 long units (2,409 lines of code)
    • 109 medium size units (3,444 lines of code)
    • 157 small units (2,323 lines of code)
    • 213 very small units (1,104 lines of code)
8% | 23% | 34% | 23% | 10%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
rs8% | 24% | 33% | 23% | 10%
c0% | 0% | 100% | 0% | 0%
py0% | 0% | 0% | 51% | 48%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
below/src28% | 39% | 16% | 13% | 1%
below/store9% | 15% | 45% | 20% | 9%
below/view9% | 0% | 50% | 21% | 18%
below/dump5% | 60% | 24% | 7% | 1%
below/model0% | 26% | 29% | 27% | 16%
below/common0% | 31% | 5% | 26% | 37%
below/below_derive0% | 32% | 0% | 36% | 30%
below/procfs0% | 0% | 56% | 40% | 3%
below/render0% | 0% | 39% | 53% | 7%
below/config0% | 0% | 72% | 22% | 5%
below/cgroupfs0% | 0% | 17% | 57% | 24%
scripts0% | 0% | 0% | 51% | 48%
below0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
222 1 1
159 15 14
130 1 0
104 7 0
102 3 2
101 1 0
100 12 6
99 13 3
93 8 5
92 9 6
90 8 6
84 5 2
80 2 2
78 5 0
76 2 6
76 1 3
76 1 0
75 2 9
74 1 0
71 19 2
70 8 5
65 1 0
65 3 8
63 1 0
61 3 6
58 3 4
58 5 5
57 1 0
56 5 0
56 5 0
56 2 0
55 5 0
55 3 6
55 3 6
53 1 1
53 2 0
53 3 0
52 1 0
51 4 0
51 2 6
51 3 0
51 8 1
49 1 2
49 7 2
48 9 2
47 1 0
46 1 2
46 5 2
45 1 0
45 1 1