google / closure-library
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 12,417 units with 126,169 lines of code in units (35.7% of code).
    • 17 very long units (2,459 lines of code)
    • 124 long units (7,917 lines of code)
    • 1,093 medium size units (32,347 lines of code)
    • 2,378 small units (34,318 lines of code)
    • 8,805 very small units (49,128 lines of code)
1% | 6% | 25% | 27% | 38%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js1% | 6% | 25% | 27% | 38%
ts0% | 35% | 38% | 5% | 20%
py0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
closure1% | 6% | 25% | 27% | 38%
scripts0% | 19% | 36% | 26% | 17%
closure-deps0% | 17% | 31% | 13% | 37%
doc0% | 0% | 47% | 11% | 40%
ROOT0% | 0% | 0% | 45% | 54%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
334 2 0
202 62 0
193 12 2
187 1 0
161 5 1
139 51 3
133 21 0
121 2 1
120 42 2
119 37 1
114 29 4
113 36 0
109 18 0
108 26 1
103 35 3
102 26 2
101 24 0
97 43 2
96 29 0
95 52 3
95 23 1
89 16 3
85 46 2
85 19 1
84 8 1
84 11 3
83 25 3
83 28 3
82 29 6
81 27 2
81 22 0
80 7 1
79 18 1
79 6 1
79 29 2
79 29 1
79 13 2
77 25 4
76 22 4
75 17 1
74 19 1
74 9 0
73 20 1
72 17 1
72 27 2
72 16 1
71 28 1
71 32 1
71 23 2
71 13 4