golang / example
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 42 units with 616 lines of code in units (70.6% of code).
    • 0 very long units (0 lines of code)
    • 1 long units (72 lines of code)
    • 11 medium size units (306 lines of code)
    • 7 small units (111 lines of code)
    • 23 very small units (127 lines of code)
0% | 11% | 49% | 18% | 20%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go0% | 11% | 50% | 18% | 19%
js0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
gotypes0% | 49% | 41% | 0% | 8%
gotypes/nilfunc0% | 0% | 89% | 0% | 10%
gotypes/typeandvalue0% | 0% | 85% | 0% | 15%
gotypes/doc0% | 0% | 100% | 0% | 0%
gotypes/implements0% | 0% | 86% | 0% | 13%
gotypes/skeleton0% | 0% | 53% | 29% | 16%
gotypes/hugeparam0% | 0% | 64% | 35% | 0%
gotypes/lookup0% | 0% | 71% | 0% | 28%
outyet0% | 0% | 0% | 59% | 40%
gotypes/defsuses0% | 0% | 0% | 60% | 39%
gotypes/pkginfo0% | 0% | 0% | 84% | 15%
template0% | 0% | 0% | 50% | 50%
stringutil0% | 0% | 0% | 0% | 100%
appengine-hello0% | 0% | 0% | 0% | 100%
appengine-hello/static0% | 0% | 0% | 0% | 100%
hello0% | 0% | 0% | 0% | 100%
gotypes/hello0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func main()
in gotypes/weave.go
72 21 0
func include()
in gotypes/weave.go
35 9 2
func main()
in gotypes/doc/main.go
32 8 0
func main()
in gotypes/implements/main.go
31 12 0
func CheckNilFuncComparison()
in gotypes/nilfunc/main.go
31 9 2
func PrintSkeleton()
in gotypes/skeleton/main.go
29 6 3
func mode()
in gotypes/typeandvalue/main.go
28 9 1
func PrintHugeParams()
in gotypes/hugeparam/main.go
27 6 3
func cleanListing()
in gotypes/weave.go
26 10 1
func main()
in gotypes/lookup/lookup.go
23 5 0
func main()
in gotypes/typeandvalue/main.go
23 6 0
func main()
in gotypes/nilfunc/main.go
21 4 0
func PrintDefsUses()
in gotypes/defsuses/main.go
20 4 2
func()
in outyet/main.go
18 2 1
func main()
in gotypes/skeleton/main.go
16 4 0
func main()
in gotypes/pkginfo/main.go
16 3 0
func indexHandler()
in template/main.go
15 3 2
func main()
in gotypes/hugeparam/main.go
15 4 0
func isTagged()
in outyet/main.go
11 2 1
func imageHandler()
in template/main.go
10 3 2