facebookincubator / OSM-HOT-Tasking-Manager
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 1,277 units with 24,502 lines of code in units (49.7% of code).
    • 31 very long units (7,536 lines of code)
    • 41 long units (2,981 lines of code)
    • 211 medium size units (6,477 lines of code)
    • 255 small units (3,724 lines of code)
    • 739 very small units (3,784 lines of code)
30% | 12% | 26% | 15% | 15%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js44% | 16% | 21% | 9% | 7%
py14% | 6% | 32% | 21% | 23%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
frontend/src44% | 16% | 21% | 9% | 7%
backend91% | 0% | 3% | 2% | 2%
migrations/versions22% | 9% | 31% | 15% | 20%
backend/services10% | 9% | 32% | 18% | 29%
backend/models11% | 7% | 21% | 20% | 39%
backend/api0% | 1% | 50% | 37% | 10%
migrations0% | 0% | 71% | 0% | 28%
ROOT0% | 0% | 0% | 71% | 28%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
686 1 484
663 1 487
609 1 1
585 1 421
433 1 322
355 1 259
342 50 6
293 1 217
251 22 1
251 45 3
234 14 0
227 17 13
213 1 154
190 1 142
166 1 121
158 13 1
151 1 0
151 1 106
150 1 112
142 22 12
133 48 2
128 1 94
122 15 1
118 10 1
118 8 1
116 11 10
114 11 1
114 4 1
110 36 2
109 1 0
104 7 0
100 9 4
99 17 2
97 5 10
95 12 7
94 1 70
94 1 70
94 16 1
85 19 1
84 4 7
83 5 2
81 10 1
76 6 0
75 10 0
75 6 7
75 4 4
75 4 1
74 1 55
73 6 0
72 1 52