facebook / buck
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 26,034 units with 265,142 lines of code in units (67.9% of code).
    • 139 very long units (24,249 lines of code)
    • 508 long units (33,766 lines of code)
    • 2,302 medium size units (70,442 lines of code)
    • 3,527 small units (51,284 lines of code)
    • 19,558 very small units (85,401 lines of code)
9% | 12% | 26% | 19% | 32%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
java8% | 12% | 26% | 19% | 32%
c58% | 13% | 19% | 5% | 3%
py8% | 11% | 26% | 22% | 29%
kt0% | 0% | 57% | 22% | 20%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/com9% | 12% | 26% | 19% | 31%
android/com45% | 10% | 22% | 11% | 10%
src-gen/com6% | 11% | 26% | 16% | 39%
tools/release20% | 14% | 23% | 17% | 23%
python-dsl/buck_parser10% | 3% | 27% | 30% | 28%
scripts6% | 9% | 34% | 24% | 25%
tools/ideabuck1% | 12% | 23% | 23% | 38%
scripts/artificialproject18% | 10% | 15% | 23% | 31%
programs6% | 16% | 26% | 19% | 30%
tools/consistency_checker0% | 34% | 29% | 19% | 16%
scripts/apple0% | 100% | 0% | 0% | 0%
tools/psi-grammar0% | 9% | 3% | 20% | 66%
scripts/migrations0% | 0% | 46% | 9% | 43%
tools/dxanalysis0% | 0% | 39% | 30% | 29%
tools/datascience0% | 0% | 46% | 27% | 25%
programs/fixes0% | 0% | 11% | 28% | 59%
tools/build0% | 0% | 0% | 22% | 77%
py/hash0% | 0% | 0% | 100% | 0%
android/android0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
1802 473 3
752 61 3
635 94 14
496 46 4
355 47 15
310 19 4
309 22 8
293 22 9
284 9 4
281 21 2
276 20 4
271 45 1
263 15 4
262 12 37
262 22 13
236 1 0
235 6 10
226 21 2
221 12 9
209 11 9
209 9 4
209 12 1
205 19 11
199 29 1
198 27 11
198 9 6
190 21 1
188 4 1
187 7 10
184 16 0
183 15 0
182 5 2
182 7 3
180 4 4
179 15 0
177 17 13
177 6 34
174 9 0
170 6 4
166 30 1
163 7 4
163 27 2
163 6 2
162 21 21
161 6 4
161 8 22
160 16 5
158 28 8
156 17 5
154 9 17