Linux / Scripts
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • 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...
Unit Size Overall
  • There are 1,586 units with 32,010 lines of code in units (24.7% of code).
    • 38 very long units (6,572 lines of code)
    • 80 long units (5,439 lines of code)
    • 317 medium size units (9,722 lines of code)
    • 396 small units (5,827 lines of code)
    • 755 very small units (4,450 lines of code)
20% | 16% | 30% | 18% | 13%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c19% | 18% | 32% | 17% | 11%
pl33% | 12% | 27% | 16% | 10%
h19% | 14% | 9% | 14% | 41%
cc0% | 29% | 35% | 22% | 12%
py0% | 12% | 25% | 26% | 35%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT31% | 14% | 25% | 16% | 12%
kconfig26% | 20% | 29% | 12% | 10%
mod18% | 16% | 31% | 19% | 13%
dtc3% | 15% | 37% | 27% | 16%
selinux65% | 30% | 0% | 0% | 3%
genksyms24% | 20% | 30% | 11% | 12%
gcc-plugins0% | 21% | 44% | 20% | 13%
gdb0% | 11% | 25% | 26% | 36%
basic0% | 0% | 45% | 26% | 27%
clang-tools0% | 0% | 43% | 17% | 38%
tracing0% | 0% | 0% | 50% | 50%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
465 138 0
368 2 0
354 2 0
261 65 0
234 63 5
209 76 4
207 1 1
206 43 3
191 60 9
183 59 2
179 69 2
178 24 2
176 52 1
172 44 5
167 36 2
166 51 1
156 36 6
156 51 0
155 59 1
154 19 2
154 45 2
149 41 0
141 31 1
141 37 0
140 58 3
135 11 9
133 53 1
132 26 2
123 43 1
120 43 0
118 29 2
109 31 1
109 38 1
108 24 2
108 33 1
106 37 2
106 24 0
103 28 2
99 26 1
99 28 3
96 22 0
95 19 4
94 26 1
93 3 4
93 16 5
93 17 1
92 24 2
90 24 2
90 19 2
90 27 2