aws-samples / aws-cdk-examples
Duplication

Places in code with 6 or more lines that are exactly the same.

Intro
  • For duplication, we look at places in code where there are 6 or more lines of code that are exactly the same.
  • Before duplication is calculated, the code is cleaned to remove empty lines, comments, and frequently duplicated constructs such as imports.
  • You should aim at having as little as possible (<5%) of duplicated code as high-level of duplication can lead to maintenance difficulties, poor factoring, and logical contradictions.
Learn more...
Duplication Overall
  • 19% duplication:
    • 8,644 cleaned lines of cleaned code (without empty lines, comments, and frequently duplicated constructs such as imports)
    • 1,694 duplicated lines
  • 173 duplicates
system19% (1,694 lines)
Duplication per Extension
py22% (1,011 lines)
ts16% (388 lines)
js44% (231 lines)
go27% (64 lines)
Duplication per Component (primary)
python/waf84% (228 lines)
typescript/waf77% (216 lines)
python/ecs39% (133 lines)
typescript/elasticbeanstalk61% (109 lines)
csharp/elasticbeanstalk61% (109 lines)
java/my-widget-service100% (73 lines)
typescript/my-widget-service66% (73 lines)
csharp/my-widget-service68% (73 lines)
typescript/ecs12% (68 lines)
python/image-content-search8% (65 lines)
python/cross-stack-resources46% (54 lines)
typescript/lambda-manage-s3-event-notification23% (40 lines)
python/dynamodb-lambda33% (40 lines)
go/ecs26% (32 lines)
python/batch29% (32 lines)
python/lambda-ddb-mysql-etl-pipeline8% (27 lines)
typescript/api-cors-lambda-crud-dynamodb12% (26 lines)
python/lambda-cloudwatch-dashboard22% (21 lines)
python/new-vpc-alb-asg-mysql15% (20 lines)
python/existing-vpc-new-ec2-ebs-userdata27% (20 lines)
python/api-eventbridge-lambda12% (18 lines)
python/api-sqs-lambda20% (18 lines)
go/eks46% (18 lines)
typescript/custom-resource32% (16 lines)
python/docker-app-with-asg-alb8% (15 lines)
python/my-widget-service12% (15 lines)
python/url-shortener10% (15 lines)
python/ec2-cloudwatch16% (15 lines)
python/stepfunctions16% (15 lines)
python/rekognition-lambda-s3-trigger13% (14 lines)
typescript/api-websocket-lambda-dynamodb8% (14 lines)
typescript/classic-load-balancer45% (10 lines)
typescript/application-load-balancer37% (10 lines)
java/custom-resource53% (8 lines)
typescript/custom-resource-provider13% (8 lines)
go/classic-load-balancer19% (7 lines)
go/lambda-cron23% (7 lines)
python/api-cors-lambda13% (6 lines)
python/lambda-s3-trigger24% (6 lines)
java/codebuild0% (0 lines)
java/alb-multi-rule-response0% (0 lines)
java/static-site0% (0 lines)
ROOT0% (0 lines)
typescript/appsync-graphql-dynamodb0% (0 lines)
typescript/lambda-cron0% (0 lines)
typescript/neptune-with-vpc0% (0 lines)
typescript/custom-logical-names0% (0 lines)
typescript/lambda-api-ci0% (0 lines)
typescript/ec2-instance0% (0 lines)
typescript/lambda-cloudwatch-dashboard0% (0 lines)
typescript/static-site0% (0 lines)
typescript/appsync-graphql-eventbridge0% (0 lines)
typescript/lambda-layer0% (0 lines)
typescript/stepfunctions-job-poller0% (0 lines)
typescript/cognito-api-lambda0% (0 lines)
typescript/http-proxy-apigateway0% (0 lines)
typescript/eks0% (0 lines)
typescript/s3-object-lambda0% (0 lines)
typescript/resource-overrides0% (0 lines)
typescript/amplify-console-app0% (0 lines)
typescript/fsx-ad0% (0 lines)
csharp/capitalize-string0% (0 lines)
csharp/appsync-graphql-dynamodb0% (0 lines)
csharp/lambda-cron0% (0 lines)
csharp/random-writer0% (0 lines)
csharp/static-site0% (0 lines)
csharp/stepfunctions-job-poller0% (0 lines)
csharp/classic-load-balancer0% (0 lines)
csharp/application-load-balancer0% (0 lines)
python/appsync-graphql-dynamodb0% (0 lines)
python/lambda-cron0% (0 lines)
python/emr0% (0 lines)
python/rds0% (0 lines)
python/lambda-with-existing-s3-code0% (0 lines)
python/lambda-from-container0% (0 lines)
python/static-site0% (0 lines)
python/lambda-layer0% (0 lines)
python/classic-load-balancer0% (0 lines)
python/lambda-triggered-by-existing-kinesis-stream0% (0 lines)
python/custom-resource0% (0 lines)
python/application-load-balancer0% (0 lines)
python/codepipeline-docker-build0% (0 lines)
python/s3-object-lambda0% (0 lines)
python/ec20% (0 lines)

Duplication Between Components (50+ lines)

G csharp/elasticbeanstalk csharp/elasticbeanstalk typescript/elasticbeanstalk typescript/elasticbeanstalk csharp/elasticbeanstalk--typescript/elasticbeanstalk 218 csharp/my-widget-service csharp/my-widget-service typescript/my-widget-service typescript/my-widget-service csharp/my-widget-service--typescript/my-widget-service 146 java/my-widget-service java/my-widget-service csharp/my-widget-service--java/my-widget-service 146 java/my-widget-service--typescript/my-widget-service 146 python/waf python/waf typescript/waf typescript/waf python/waf--typescript/waf 64

Download: SVG DOT (open online Graphviz editor)

Open 3D force graph...

Show more details on duplication between components...
Longest Duplicates
The list of 20 longest duplicates.
See data for all 173 duplicates...
Size#FoldersFilesLinesCode
114 x 2 python/waf
python/waf
waf_cloudfront.py
waf_regional.py
9:154 (86%)
9:153 (86%)
view
109 x 2 csharp/elasticbeanstalk/...k-bg-pipeline/resources
typescript/elasticbeanst...k-bg-pipeline/resources
blue_green.py
blue_green.py
13:210 (100%)
13:224 (100%)
view
85 x 2 typescript/waf
typescript/waf
waf-cloudfront.ts
waf-regional.ts
51:159 (61%)
47:155 (63%)
view
73 x 2 csharp/my-widget-service...WidgetService/resources
typescript/my-widget-service/resources
widgets.js
widgets.js
29:133 (100%)
29:133 (100%)
view
73 x 2 java/my-widget-service/resources
typescript/my-widget-service/resources
widgets.js
widgets.js
29:133 (100%)
29:133 (100%)
view
73 x 2 csharp/my-widget-service...WidgetService/resources
java/my-widget-service/resources
widgets.js
widgets.js
29:133 (100%)
29:133 (100%)
view
20 x 2 python/existing-vpc-new-ec2-ebs-userdata
python/new-vpc-alb-asg-mysql
setup.py
setup.py
13:41 (76%)
13:41 (76%)
view
18 x 2 python/api-eventbridge-lambda
python/api-sqs-lambda
setup.py
setup.py
21:45 (62%)
21:45 (62%)
view
16 x 2 python/waf
typescript/waf
waf_cloudfront.py
waf-regional.ts
48:63 (12%)
59:74 (11%)
view
16 x 2 python/api-eventbridge-lambda
python/dynamodb-lambda
setup.py
setup.py
23:45 (55%)
30:52 (44%)
view
16 x 2 python/waf
typescript/waf
waf_regional.py
waf-regional.ts
48:63 (12%)
59:74 (11%)
view
16 x 2 python/api-sqs-lambda
python/dynamodb-lambda
setup.py
setup.py
23:45 (55%)
30:52 (44%)
view
16 x 2 python/waf
typescript/waf
waf_cloudfront.py
waf-cloudfront.ts
48:63 (12%)
63:78 (11%)
view
16 x 2 python/waf
typescript/waf
waf_regional.py
waf-cloudfront.ts
48:63 (12%)
63:78 (11%)
view
15 x 2 python/docker-app-with-asg-alb
python/lambda-ddb-mysql-etl-pipeline
setup.py
setup.py
21:41 (57%)
21:41 (57%)
view
15 x 2 python/existing-vpc-new-ec2-ebs-userdata
python/my-widget-service
setup.py
setup.py
21:41 (57%)
21:41 (57%)
view
15 x 2 python/api-sqs-lambda
python/my-widget-service
setup.py
setup.py
25:45 (51%)
21:41 (57%)
view
15 x 2 python/cross-stack-resources/native-objects
python/url-shortener
setup.py
setup.py
21:41 (57%)
16:36 (65%)
view
15 x 2 python/docker-app-with-asg-alb
python/stepfunctions
setup.py
setup.py
21:41 (57%)
21:41 (57%)
view
15 x 2 python/lambda-cloudwatch-dashboard
python/url-shortener
setup.py
setup.py
21:41 (57%)
16:36 (65%)
view
Duplicated Units
The list of top 15 duplicated units.
See data for all 15 unit duplicates...
Size#FoldersFilesLinesCode
91 x 2 python/waf
python/waf
waf_regional.py
waf_cloudfront.py
0:0 
0:0 
view
39 x 2 typescript/elasticbeanst...k-bg-pipeline/resources
csharp/elasticbeanstalk/...k-bg-pipeline/resources
blue_green.py
blue_green.py
0:0 
0:0 
view
25 x 2 typescript/elasticbeanst...k-bg-pipeline/resources
csharp/elasticbeanstalk/...k-bg-pipeline/resources
blue_green.py
blue_green.py
0:0 
0:0 
view
16 x 2 typescript/elasticbeanst...k-bg-pipeline/resources
csharp/elasticbeanstalk/...k-bg-pipeline/resources
blue_green.py
blue_green.py
0:0 
0:0 
view
30 x 2 typescript/elasticbeanst...k-bg-pipeline/resources
csharp/elasticbeanstalk/...k-bg-pipeline/resources
blue_green.py
blue_green.py
0:0 
0:0 
view
9 x 2 typescript/custom-resource-provider
typescript/custom-resource
index.ts
index.ts
8:20 
8:20 
view
9 x 2 typescript/custom-resource
typescript/custom-resource-provider
index.ts
index.ts
8:20 
8:20 
view
8 x 2 go/ecs/cluster
go/eks/cluster
cluster.go
cluster.go
48:58 
54:64 
view
8 x 2 typescript/elasticbeanst...k-bg-pipeline/resources
csharp/elasticbeanstalk/...k-bg-pipeline/resources
blue_green.py
blue_green.py
0:0 
0:0 
view
7 x 2 typescript/elasticbeanst...k-bg-pipeline/resources
csharp/elasticbeanstalk/...k-bg-pipeline/resources
blue_green.py
blue_green.py
0:0 
0:0 
view
6 x 2 python/dynamodb-lambda/lambda/consumer
python/dynamodb-lambda/lambda/producer
lambda_function.py
lambda_function.py
0:0 
0:0 
view
6 x 3 typescript/lambda-cloudwatch-dashboard/lambda
python/lambda-s3-trigger/lambda
python/lambda-cloudwatch-dashboard/lambda
lambda-handler.py
lambda-handler.py
lambda-handler.py
0:0 
0:0 
0:0 
view
8 x 2 typescript/elasticbeanst...k-bg-pipeline/resources
csharp/elasticbeanstalk/...k-bg-pipeline/resources
blue_green.py
blue_green.py
0:0 
0:0 
view
10 x 2 typescript/elasticbeanst...k-bg-pipeline/resources
csharp/elasticbeanstalk/...k-bg-pipeline/resources
blue_green.py
blue_green.py
0:0 
0:0 
view
10 x 2 typescript/elasticbeanst...k-bg-pipeline/resources
csharp/elasticbeanstalk/...k-bg-pipeline/resources
blue_green.py
blue_green.py
0:0 
0:0 
view