Unit Size Overall
  • There are 5,340 units with 86,670 lines of code in units (46.8% of code).
    • 84 very long units (14,179 lines of code)
    • 252 long units (17,794 lines of code)
    • 787 medium size units (23,817 lines of code)
    • 997 small units (14,719 lines of code)
    • 3,220 very small units (16,161 lines of code)
16% | 20% | 27% | 16% | 18%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py16% | 22% | 26% | 16% | 18%
js11% | 13% | 32% | 21% | 20%
tsx29% | 18% | 25% | 11% | 13%
cjs27% | 12% | 21% | 21% | 18%
ts0% | 3% | 39% | 23% | 33%
swift0% | 0% | 44% | 37% | 18%
smk0% | 0% | 0% | 86% | 13%
pl0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
plugins16% | 20% | 27% | 17% | 18%
.agents0% | 27% | 45% | 0% | 27%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
673 1 0
408 77 0
402 31 1
380 112 2
370 101 1
350 55 2
300 5 1
265 33 1
262 15 1
245 11 1
238 48 0
236 62 10
232 25 0
226 56 3
225 61 1
225 65 0
219 29 2
214 38 1
212 11 4
204 10 3
203 38 1
200 72 2
178 24 12
176 19 3
170 13 3
168 45 1
165 9 1
165 24 0
163 28 1
158 1 0
158 17 4
156 15 2
150 49 1
148 18 0
144 42 1
141 27 1
139 28 2
139 21 0
138 1 0
136 33 1
135 23 0
135 20 0
134 38 2
134 25 2
131 45 2
131 1 0
131 25 1
130 22 4
129 4 3
127 9 3
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."