Unit Size Overall
  • There are 21,146 units with 229,605 lines of code in units (72.8% of code).
    • 84 very long units (13,056 lines of code)
    • 387 long units (26,268 lines of code)
    • 2,162 medium size units (65,510 lines of code)
    • 3,679 small units (52,984 lines of code)
    • 14,834 very small units (71,787 lines of code)
5% | 11% | 28% | 23% | 31%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
scala7% | 12% | 29% | 22% | 27%
py1% | 7% | 22% | 26% | 43%
java<1% | 7% | 26% | 22% | 42%
js0% | 11% | 26% | 26% | 36%
c0% | 0% | 0% | 100% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
sql7% | 12% | 29% | 21% | 28%
core7% | 10% | 29% | 23% | 29%
mllib5% | 12% | 29% | 24% | 27%
resource-managers5% | 18% | 37% | 19% | 20%
python1% | 6% | 22% | 26% | 43%
streaming1% | 7% | 27% | 24% | 39%
graphx5% | 5% | 22% | 33% | 33%
common0% | 5% | 24% | 23% | 46%
launcher0% | 18% | 31% | 22% | 27%
mllib-local0% | 19% | 39% | 25% | 16%
dev0% | 22% | 19% | 22% | 36%
repl0% | 35% | 20% | 29% | 14%
project0% | 0% | 27% | 32% | 40%
tools0% | 0% | 43% | 17% | 38%
R0% | 0% | 0% | 100% | 0%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
608 105 4
413 138 2
387 88 1
374 147 1
371 22 1
306 79 2
271 65 1
249 81 1
238 51 0
218 24 1
214 105 2
213 32 0
211 77 3
204 31 0
199 11 3
197 31 5
182 40 2
175 56 4
165 19 12
164 22 2
153 5 0
153 29 1
149 59 2
147 13 2
147 31 1
146 26 1
146 35 2
142 16 1
142 21 0
140 33 2
139 15 2
138 16 10
137 46 1
137 32 1
134 3 1
133 20 1
131 11 2
129 14 1
128 33 3
127 45 2
126 47 4
125 45 2
124 4 2
123 12 8
122 28 1
122 36 2
122 16 13
122 17 1
122 20 2
121 15 0
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."