Unit Size Overall
  • There are 6,061 units with 65,180 lines of code in units (46.5% of code).
    • 51 very long units (8,023 lines of code)
    • 164 long units (10,888 lines of code)
    • 584 medium size units (17,897 lines of code)
    • 801 small units (11,640 lines of code)
    • 4,461 very small units (16,732 lines of code)
12% | 16% | 27% | 17% | 25%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
hpp14% | 19% | 31% | 15% | 18%
c42% | 17% | 27% | 10% | 2%
cpp13% | 26% | 38% | 11% | 9%
h1% | 8% | 16% | 25% | 48%
cc0% | 0% | 28% | 29% | 41%
py0% | 0% | 0% | 25% | 74%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
lib11% | 16% | 26% | 18% | 26%
experiments23% | 16% | 49% | 5% | 4%
tools0% | 0% | 0% | 32% | 67%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
952 128 2
276 68 2
275 66 3
220 22 0
220 74 1
205 67 1
201 75 5
198 50 1
178 56 1
171 68 2
171 68 2
166 76 1
160 52 1
155 36 3
148 28 1
146 42 12
144 8 1
140 30 1
140 44 2
136 39 1
136 45 1
133 49 5
132 51 6
132 28 4
130 48 6
130 42 6
129 53 6
128 8 0
127 31 0
126 26 4
123 33 1
121 47 4
121 31 2
120 47 6
116 33 12
116 33 12
113 36 2
112 27 0
111 10 0
110 23 3
109 22 2
108 37 0
107 15 4
107 29 0
107 23 3
104 27 10
104 19 4
103 30 0
103 33 1
102 28 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."