golang / text
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 2,205 units with 33,072 lines of code in units (6.1% of code).
    • 17 very long units (2,259 lines of code)
    • 131 long units (8,710 lines of code)
    • 294 medium size units (9,301 lines of code)
    • 417 small units (6,262 lines of code)
    • 1,346 very small units (6,540 lines of code)
6% | 26% | 28% | 18% | 19%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go6% | 26% | 28% | 18% | 19%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
internal7% | 23% | 27% | 19% | 21%
message13% | 17% | 35% | 18% | 15%
date90% | 0% | 9% | 0% | 0%
encoding7% | 58% | 15% | 7% | 10%
unicode3% | 22% | 34% | 22% | 17%
language7% | 17% | 23% | 16% | 34%
feature18% | 34% | 37% | 2% | 7%
cases7% | 14% | 39% | 19% | 19%
currency20% | 16% | 13% | 21% | 26%
secure0% | 47% | 13% | 22% | 15%
width0% | 48% | 21% | 18% | 11%
collate0% | 15% | 29% | 27% | 27%
ROOT0% | 64% | 16% | 6% | 12%
transform0% | 33% | 33% | 14% | 18%
runes0% | 16% | 47% | 16% | 20%
cmd0% | 0% | 32% | 38% | 28%
search0% | 0% | 41% | 18% | 39%
number0% | 0% | 41% | 5% | 52%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func buildCLDRTree()
in date/gen.go
250 72 2
func genSymbols()
in internal/number/gen.go
168 38 2
func()
in message/print.go
160 52 1
func()
in internal/language/gen.go
148 38 1
func()
in internal/language/gen.go
148 32 1
func()
in language/gen.go
144 30 1
func()
in internal/format/parser.go
128 35 1
func printCharInfoTables()
in unicode/norm/maketables.go
125 39 1
func()
in encoding/japanese/iso2022jp.go
125 41 1
func genPlurals()
in feature/plural/gen.go
114 27 2
func genTablesTest()
in cases/gen.go
112 24 0
func()
in currency/gen.go
111 32 1
func()
in message/pipeline/rewrite.go
108 32 1
func main()
in encoding/japanese/maketables.go
107 24 0
func()
in internal/language/gen.go
106 26 1
func nextDecomposed()
in unicode/norm/iter.go
104 25 1
func()
in message/pipeline/generate.go
101 28 1
func addTags()
in internal/language/match.go
100 34 1
func main()
in encoding/korean/maketables.go
99 25 0
func()
in encoding/simplifiedchinese/hzgb2312.go
99 35 1