aws-samples / serverless-go-demo
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 45 units with 472 lines of code in units (55.5% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 4 medium size units (111 lines of code)
    • 12 small units (172 lines of code)
    • 29 very small units (189 lines of code)
0% | 0% | 23% | 36% | 40%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go0% | 0% | 23% | 36% | 40%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
bus0% | 0% | 84% | 15% | 0%
store0% | 0% | 25% | 49% | 25%
handlers0% | 0% | 16% | 69% | 13%
domain0% | 0% | 0% | 25% | 74%
types/mocks0% | 0% | 0% | 0% | 100%
functions/products-stream0% | 0% | 0% | 0% | 100%
functions/get-product0% | 0% | 0% | 0% | 100%
functions/put-product0% | 0% | 0% | 0% | 100%
functions/delete-product0% | 0% | 0% | 0% | 100%
functions/get-products0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func()
in bus/event_bridge.go
38 6 1
func()
in store/dynamodb.go
29 6 1
func batchEvents()
in bus/event_bridge.go
23 5 3
func eventFromDynamoDBRecord()
in handlers/dynamodb.go
21 5 1
func()
in store/dynamodb.go
20 4 1
func()
in handlers/dynamodb.go
19 5 1
func()
in handlers/apigateway.go
18 6 1
func()
in handlers/apigateway.go
15 4 1
func()
in store/dynamodb.go
14 3 1
func()
in domain/products.go
14 4 1
func response()
in handlers/apigateway.go
14 2 2
func errResponse()
in handlers/apigateway.go
13 1 2
func()
in store/dynamodb.go
12 2 1
func NewDynamoDBStore()
in store/dynamodb.go
11 2 2
func()
in handlers/apigateway.go
11 3 1
func NewEventBridgeBus()
in bus/event_bridge.go
11 2 2
func()
in store/memory.go
10 2 1
func()
in domain/products.go
10 4 1
func main()
in functions/products-stream/main.go
10 2 0
func main()
in functions/get-product/main.go
10 2 0