facebook / mariana-trench
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,250 units with 13,423 lines of code in units (56.0% of code).
    • 7 very long units (916 lines of code)
    • 27 long units (1,702 lines of code)
    • 127 medium size units (3,976 lines of code)
    • 185 small units (2,708 lines of code)
    • 904 very small units (4,121 lines of code)
6% | 12% | 29% | 20% | 30%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp8% | 14% | 31% | 20% | 24%
py0% | 19% | 26% | 27% | 26%
h0% | 0% | 18% | 15% | 66%
java0% | 0% | 35% | 34% | 29%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
source8% | 10% | 30% | 18% | 31%
source/model-generator0% | 19% | 25% | 25% | 29%
shim0% | 30% | 31% | 27% | 10%
scripts0% | 10% | 21% | 28% | 39%
desugar/com/facebook/marianatrench0% | 0% | 35% | 34% | 29%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
186 5 1
142 37 0
129 20 6
129 23 3
121 24 2
106 1 1
103 11 1
93 25 2
87 18 10
83 13 2
79 11 2
79 18 0
72 2 5
70 10 7
68 8 4
66 17 4
65 9 7
61 17 4
60 8 3
60 15 1
58 21 0
58 16 1
58 14 1
55 11 2
55 1 1
54 4 9
54 7 3
53 8 3
53 12 2
53 8 1
53 5 0
52 12 1
52 4 9
51 11 1
50 6 7
50 8 2
50 18 2
49 10 3
48 12 5
47 11 4
47 11 6
47 13 1
46 10 1
46 1 1
45 12 1
44 7 2
44 6 3
44 7 3
43 11 1
43 5 3