facebook / fboss
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 10,664 units with 123,323 lines of code in units (54.7% of code).
    • 70 very long units (11,194 lines of code)
    • 225 long units (15,080 lines of code)
    • 1,235 medium size units (37,640 lines of code)
    • 1,722 small units (25,383 lines of code)
    • 7,412 very small units (34,026 lines of code)
9% | 12% | 30% | 20% | 27%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp10% | 14% | 33% | 21% | 19%
hpp12% | 12% | 33% | 18% | 22%
h2% | 1% | 11% | 13% | 70%
py2% | 10% | 33% | 23% | 29%
c0% | 0% | 100% | 0% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
fboss/agent9% | 11% | 29% | 20% | 29%
fboss/cli12% | 10% | 36% | 18% | 21%
fboss/platform15% | 15% | 27% | 20% | 20%
fboss/util15% | 20% | 41% | 14% | 7%
fboss/qsfp_service5% | 16% | 31% | 22% | 24%
fboss/lib4% | 7% | 29% | 26% | 31%
build/fbcode_builder2% | 11% | 36% | 22% | 28%
fboss/py4% | 14% | 31% | 20% | 29%
fboss/mdio0% | 26% | 0% | 24% | 49%
fboss/fsdb0% | 0% | 25% | 41% | 32%
fboss/bcm_wrapper0% | 0% | 32% | 16% | 51%
installer/centos-7-x86_640% | 0% | 21% | 37% | 40%
common/fb3030% | 0% | 0% | 44% | 55%
fboss/mka_service0% | 0% | 0% | 0% | 100%
common/process0% | 0% | 0% | 0% | 100%
common/time0% | 0% | 0% | 0% | 100%
common/network0% | 0% | 0% | 0% | 100%
common/stats0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
431 86 2
340 1 0
316 98 4
281 98 2
262 29 4
262 31 5
255 7 0
254 42 0
237 22 2
230 65 3
226 36 2
210 12 2
204 70 3
204 45 2
201 15 2
199 52 4
194 36 3
183 32 2
172 34 1
169 20 0
169 28 2
169 50 3
168 51 3
162 42 3
160 49 3
160 10 2
159 33 4
156 16 2
152 26 3
150 13 0
148 29 0
146 1 0
140 37 2
138 14 2
135 27 2
133 20 8
132 28 2
132 42 2
132 28 3
129 22 1
129 21 6
128 6 1
128 13 3
126 28 0
126 27 2
125 31 3
122 40 4
119 21 1
118 9 0
117 8 1