aws-samples / one-observability-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 341 units with 4,524 lines of code in units (41.3% of code).
    • 1 very long units (465 lines of code)
    • 8 long units (498 lines of code)
    • 53 medium size units (1,512 lines of code)
    • 58 small units (812 lines of code)
    • 221 very small units (1,237 lines of code)
10% | 11% | 33% | 17% | 27%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts57% | 18% | 15% | 3% | 5%
go0% | 18% | 36% | 20% | 23%
cs0% | 0% | 40% | 21% | 37%
java0% | 0% | 31% | 21% | 46%
py0% | 0% | 0% | 44% | 56%
js0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
PetAdoptions/cdk18% | 13% | 31% | 13% | 22%
PetAdoptions/payforadoption-go0% | 21% | 27% | 27% | 23%
PetAdoptions/petlistadoptions-go0% | 15% | 49% | 10% | 24%
PetAdoptions/petsite0% | 0% | 53% | 12% | 33%
PetAdoptions/petsearch-java0% | 0% | 31% | 21% | 46%
PetAdoptions/payforadoption0% | 0% | 27% | 35% | 37%
PetAdoptions/trafficgenerator0% | 0% | 32% | 18% | 49%
PetAdoptions/petsearch0% | 0% | 19% | 42% | 37%
PetAdoptions/petlistadoptions0% | 0% | 19% | 39% | 41%
PetAdoptions/petstatusupdater0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
constructor()
in PetAdoptions/cdk/pet_stack/lib/services.ts
465 12 3
constructor()
in PetAdoptions/cdk/pet_stack/lib/services/ecs-service.ts
82 6 3
constructor()
in PetAdoptions/cdk/pet_stack/lib/applications.ts
66 1 3
func main()
in PetAdoptions/cdk/pet_stack/resources/microservices/petlistadoptions-go/main.go
60 4 0
func main()
in PetAdoptions/petlistadoptions-go/main.go
60 4 0
func main()
in PetAdoptions/payforadoption-go/main.go
58 4 0
func main()
in PetAdoptions/cdk/pet_stack/resources/microservices/payforadoption-go/main.go
58 4 0
func()
in PetAdoptions/payforadoption-go/payforadoption/repository.go
57 6 1
func()
in PetAdoptions/cdk/pet_stack/resources/microservices/payforadoption-go/payforadoption/repository.go
57 6 1
constructor()
in PetAdoptions/cdk/pet_stack/lib/services/status-updater-service.ts
47 1 3
func MakeHTTPHandler()
in PetAdoptions/payforadoption-go/payforadoption/transport.go
45 1 2
func MakeHTTPHandler()
in PetAdoptions/cdk/pet_stack/resources/microservices/payforadoption-go/payforadoption/transport.go
45 1 2
constructor()
in PetAdoptions/cdk/pet_stack/lib/sql-seeder.ts
43 1 3
public async Task Index()
in PetAdoptions/cdk/pet_stack/resources/microservices/petsite/petsite/Controllers/HomeController.cs
42 2 3
public async Task Index()
in PetAdoptions/petsite/petsite/Controllers/HomeController.cs
42 2 3
constructor()
in PetAdoptions/cdk/pet_stack/lib/services/stepfn.ts
38 1 3
func()
in PetAdoptions/cdk/pet_stack/resources/microservices/petlistadoptions-go/petlistadoptions/repository.go
38 5 1
func()
in PetAdoptions/petlistadoptions-go/petlistadoptions/repository.go
38 5 1
public async Task MakePayment()
in PetAdoptions/cdk/pet_stack/resources/microservices/petsite/petsite/Controllers/PaymentController.cs
35 3 2
public async Task MakePayment()
in PetAdoptions/petsite/petsite/Controllers/PaymentController.cs
35 3 2