golang / mock
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 164 units with 2,240 lines of code in units (83.8% of code).
    • 0 very long units (0 lines of code)
    • 8 long units (603 lines of code)
    • 27 medium size units (841 lines of code)
    • 20 small units (276 lines of code)
    • 109 very small units (520 lines of code)
0% | 26% | 37% | 12% | 23%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go0% | 26% | 37% | 12% | 23%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
mockgen0% | 38% | 45% | 5% | 9%
mockgen/model0% | 27% | 9% | 26% | 36%
gomock0% | 9% | 39% | 16% | 35%
sample0% | 0% | 0% | 73% | 26%
gomock/internal0% | 0% | 0% | 0% | 100%
sample/concurrent0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func()
in mockgen/parse.go
94 23 1
func main()
in mockgen/mockgen.go
93 23 0
func()
in mockgen/parse.go
87 30 1
func typeFromType()
in mockgen/model/model.go
83 21 1
func()
in mockgen/mockgen.go
78 21 1
func()
in gomock/call.go
63 20 1
func()
in mockgen/mockgen.go
53 8 1
func importsOfFile()
in mockgen/parse.go
52 11 1
func sourceMode()
in mockgen/parse.go
46 10 1
func()
in mockgen/mockgen.go
45 8 1
func main()
in mockgen/reflect.go
44 8 0
func()
in gomock/matchers.go
41 13 1
func runInDir()
in mockgen/reflect.go
40 9 2
func()
in mockgen/parse.go
37 11 1
func()
in mockgen/mockgen.go
36 1 1
func()
in gomock/call.go
36 9 1
func parsePackageImport()
in mockgen/mockgen.go
32 9 1
func()
in gomock/call.go
32 6 1
func()
in mockgen/parse.go
31 8 1
func()
in mockgen/parse.go
30 8 1