facebook / hermes
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 9,216 units with 117,993 lines of code in units (52.9% of code).
    • 97 very long units (20,860 lines of code)
    • 273 long units (18,810 lines of code)
    • 912 medium size units (28,674 lines of code)
    • 1,382 small units (20,346 lines of code)
    • 6,552 very small units (29,303 lines of code)
17% | 15% | 24% | 17% | 24%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp20% | 19% | 27% | 16% | 15%
rs44% | 16% | 16% | 10% | 12%
js7% | 11% | 29% | 24% | 26%
java16% | 14% | 23% | 27% | 18%
py15% | 10% | 35% | 18% | 19%
h<1% | 1% | 5% | 16% | 75%
mm0% | 31% | 21% | 33% | 14%
inc0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
lib19% | 20% | 27% | 16% | 15%
unsupported44% | 16% | 16% | 9% | 12%
tools11% | 13% | 30% | 21% | 21%
API14% | 10% | 14% | 15% | 45%
utils24% | 15% | 30% | 18% | 11%
include<1% | <1% | 5% | 17% | 74%
unittests0% | 7% | 21% | 22% | 49%
website0% | 28% | 0% | 46% | 24%
lldb0% | 0% | 40% | 20% | 40%
npm0% | 0% | 29% | 15% | 54%
public0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
2696 235 1
2433 238 2
517 87 5
439 105 1
402 118 2
360 62 1
317 4 2
304 69 5
290 2 1
287 40 2
281 1 1
273 1 1
257 1 1
251 66 2
248 66 6
240 1 1
234 67 6
232 61 4
222 24 2
216 34 1
210 2 0
210 71 1
192 17 2
189 2 0
189 41 0
187 37 0
184 52 0
183 58 2
181 33 3
179 8 5
171 40 3
170 45 6
165 6 0
162 3 1
161 32 2
161 28 3
157 37 0
157 51 1
155 26 1
154 49 4
144 39 6
141 1 1
139 1 1
136 35 3
135 40 1
135 39 1
134 35 1
133 26 1
133 44 0
133 15 2