Unit Size Overall
  • There are 5,199 units with 128,823 lines of code in units (53.1% of code).
    • 188 very long units (36,291 lines of code)
    • 378 long units (25,413 lines of code)
    • 1,151 medium size units (36,886 lines of code)
    • 1,190 small units (17,786 lines of code)
    • 2,292 very small units (12,447 lines of code)
28% | 19% | 28% | 13% | 9%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts25% | 19% | 29% | 14% | 10%
tsx57% | 9% | 19% | 6% | 5%
js26% | 30% | 27% | 11% | 4%
py17% | 15% | 21% | 22% | 24%
cs65% | 21% | 0% | 3% | 8%
cjs11% | 49% | 31% | 5% | 3%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
packages29% | 19% | 27% | 13% | 9%
scripts20% | 22% | 36% | 15% | 6%
tools11% | 31% | 22% | 16% | 18%
evals5% | 12% | 40% | 31% | 9%
sea62% | 0% | 27% | 5% | 4%
.github0% | 53% | 39% | 4% | 2%
.gemini0% | 0% | 67% | 32% | 0%
ROOT0% | 0% | 46% | 0% | 53%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
1461 246 2
1074 210 2
930 68 12
749 146 4
566 126 1
559 105 2
474 56 0
429 79 0
409 58 2
396 20 1
368 40 1
357 73 9
344 94 3
342 68 8
339 2 2
336 35 4
334 117 1
332 59 1
297 49 6
284 49 7
283 36 1
281 62 5
278 40 4
273 1 2
269 1 2
267 42 9
266 30 2
266 46 4
266 31 7
257 47 1
251 36 3
250 31 1
244 16 5
243 37 8
236 40 0
234 54 1
231 51 1
227 33 7
226 34 2
220 27 6
213 36 6
213 20 7
210 38 3
206 57 1
206 30 7
206 34 1
205 52 4
205 26 1
201 46 3
201 35 5
About This Analysis
  • 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...
  • To learn more about unit size, the Sokrates recommends the following resources:
    • Function Length, MartinFowler.com
      • "If you have to spend effort into looking at a fragment of code to figure out what it's doing, then you should extract it into a function and name the function after that 'what'."
    • Stack Overflow Discussion on Unit Size, stackoverflow.com
      • "Use common sense, stick to small function sizes in most instances but don't be dogmatic about it if you have a genuinely good reason to make an unusually big function."
    • Coding Smells, codinghorror.com
      • "All other things being equal, a shorter method is easier to read, easier to understand, and easier to troubleshoot. Refactor long methods into smaller methods if you can."
    • Clean Code: A Handbook of Agile Software Craftsmanship, by Robert Martin
      • "The first rule of functions is that they should be small. The second rule of functions is that they should be smaller than that. Functions should not be 100 lines long. Functions should hardly ever be 20 lines long."