Unit Size Overall
  • There are 5,415 units with 92,342 lines of code in units (67.3% of code).
    • 64 very long units (11,147 lines of code)
    • 225 long units (15,257 lines of code)
    • 927 medium size units (28,787 lines of code)
    • 1,425 small units (21,185 lines of code)
    • 2,774 very small units (15,966 lines of code)
12% | 16% | 31% | 22% | 17%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts12% | 16% | 31% | 22% | 17%
py10% | 14% | 31% | 17% | 27%
js0% | 0% | 0% | 70% | 30%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
packages12% | 16% | 31% | 22% | 17%
.agents8% | 16% | 30% | 20% | 24%
helpers0% | 0% | 57% | 35% | 7%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
749 119 1
499 69 1
408 65 1
375 67 6
369 68 1
339 53 11
289 57 1
271 39 8
269 47 1
268 17 1
260 49 8
226 52 3
223 45 1
193 22 1
179 17 1
177 49 2
171 15 2
162 23 1
160 29 1
160 35 3
155 35 5
154 12 2
153 27 6
151 39 4
150 47 1
146 51 1
143 28 1
140 18 1
134 12 1
133 29 1
133 26 2
133 5 0
132 28 1
132 23 1
132 14 1
130 26 1
129 11 6
127 19 2
127 23 4
125 36 4
122 12 2
121 28 3
121 20 1
119 18 1
118 19 1
116 28 1
116 20 2
115 39 3
113 13 6
112 13 2
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."