Unit Size Overall
  • There are 2,679 units with 54,702 lines of code in units (61.5% of code).
    • 64 very long units (12,081 lines of code)
    • 161 long units (11,034 lines of code)
    • 479 medium size units (14,780 lines of code)
    • 659 small units (9,741 lines of code)
    • 1,316 very small units (7,066 lines of code)
22% | 20% | 27% | 17% | 12%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts22% | 20% | 28% | 17% | 10%
py16% | 17% | 22% | 19% | 23%
tsx48% | 35% | 5% | 5% | 5%
cjs0% | 87% | 0% | 0% | 12%
rs0% | 0% | 0% | 48% | 51%
js0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
sdk23% | 22% | 26% | 16% | 10%
plugins20% | 16% | 27% | 19% | 15%
github-action0% | 26% | 23% | 27% | 23%
evals0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
902 109 0
769 137 4
413 99 4
372 82 3
351 83 3
329 68 3
323 6 1
309 60 2
305 63 5
251 38 0
244 45 2
231 47 1
225 75 1
223 24 1
221 73 0
219 56 3
206 36 1
204 80 2
203 16 1
193 46 3
188 62 3
180 57 1
173 32 1
172 24 2
168 29 1
166 26 1
160 39 2
158 33 7
144 51 1
140 17 2
138 34 2
137 29 2
134 25 0
132 22 1
130 35 1
129 27 3
128 33 9
127 30 1
124 14 9
124 19 2
124 23 2
123 57 2
123 24 2
117 26 2
117 18 3
115 11 2
113 19 2
112 38 2
112 18 4
111 15 1
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."