aws-samples / serverless-samples
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
  • 78% duplication:
    • 11,031 cleaned lines of cleaned code (without empty lines, comments, and frequently duplicated constructs such as imports)
    • 8,650 duplicated lines
  • 2,854 duplicates
system78% (8,650 lines)
Duplication per Extension
yaml84% (6,444 lines)
py70% (1,470 lines)
js57% (623 lines)
yml56% (113 lines)
Duplication per Component (primary)
fargate-rest-api/javascript-rest-nlb-ecs-sam68% (2,389 lines)
serverless-rest-api/python-rest-sam93% (1,873 lines)
serverless-rest-api/python-http-sam99% (1,707 lines)
serverless-rest-api/javascript-http-sam87% (1,568 lines)
serverless-rest-api/python-http-cdk54% (660 lines)
apigw-private-custom-domain-name/iac60% (290 lines)
serverless-rest-api/shared70% (130 lines)
lambda-ecs-dual-deploy/2-flask-lambda-container86% (13 lines)
lambda-ecs-dual-deploy/3-flask-dual-deployment81% (13 lines)
lambda-ecs-dual-deploy/1-flask-app-container87% (7 lines)
apigw-private-custom-domain-name/src0% (0 lines)
terraform-sam-integration/sam0% (0 lines)
terraform-sam-integration/terraform0% (0 lines)

Duplication Between Components (50+ lines)

G serverless-rest-api/python-http-sam serverless-rest-api/python-http-sam serverless-rest-api/python-rest-sam serverless-rest-api/python-rest-sam serverless-rest-api/python-http-sam--serverless-rest-api/python-rest-sam 3121 serverless-rest-api/javascript-http-sam serverless-rest-api/javascript-http-sam serverless-rest-api/javascript-http-sam--serverless-rest-api/python-http-sam 2485 serverless-rest-api/javascript-http-sam--serverless-rest-api/python-rest-sam 2219 fargate-rest-api/javascript-rest-nlb-ecs-sam fargate-rest-api/javascript-rest-nlb-ecs-sam fargate-rest-api/javascript-rest-nlb-ecs-sam--serverless-rest-api/python-http-sam 1804 fargate-rest-api/javascript-rest-nlb-ecs-sam--serverless-rest-api/python-rest-sam 2219 fargate-rest-api/javascript-rest-nlb-ecs-sam--serverless-rest-api/javascript-http-sam 2239 serverless-rest-api/shared serverless-rest-api/shared fargate-rest-api/javascript-rest-nlb-ecs-sam--serverless-rest-api/shared 216 serverless-rest-api/python-http-cdk serverless-rest-api/python-http-cdk serverless-rest-api/python-http-cdk--serverless-rest-api/python-http-sam 780 serverless-rest-api/python-http-cdk--serverless-rest-api/python-rest-sam 726

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 2,854 duplicates...
Size#FoldersFilesLinesCode
596 x 2 serverless-rest-api/javascript-http-sam
serverless-rest-api/python-http-sam
template.yaml
template.yaml
199:823 (76%)
206:829 (75%)
view
338 x 2 serverless-rest-api/python-http-sam
serverless-rest-api/python-rest-sam
template.yaml
template.yaml
414:763 (43%)
407:756 (43%)
view
338 x 2 serverless-rest-api/javascript-http-sam
serverless-rest-api/python-rest-sam
template.yaml
template.yaml
408:757 (43%)
407:756 (43%)
view
324 x 2 serverless-rest-api/javascript-http-sam
serverless-rest-api/python-http-sam
pipeline.yaml
pipeline.yaml
82:411 (63%)
82:411 (63%)
view
304 x 2 serverless-rest-api/python-http-sam
serverless-rest-api/python-rest-sam
pipeline.yaml
pipeline.yaml
82:390 (59%)
82:390 (58%)
view
304 x 2 serverless-rest-api/javascript-http-sam
serverless-rest-api/python-rest-sam
pipeline.yaml
pipeline.yaml
82:390 (59%)
82:390 (58%)
view
165 x 2 serverless-rest-api/python-http-sam/src/api
serverless-rest-api/python-rest-sam/src/api
authorizer.py
authorizer.py
15:276 (100%)
15:276 (100%)
view
165 x 2 serverless-rest-api/python-http-cdk/src/api
serverless-rest-api/python-http-sam/src/api
authorizer.py
authorizer.py
15:276 (100%)
15:276 (100%)
view
165 x 2 serverless-rest-api/python-http-cdk/src/api
serverless-rest-api/python-rest-sam/src/api
authorizer.py
authorizer.py
15:276 (100%)
15:276 (100%)
view
134 x 2 serverless-rest-api/python-http-sam
serverless-rest-api/python-rest-sam
template.yaml
template.yaml
265:403 (17%)
258:396 (17%)
view
134 x 2 serverless-rest-api/javascript-http-sam
serverless-rest-api/python-rest-sam
template.yaml
template.yaml
258:397 (17%)
258:396 (17%)
view
133 x 2 serverless-rest-api/python-http-sam
serverless-rest-api/python-rest-sam
pipeline.yaml
pipeline.yaml
392:538 (26%)
405:551 (25%)
view
124 x 2 fargate-rest-api/javascript-rest-nlb-ecs-sam
serverless-rest-api/javascript-http-sam
pipeline.yaml
pipeline.yaml
584:713 (16%)
354:483 (24%)
view
108 x 2 fargate-rest-api/javascr...-sam/src/api/authorizer
serverless-rest-api/javascript-http-sam/src/api
authorizer.js
authorizer.js
30:320 (50%)
30:320 (50%)
view
101 x 2 serverless-rest-api/javascript-http-sam
serverless-rest-api/python-http-sam
pipeline.yaml
pipeline.yaml
426:538 (19%)
426:538 (19%)
view
101 x 2 serverless-rest-api/javascript-http-sam
serverless-rest-api/python-rest-sam
pipeline.yaml
pipeline.yaml
426:538 (19%)
439:551 (19%)
view
90 x 2 serverless-rest-api/python-http-cdk/src/api
serverless-rest-api/python-http-sam/src/api
bookings.py
bookings.py
14:115 (100%)
17:137 (100%)
view
85 x 2 fargate-rest-api/javascript-rest-nlb-ecs-sam
serverless-rest-api/shared
cognito.yaml
cognito.yaml
7:95 (77%)
11:99 (46%)
view
79 x 2 fargate-rest-api/javascript-rest-nlb-ecs-sam
serverless-rest-api/python-rest-sam
template.yaml
template.yaml
894:976 (6%)
346:428 (10%)
view
73 x 2 serverless-rest-api/python-http-cdk/src/api
serverless-rest-api/python-http-sam/src/api
resources.py
resources.py
13:94 (100%)
16:111 (100%)
view
Duplicated Units
The list of top 11 duplicated units.
See data for all 11 unit duplicates...
Size#FoldersFilesLinesCode
44 x 3 serverless-rest-api/python-http-sam/src/api
serverless-rest-api/python-rest-sam/src/api
serverless-rest-api/python-http-cdk/src/api
authorizer.py
authorizer.py
authorizer.py
0:0 
0:0 
0:0 
view
39 x 3 serverless-rest-api/python-http-sam/src/api
serverless-rest-api/python-rest-sam/src/api
serverless-rest-api/python-http-cdk/src/api
authorizer.py
authorizer.py
authorizer.py
0:0 
0:0 
0:0 
view
27 x 3 serverless-rest-api/python-http-sam/src/api
serverless-rest-api/python-rest-sam/src/api
serverless-rest-api/python-http-cdk/src/api
authorizer.py
authorizer.py
authorizer.py
0:0 
0:0 
0:0 
view
23 x 2 serverless-rest-api/javascript-http-sam/src/api
fargate-rest-api/javascr...-sam/src/api/authorizer
authorizer.js
authorizer.js
123:149 
123:149 
view
22 x 2 serverless-rest-api/javascript-http-sam/src/api
fargate-rest-api/javascr...-sam/src/api/authorizer
authorizer.js
authorizer.js
30:89 
30:89 
view
20 x 2 serverless-rest-api/javascript-http-sam/src/api
fargate-rest-api/javascr...-sam/src/api/authorizer
authorizer.js
authorizer.js
179:203 
179:203 
view
14 x 2 serverless-rest-api/javascript-http-sam/src/api
fargate-rest-api/javascr...-sam/src/api/authorizer
authorizer.js
authorizer.js
297:315 
297:315 
view
15 x 3 serverless-rest-api/python-http-sam/src/api
serverless-rest-api/python-rest-sam/src/api
serverless-rest-api/python-http-cdk/src/api
authorizer.py
authorizer.py
authorizer.py
0:0 
0:0 
0:0 
view
17 x 3 serverless-rest-api/python-http-sam/src/api
serverless-rest-api/python-rest-sam/src/api
serverless-rest-api/python-http-cdk/src/api
authorizer.py
authorizer.py
authorizer.py
0:0 
0:0 
0:0 
view
8 x 3 serverless-rest-api/python-http-sam/src/api
serverless-rest-api/python-rest-sam/src/api
serverless-rest-api/python-http-cdk/src/api
authorizer.py
authorizer.py
authorizer.py
0:0 
0:0 
0:0 
view
6 x 2 serverless-rest-api/javascript-http-sam/src/api
fargate-rest-api/javascr...-sam/src/api/authorizer
authorizer.js
authorizer.js
160:167 
160:167 
view