Unit Size Overall
  • There are 773 units with 11,969 lines of code in units (74.3% of code).
    • 8 very long units (957 lines of code)
    • 36 long units (2,515 lines of code)
    • 128 medium size units (3,966 lines of code)
    • 149 small units (2,081 lines of code)
    • 452 very small units (2,450 lines of code)
7% | 21% | 33% | 17% | 20%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go7% | 21% | 33% | 17% | 20%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
internal9% | 24% | 35% | 14% | 15%
pkg0% | 0% | 23% | 33% | 43%
rpc0% | 0% | 6% | 26% | 67%
cmd0% | 0% | 0% | 100% | 0%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
155 42 1
134 37 1
125 5 1
117 28 1
110 31 2
106 31 1
106 22 2
104 21 2
98 20 1
95 14 1
93 32 1
92 15 2
89 15 1
87 12 2
85 13 1
81 14 1
81 14 1
81 18 1
81 20 1
80 18 2
74 15 1
74 20 1
73 15 2
73 16 2
71 12 2
70 13 1
66 21 1
64 1 0
62 6 7
61 7 1
61 14 2
61 16 1
60 10 2
58 6 6
57 15 1
57 13 1
56 17 1
56 13 1
56 2 0
54 10 1
53 9 1
53 5 4
51 12 1
51 12 2
50 12 2
50 12 2
49 15 1
48 10 1
47 6 2
47 11 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."