facebook / flipper
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 3,474 units with 46,784 lines of code in units (47.9% of code).
    • 31 very long units (5,095 lines of code)
    • 126 long units (8,458 lines of code)
    • 428 medium size units (13,040 lines of code)
    • 675 small units (9,825 lines of code)
    • 2,214 very small units (10,366 lines of code)
10% | 18% | 27% | 21% | 22%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
tsx12% | 19% | 30% | 20% | 17%
java6% | 9% | 25% | 22% | 35%
cpp11% | 17% | 15% | 34% | 19%
js36% | 21% | 8% | 12% | 21%
mm0% | 49% | 10% | 20% | 19%
ts0% | 52% | 17% | 0% | 30%
rs0% | 31% | 38% | 11% | 17%
m0% | 0% | 39% | 41% | 19%
swift0% | 0% | 18% | 25% | 56%
h0% | 0% | 0% | 11% | 88%
kt0% | 0% | 0% | 41% | 58%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
desktop/flipper-ui-core14% | 25% | 26% | 18% | 14%
desktop/flipper-plugin17% | 14% | 29% | 19% | 18%
desktop/plugins16% | 14% | 33% | 20% | 15%
android/src5% | 7% | 25% | 24% | 37%
xplat/Flipper20% | 16% | 14% | 28% | 19%
android/plugins14% | 17% | 17% | 28% | 21%
desktop/app22% | 8% | 21% | 18% | 29%
website/src44% | 25% | 10% | 10% | 7%
desktop/flipper-dump70% | 0% | 0% | 6% | 22%
desktop/flipper-ui-browser29% | 0% | 7% | 20% | 42%
desktop/flipper-server-core0% | 16% | 35% | 25% | 22%
desktop/scripts0% | 21% | 44% | 15% | 18%
desktop/pkg0% | 41% | 32% | 9% | 16%
desktop/pkg-lib0% | 70% | 18% | 5% | 5%
desktop/doctor0% | 46% | 25% | 16% | 10%
desktop/flipper-server0% | 29% | 44% | 10% | 14%
iOS/FlipperKit0% | 43% | 23% | 5% | 26%
xplat/FlipperWebSocket0% | 28% | 24% | 25% | 22%
packer/src0% | 31% | 38% | 11% | 17%
desktop/plugin-lib0% | 19% | 42% | 22% | 15%
js/js-flipper0% | 37% | 22% | 0% | 40%
android/sample0% | 16% | 29% | 20% | 32%
desktop/static0% | 54% | 15% | 23% | 6%
website0% | 75% | 0% | 0% | 24%
desktop/babel-transformer0% | 12% | 33% | 34% | 19%
iOS/Plugins0% | 33% | 0% | 36% | 30%
desktop/flipper-common0% | 0% | 28% | 47% | 23%
desktop/eslint-plugin-flipper0% | 0% | 19% | 64% | 15%
react-native/ReactNativeFlipperExample0% | 0% | 37% | 30% | 32%
react-native/react-native-flipper0% | 0% | 11% | 25% | 63%
iOS/Tutorial0% | 0% | 31% | 15% | 52%
android/tutorial0% | 0% | 0% | 63% | 36%
iOS/SampleSwift0% | 0% | 0% | 38% | 61%
xplat/FlipperTestLib0% | 0% | 0% | 19% | 80%
js/react-flipper-example0% | 0% | 0% | 73% | 26%
PortForwardingMacApp0% | 0% | 0% | 86% | 13%
website/static0% | 0% | 0% | 56% | 44%
libs/jni-hack0% | 0% | 0% | 0% | 100%
android/no-op0% | 0% | 0% | 0% | 100%
desktop/test-utils0% | 0% | 0% | 0% | 100%
xplat/FlipperTests0% | 0% | 0% | 0% | 100%
iOS/Sample0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
356 41 0
311 33 1
296 11 0
267 43 17
221 20 1
214 27 1
209 45 2
184 13 0
180 15 1
174 49 4
168 5 3
166 5 1
158 19 3
158 18 1
148 14 7
147 18 1
140 15 2
139 5 0
136 20 13
129 17 3
129 16 0
123 15 3
111 7 1
108 8 0
107 18 2
104 6 7
104 9 0
104 14 1
102 4 3
101 22 1
101 12 1
99 13 6
99 15 2
98 22 1
97 5 0
97 11 1
97 21 2
93 12 0
93 15 3
92 19 2
92 12 5
92 18 3
90 11 0
90 9 2
89 4 0
89 7 0
87 9 1
86 10 0
85 8 1
84 3 3