microsoft / TypeScript
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 13,747 units with 175,311 lines of code in units (72.9% of code).
    • 89 very long units (17,333 lines of code)
    • 354 long units (23,830 lines of code)
    • 1,580 medium size units (48,949 lines of code)
    • 2,732 small units (39,858 lines of code)
    • 8,992 very small units (45,341 lines of code)
9% | 13% | 27% | 22% | 25%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts9% | 13% | 27% | 22% | 25%
js19% | 23% | 28% | 11% | 16%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src9% | 13% | 27% | 22% | 26%
scripts8% | 22% | 30% | 22% | 14%
ROOT0% | 0% | 100% | 0% | 0%
lib0% | 0% | 72% | 0% | 27%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
1120 208 1
1101 208 1
777 143 6
585 31 2
499 382 2
494 6 2
422 221 3
410 154 6
386 187 4
332 4 1
276 53 5
249 4 1
240 103 1
231 3 0
224 81 1
222 112 1
222 120 0
220 2 1
211 34 1
211 79 2
204 117 1
199 1 1
196 77 3
195 77 1
192 48 1
189 1 3
180 99 1
172 61 0
164 42 0
163 30 3
161 79 2
159 46 3
157 1 2
156 70 6
151 43 3
148 26 0
143 18 3
138 75 5
137 80 9
137 70 3
137 60 3
135 81 2
135 33 5
132 58 2
127 59 22
127 12 1
125 17 9
121 72 5
120 40 5
120 89 1