Unit Size Overall
  • There are 4,597 units with 54,135 lines of code in units (55.6% of code).
    • 37 very long units (5,192 lines of code)
    • 137 long units (9,356 lines of code)
    • 544 medium size units (17,271 lines of code)
    • 748 small units (10,727 lines of code)
    • 3,131 very small units (11,589 lines of code)
9% | 17% | 31% | 19% | 21%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cc11% | 20% | 35% | 19% | 13%
h7% | 6% | 20% | 21% | 43%
rs11% | 33% | 34% | 9% | 11%
py0% | 16% | 35% | 24% | 23%
hpp0% | 6% | 28% | 38% | 26%
c0% | 12% | 43% | 20% | 23%
cpp0% | 0% | 36% | 40% | 23%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src9% | 17% | 31% | 19% | 21%
benchmarks28% | 23% | 27% | 14% | 6%
deploy0% | 24% | 43% | 15% | 15%
hf3fs_utils0% | 17% | 26% | 34% | 21%
hf3fs0% | 0% | 24% | 30% | 45%
hf3fs_fuse0% | 0% | 44% | 29% | 25%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
256 42 1
254 48 9
213 53 2
184 39 9
179 29 5
163 30 2
162 41 3
152 67 1
152 67 1
151 32 4
149 23 3
146 17 1
143 39 2
141 19 0
138 24 0
136 4 0
136 18 5
135 23 3
134 21 4
134 130 2
134 15 3
129 36 2
129 26 7
124 17 4
123 21 3
121 21 3
119 15 4
113 20 3
112 47 2
108 19 4
107 4 0
105 21 1
103 8 4
103 10 1
102 35 1
101 15 1
101 20 6
97 22 1
96 3 2
95 18 1
95 18 4
95 22 6
94 21 5
94 20 2
94 19 5
94 13 5
94 16 2
93 22 3
93 17 10
92 16 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."