aws-samples / serverless-container-constructs
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 12 units with 331 lines of code in units (61.1% of code).
    • 1 very long units (132 lines of code)
    • 1 long units (74 lines of code)
    • 1 medium size units (24 lines of code)
    • 6 small units (89 lines of code)
    • 3 very small units (12 lines of code)
39% | 22% | 7% | 26% | 3%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts50% | 28% | 0% | 17% | 4%
go0% | 0% | 35% | 64% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src52% | 29% | 0% | 13% | 4%
services/OrderService0% | 0% | 48% | 52% | 0%
services/CommonService0% | 0% | 0% | 100% | 0%
src/common0% | 0% | 0% | 100% | 0%
Alternative Visuals
Longest Units
Top 12 longest units
Unit# linesMcCabe index# params
constructor()
in src/alb-fargate-svcs.ts
132 12 3
constructor()
in src/main.ts
74 6 3
func fetchServices()
in services/OrderService/main.go
24 5 0
18 5 2
constructor()
in src/cdknag.ts
17 1 3
func main()
in services/CommonService/main.go
17 3 0
func main()
in services/OrderService/main.go
15 3 0
export function getOrCreateVpc()
in src/common/common-functions.ts
11 4 1
func HttpGet()
in services/OrderService/main.go
11 2 2
static bucket()
in src/cdknag.ts
4 1 2
static securityGroup()
in src/cdknag.ts
4 1 2
static iamPolicy()
in src/cdknag.ts
4 1 2