openai / codex
Unit Size

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

Intro
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."
Unit Size Overall
7% | 13% | 36% | 24% | 18%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
rs7% | 13% | 36% | 24% | 17%
py7% | 12% | 28% | 24% | 27%
ts0% | 22% | 29% | 26% | 21%
js0% | 0% | 0% | 100% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
codex-rs7% | 13% | 36% | 24% | 17%
.codex9% | 4% | 40% | 28% | 16%
scripts0% | 29% | 21% | 18% | 30%
sdk0% | 11% | 24% | 31% | 32%
codex-cli0% | 56% | 29% | 5% | 7%
tools0% | 17% | 17% | 30% | 35%
.github0% | 8% | 35% | 22% | 34%
.devcontainer0% | 0% | 63% | 0% | 36%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
507 8 1
426 60 1
411 1 0
324 2 2
316 28 0
314 1 1
299 45 4
289 13 1
269 1 0
253 15 4
245 1 0
245 1 0
229 46 2
227 29 3
222 26 3
206 20 3
205 25 4
203 37 2
189 20 1
186 43 0
185 30 0
181 4 0
176 2 2
174 1 0
171 4 0
170 22 6
169 10 4
167 10 3
153 21 3
148 23 2
148 2 0
146 8 3
146 2 0
144 11 4
142 12 4
142 29 2
140 8 2
137 30 1
136 1 2
135 15 3
135 1 0
133 52 2
130 17 2
130 13 3
128 28 1
128 3 0
128 24 2
127 16 1
127 18 2
126 11 3