github / codeql
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 7,428 units with 55,322 lines of code in units (62.3% of code).
    • 20 very long units (2,884 lines of code)
    • 75 long units (4,936 lines of code)
    • 383 medium size units (11,707 lines of code)
    • 772 small units (11,053 lines of code)
    • 6,178 very small units (24,742 lines of code)
5% | 8% | 21% | 19% | 44%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
java5% | 7% | 19% | 19% | 48%
rs20% | 23% | 30% | 17% | 6%
ts14% | 15% | 21% | 23% | 25%
cs1% | 9% | 26% | 22% | 40%
py0% | 2% | 14% | 17% | 65%
c0% | 0% | 0% | 39% | 60%
cpp0% | 0% | 0% | 19% | 80%
rb0% | 0% | 0% | 78% | 21%
js0% | 0% | 0% | 1% | 98%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
javascript7% | 8% | 20% | 17% | 46%
ruby22% | 20% | 31% | 18% | 8%
ql17% | 25% | 30% | 18% | 8%
csharp1% | 9% | 26% | 22% | 40%
java0% | 2% | 8% | 26% | 62%
python0% | 3% | 6% | 8% | 81%
misc0% | 0% | 26% | 31% | 41%
cpp0% | 0% | 5% | 26% | 68%
config0% | 0% | 29% | 39% | 30%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
319 162 2
255 1 0
199 27 4
187 109 1
159 22 2
141 8 5
141 8 5
123 102 0
121 19 2
119 7 0
118 42 2
118 38 0
116 17 5
116 17 5
115 7 0
111 29 0
108 42 3
108 5 0
105 45 1
105 25 2
95 8 3
95 8 3
93 30 0
89 25 1
89 7 1
89 7 1
88 9 1
88 47 1
86 27 2
81 20 2
81 35 1
80 15 2
80 6 0
80 16 2
80 16 2
79 17 2
79 1 1
78 25 0
73 2 1
70 10 2
70 13 2
70 10 1
70 12 2
68 15 3
68 7 6
68 7 6
67 37 3
66 12 1
65 15 1
65 17 2