aws-samples / cdk-microservices-labs
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 69 units with 1,865 lines of code in units (7.3% of code).
    • 5 very long units (728 lines of code)
    • 9 long units (601 lines of code)
    • 7 medium size units (196 lines of code)
    • 12 small units (201 lines of code)
    • 36 very small units (139 lines of code)
39% | 32% | 10% | 10% | 7%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py43% | 35% | 11% | 6% | 3%
js0% | 0% | 0% | 62% | 37%
java0% | 0% | 0% | 0% | 100%
tsx0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
6-serverless-graphql-stack/backend68% | 18% | 7% | 4% | 1%
5-serverless-xray-stack/fagate_serverless100% | 0% | 0% | 0% | 0%
4-serverless-cicd-stack/customer-service-cicd51% | 24% | 10% | 7% | 6%
4-serverless-cicd-stack/vet-service-cicd51% | 24% | 10% | 7% | 6%
4-serverless-cicd-stack/visit-service-cicd51% | 24% | 10% | 7% | 6%
2-ecs-microservice-stack/ecs_microservice0% | 100% | 0% | 0% | 0%
3-serverless-microservice-stack/serverless0% | 77% | 22% | 0% | 0%
5-serverless-xray-stack/custom-resource-code0% | 77% | 0% | 18% | 4%
3-serverless-microservice-stack/custom-resource-code0% | 77% | 0% | 18% | 4%
4-serverless-cicd-stack/static-service-cicd0% | 47% | 15% | 22% | 13%
1-ecs-monolith-stack/ecs_monolith0% | 0% | 100% | 0% | 0%
5-serverless-xray-stack/spring-petclinic-static0% | 0% | 0% | 62% | 37%
3-serverless-microservice-stack/spring-petclinic-static0% | 0% | 0% | 62% | 37%
2-ecs-microservice-stack/work0% | 0% | 0% | 0% | 100%
6-serverless-graphql-stack0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def __init__()
in 6-serverless-graphql-stack/backend/app_sync_cdk/app_sync_cdk_stack.py
245 1 4
def __init__()
in 5-serverless-xray-stack/fagate_serverless/fagate_serverless_stack.py
129 3 4
def __init__()
in 4-serverless-cicd-stack/customer-service-cicd/serverless_cicd/serverless_cicd_stack.py
118 1 6
def __init__()
in 4-serverless-cicd-stack/vet-service-cicd/serverless_cicd/serverless_cicd_stack.py
118 1 6
def __init__()
in 4-serverless-cicd-stack/visit-service-cicd/serverless_cicd/serverless_cicd_stack.py
118 1 6
def __init__()
in 2-ecs-microservice-stack/ecs_microservice/ecs_microservice_stack.py
82 4 4
def __init__()
in 3-serverless-microservice-stack/serverless/serverless_stack.py
79 3 4
def create()
in 5-serverless-xray-stack/custom-resource-code/init.py
71 16 2
def create()
in 3-serverless-microservice-stack/custom-resource-code/init.py
71 16 2
def __init__()
in 4-serverless-cicd-stack/static-service-cicd/static_cicd/static_cicd_stack.py
68 1 4
def create()
in 6-serverless-graphql-stack/backend/custom-resource-code/index.py
65 11 2
def __init__()
in 4-serverless-cicd-stack/customer-service-cicd/serverless_lambda/serverless_lambda_stack.py
55 1 4
def __init__()
in 4-serverless-cicd-stack/vet-service-cicd/serverless_lambda/serverless_lambda_stack.py
55 1 4
def __init__()
in 4-serverless-cicd-stack/visit-service-cicd/serverless_lambda/serverless_lambda_stack.py
55 1 4
def __init__()
in 1-ecs-monolith-stack/ecs_monolith/ecs_monolith_stack.py
50 1 4
def send()
in 6-serverless-graphql-stack/backend/custom-resource-code/cfnresponse.py
25 3 6
def send()
in 4-serverless-cicd-stack/customer-service-cicd/custom-resource-code/cfnresponse.py
25 3 6
def send()
in 4-serverless-cicd-stack/vet-service-cicd/custom-resource-code/cfnresponse.py
25 3 6
def send()
in 4-serverless-cicd-stack/visit-service-cicd/custom-resource-code/cfnresponse.py
25 3 6
def add_cors_options()
in 4-serverless-cicd-stack/static-service-cicd/static_cicd/static_cicd_stack.py
23 1 2