golang / protobuf
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 1,387 units with 9,959 lines of code in units (73.0% of code).
    • 5 very long units (826 lines of code)
    • 22 long units (1,653 lines of code)
    • 61 medium size units (1,936 lines of code)
    • 67 small units (976 lines of code)
    • 1,232 very small units (4,568 lines of code)
8% | 16% | 19% | 9% | 45%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go8% | 16% | 19% | 9% | 45%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
jsonpb43% | 9% | 32% | 4% | 9%
protoc-gen-go/generator10% | 23% | 32% | 16% | 17%
internal/gengogrpc37% | 44% | 0% | 17% | <1%
protoc-gen-go/grpc31% | 38% | 0% | 25% | 5%
proto0% | 31% | 34% | 15% | 19%
internal/testprotos0% | 2% | 1% | <1% | 95%
internal/cmd0% | 94% | 0% | 0% | 5%
descriptor0% | 0% | 51% | 30% | 18%
protoc-gen-go0% | 0% | 100% | 0% | 0%
protoc-gen-go/descriptor0% | 0% | 95% | 0% | 4%
protoc-gen-go/plugin0% | 0% | 95% | 0% | 4%
ptypes/wrappers0% | 0% | 95% | 0% | 4%
ptypes/any0% | 0% | 95% | 0% | 4%
ptypes/empty0% | 0% | 95% | 0% | 4%
ptypes/timestamp0% | 0% | 95% | 0% | 4%
ptypes/duration0% | 0% | 95% | 0% | 4%
ptypes/struct0% | 0% | 95% | 0% | 4%
ptypes0% | 0% | 10% | 43% | 46%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func()
in jsonpb/decode.go
228 70 1
func()
in protoc-gen-go/generator/generator.go
204 32 1
func()
in jsonpb/encode.go
152 41 1
func genService()
in internal/gengogrpc/grpc.go
122 24 4
func()
in protoc-gen-go/grpc/grpc.go
120 24 1
func()
in protoc-gen-go/generator/generator.go
98 39 1
func()
in proto/text_decode.go
98 25 1
func init()
in internal/testprotos/proto2_proto/test.pb.go
96 1 0
func()
in proto/text_decode.go
91 38 1
func()
in proto/text_encode.go
88 23 1
func()
in jsonpb/encode.go
86 18 1
func()
in protoc-gen-go/generator/generator.go
83 17 1
func main()
in internal/cmd/generate-alias/main.go
83 7 0
func()
in protoc-gen-go/generator/generator.go
81 12 1
func()
in proto/text_decode.go
77 23 1
func()
in protoc-gen-go/grpc/grpc.go
75 10 1
func()
in protoc-gen-go/grpc/grpc.go
73 11 1
func genServerMethod()
in internal/gengogrpc/grpc.go
73 10 4
func genClientMethod()
in internal/gengogrpc/grpc.go
72 11 5
func()
in protoc-gen-go/generator/generator.go
69 22 1