facebook / litho
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 9,596 units with 84,751 lines of code in units (66.0% of code).
    • 47 very long units (7,134 lines of code)
    • 135 long units (9,204 lines of code)
    • 593 medium size units (18,136 lines of code)
    • 1,185 small units (17,051 lines of code)
    • 7,636 very small units (33,226 lines of code)
8% | 10% | 21% | 20% | 39%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
java7% | 11% | 22% | 20% | 39%
cpp36% | 12% | 10% | 14% | 27%
kt0% | 6% | 17% | 27% | 47%
js0% | 0% | 20% | 48% | 31%
h0% | 0% | 0% | 8% | 91%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
lib27% | 9% | 9% | 13% | 40%
litho-core7% | 8% | 21% | 18% | 43%
litho-processor11% | 21% | 24% | 18% | 24%
litho-widget12% | 15% | 24% | 17% | 30%
litho-sections-core10% | 14% | 17% | 25% | 32%
litho-rendercore-text23% | 8% | 33% | 12% | 22%
litho-rendercore-visibility22% | 0% | 27% | 12% | 37%
litho-rendercore3% | 10% | 17% | 24% | 44%
litho-editor-flipper12% | 8% | 27% | 22% | 28%
litho-sections-widget8% | 0% | 19% | 14% | 58%
litho-widget-material0% | 62% | 7% | 4% | 25%
litho-testing0% | 4% | 11% | 23% | 60%
litho-intellij-plugin0% | 5% | 35% | 24% | 34%
litho-rendercore-transitions0% | 5% | 26% | 25% | 43%
litho-widget-kotlin0% | 28% | 38% | 18% | 14%
litho-rendercore-yoga0% | 30% | 18% | 14% | 36%
litho-sections-processor0% | 13% | 24% | 12% | 48%
litho-rendercore-incremental-mount0% | 17% | 22% | 43% | 16%
codelabs0% | 5% | 21% | 30% | 42%
litho-it0% | 0% | 12% | 28% | 59%
litho-editor-core0% | 0% | 38% | 27% | 34%
litho-rendercore-testing0% | 0% | 22% | 14% | 62%
litho-fresco0% | 0% | 50% | 0% | 49%
litho-core-kotlin0% | 0% | 10% | 33% | 56%
litho-espresso0% | 0% | 25% | 36% | 37%
litho-sections-debug0% | 0% | 69% | 0% | 30%
website0% | 0% | 20% | 48% | 31%
litho-coroutines-kotlin0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
736 141 15
313 65 7
234 38 15
201 11 3
176 34 11
176 31 14
175 35 17
173 55 3
173 43 14
169 24 6
168 3 1
158 18 12
158 35 4
157 41 3
156 31 4
155 38 5
149 32 37
147 22 3
142 41 2
141 50 1
140 24 10
136 22 1
126 13 5
125 3 28
121 32 11
120 19 1
118 15 33
118 5 28
117 26 5
117 3 1
117 16 2
115 17 3
113 28 1
112 34 2
112 24 6
110 13 5
109 36 1
109 36 28
107 6 10
106 16 6
106 17 2
105 5 6
104 22 4
104 17 30
104 28 4
103 16 5
103 19 4
100 8 7
100 31 2
100 16 4