aws-samples / aws-cdk-examples
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 298 units with 6,199 lines of code in units (61.5% of code).
    • 4 very long units (576 lines of code)
    • 24 long units (1,652 lines of code)
    • 75 medium size units (2,351 lines of code)
    • 55 small units (837 lines of code)
    • 140 very small units (783 lines of code)
9% | 26% | 37% | 13% | 12%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py7% | 18% | 45% | 15% | 13%
ts12% | 42% | 25% | 14% | 5%
cs19% | 24% | 27% | 7% | 20%
java0% | 38% | 30% | 0% | 31%
js0% | 30% | 53% | 9% | 7%
go0% | 0% | 60% | 7% | 32%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
python/image-content-search52% | 0% | 22% | 9% | 16%
typescript/appsync-graphql-dynamodb100% | 0% | 0% | 0% | 0%
typescript/appsync-graphql-eventbridge100% | 0% | 0% | 0% | 0%
csharp/appsync-graphql-dynamodb94% | 0% | 0% | 0% | 5%
typescript/waf0% | 100% | 0% | 0% | 0%
python/waf0% | 61% | 38% | 0% | 0%
typescript/ecs0% | 34% | 23% | 35% | 7%
java/alb-multi-rule-response0% | 62% | 16% | 0% | 21%
python/lambda-ddb-mysql-etl-pipeline0% | 35% | 30% | 25% | 9%
python/my-widget-service0% | 100% | 0% | 0% | 0%
python/s3-object-lambda0% | 63% | 36% | 0% | 0%
typescript/s3-object-lambda0% | 75% | 24% | 0% | 0%
typescript/lambda-api-ci0% | 61% | 22% | 16% | 0%
csharp/static-site0% | 76% | 0% | 14% | 8%
typescript/neptune-with-vpc0% | 100% | 0% | 0% | 0%
python/api-eventbridge-lambda0% | 65% | 25% | 0% | 8%
typescript/resource-overrides0% | 100% | 0% | 0% | 0%
python/ec2-cloudwatch0% | 100% | 0% | 0% | 0%
typescript/lambda-cloudwatch-dashboard0% | 90% | 0% | 0% | 9%
csharp/elasticbeanstalk0% | 29% | 25% | 22% | 22%
python/appsync-graphql-dynamodb0% | 100% | 0% | 0% | 0%
typescript/stepfunctions-job-poller0% | 82% | 0% | 0% | 17%
typescript/fsx-ad0% | 100% | 0% | 0% | 0%
typescript/lambda-manage-s3-event-notification0% | 0% | 86% | 10% | 3%
python/ecs0% | 0% | 100% | 0% | 0%
python/docker-app-with-asg-alb0% | 0% | 83% | 14% | 1%
python/codepipeline-docker-build0% | 0% | 97% | 0% | 2%
typescript/elasticbeanstalk0% | 0% | 55% | 25% | 18%
go/ecs0% | 0% | 71% | 0% | 28%
python/new-vpc-alb-asg-mysql0% | 0% | 100% | 0% | 0%
python/batch0% | 0% | 100% | 0% | 0%
python/static-site0% | 0% | 39% | 26% | 33%
python/rekognition-lambda-s3-trigger0% | 0% | 100% | 0% | 0%
typescript/api-cors-lambda-crud-dynamodb0% | 0% | 62% | 15% | 22%
java/codebuild0% | 0% | 53% | 0% | 46%
python/lambda-cloudwatch-dashboard0% | 0% | 89% | 0% | 10%
python/stepfunctions0% | 0% | 81% | 0% | 18%
typescript/ec2-instance0% | 0% | 100% | 0% | 0%
csharp/stepfunctions-job-poller0% | 0% | 69% | 0% | 30%
python/api-sqs-lambda0% | 0% | 85% | 0% | 14%
python/api-cors-lambda0% | 0% | 86% | 0% | 13%
python/existing-vpc-new-ec2-ebs-userdata0% | 0% | 100% | 0% | 0%
typescript/cognito-api-lambda0% | 0% | 100% | 0% | 0%
csharp/my-widget-service0% | 0% | 83% | 0% | 16%
typescript/my-widget-service0% | 0% | 88% | 0% | 11%
go/eks0% | 0% | 70% | 0% | 29%
python/lambda-from-container0% | 0% | 82% | 0% | 17%
python/lambda-triggered-by-existing-kinesis-stream0% | 0% | 93% | 0% | 6%
python/ec20% | 0% | 100% | 0% | 0%
python/dynamodb-lambda0% | 0% | 41% | 36% | 21%
go/classic-load-balancer0% | 0% | 68% | 0% | 31%
typescript/eks0% | 0% | 100% | 0% | 0%
python/application-load-balancer0% | 0% | 100% | 0% | 0%
csharp/application-load-balancer0% | 0% | 80% | 0% | 20%
typescript/application-load-balancer0% | 0% | 100% | 0% | 0%
csharp/random-writer0% | 0% | 52% | 0% | 47%
csharp/classic-load-balancer0% | 0% | 78% | 0% | 21%
typescript/http-proxy-apigateway0% | 0% | 56% | 0% | 43%
python/lambda-cron0% | 0% | 91% | 0% | 8%
python/url-shortener0% | 0% | 0% | 89% | 10%
typescript/custom-resource0% | 0% | 0% | 77% | 22%
python/custom-resource0% | 0% | 0% | 80% | 19%
python/classic-load-balancer0% | 0% | 0% | 100% | 0%
typescript/classic-load-balancer0% | 0% | 0% | 100% | 0%
go/lambda-cron0% | 0% | 0% | 56% | 43%
python/rds0% | 0% | 0% | 100% | 0%
python/lambda-layer0% | 0% | 0% | 77% | 22%
java/custom-resource0% | 0% | 0% | 100% | 0%
typescript/custom-resource-provider0% | 0% | 0% | 29% | 70%
typescript/lambda-layer0% | 0% | 0% | 100% | 0%
python/lambda-with-existing-s3-code0% | 0% | 0% | 100% | 0%
csharp/lambda-cron0% | 0% | 0% | 68% | 31%
typescript/lambda-cron0% | 0% | 0% | 86% | 13%
typescript/amplify-console-app0% | 0% | 0% | 100% | 0%
python/cross-stack-resources0% | 0% | 0% | 0% | 100%
csharp/capitalize-string0% | 0% | 0% | 0% | 100%
python/lambda-s3-trigger0% | 0% | 0% | 0% | 100%
typescript/custom-logical-names0% | 0% | 0% | 0% | 100%
python/emr0% | 0% | 0% | 0% | 100%
typescript/static-site0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def __init__()
in python/image-content-search/stack/cdk.py
245 3 4
constructor()
in typescript/appsync-graphql-dynamodb/index.ts
120 1 3
constructor()
in typescript/appsync-graphql-eventbridge/index.ts
110 3 3
public AppsyncGraphqlDynamodbStack()
in csharp/appsync-graphql-dynamodb/src/AppsyncGraphqlDynamodb/AppsyncGraphqlDynamodbStack.cs
101 1 3
public ALBProjectStack()
in java/alb-multi-rule-response/src/main/java/com/myorg/ALBProjectStack.java
97 1 3
def __init__()
in python/lambda-ddb-mysql-etl-pipeline/etl_pipeline_cdk/etl_pipeline_cdk_stack.py
91 7 4
protected makeRules()
in typescript/waf/waf-cloudfront.ts
87 1 1
protected makeRules()
in typescript/waf/waf-regional.ts
82 2 1
def __init__()
in python/my-widget-service/my_widget_service/my_widget_service_stack.py
82 1 4
def __init__()
in python/s3-object-lambda/stacks/s3_object_lambda_stack.py
80 2 3
constructor()
in typescript/s3-object-lambda/lib/s3-object-lambda-stack.ts
79 1 3
def make_rules()
in python/waf/waf_regional.py
79 4 2
def make_rules()
in python/waf/waf_cloudfront.py
79 4 2
private createBuildStage()
in typescript/lambda-api-ci/lib/ci-stack.ts
76 1 2
constructor()
in typescript/ecs/fargate-service-with-efs/index.ts
71 1 3
public StaticSiteConstruct()
in csharp/static-site/src/StaticSite/StaticSiteConstruct.cs
70 1 3
constructor()
in typescript/neptune-with-vpc/neptune-with-vpc-stack.ts
66 1 3
def __init__()
in python/api-eventbridge-lambda/api_eventbridge_lambda/api_eventbridge_lambda.py
61 4 4
constructor()
in typescript/resource-overrides/index.ts
60 1 2
def __init__()
in python/ec2-cloudwatch/ec2_cloudwatch/ec2_cloudwatch_stack.py
60 3 4