aws-samples / aws-secure-environment-accelerator
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
  • 20% duplication:
    • 77,745 cleaned lines of cleaned code (without empty lines, comments, and frequently duplicated constructs such as imports)
    • 16,125 duplicated lines
  • 7,959 duplicates
system20% (16,125 lines)
Duplication per Extension
ts21% (10,140 lines)
yaml21% (4,592 lines)
tsx14% (703 lines)
py16% (241 lines)
yml27% (153 lines)
psm143% (127 lines)
js26% (114 lines)
ps124% (55 lines)
Duplication per Component (primary)
src/lib26% (6,250 lines)
ROOT21% (4,592 lines)
src/deployments13% (2,147 lines)
src/core20% (1,781 lines)
src/ui13% (703 lines)
reference-artifacts/Custom-Scripts15% (241 lines)
reference-artifacts/scripts35% (182 lines)
src/installer25% (179 lines)
reference-artifacts/config-rules34% (50 lines)
reference-artifacts/ssm-documents0% (0 lines)
deployment/cdk-solution-helper0% (0 lines)

Duplication Between Components (50+ lines)

G src/deployments src/deployments src/lib src/lib src/deployments--src/lib 440 src/core src/core src/core--src/deployments 273

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 7,959 duplicates...
Size#FoldersFilesLinesCode
94 x 2 src/core/runtime/src/configuration
src/core/runtime/src/configuration
load-control-tower-config.ts
load-organizations-config.ts
54:191 (51%)
69:206 (31%)
view
57 x 2 src/lib/custom-resources...-default-encryption/cdk
src/lib/custom-resources...-default-encryption/lib
index.ts
index.ts
21:91 (100%)
21:91 (100%)
view
49 x 2 src/lib/custom-resources...osted-zones/runtime/src
src/lib/custom-resources...osted-zones/runtime/src
index.ts
index.ts
26:92 (20%)
21:87 (45%)
view
45 x 2 src/core/runtime/src/configuration
src/core/runtime/src/configuration
load-control-tower-config.ts
load-organizations-config.ts
198:253 (24%)
222:277 (14%)
view
45 x 2 src/lib/config-i18n/src
src/lib/config-i18n/src
en.ts
fr.ts
1789:1834 (1%)
1649:1694 (1%)
view
43 x 2 ROOT
ROOT
pnpm-lock.yaml
pnpm-lock.yaml
15165:15207 (<1%)
15211:15253 (<1%)
view
40 x 2 src/lib/config-i18n/src
src/lib/config-i18n/src
en.ts
fr.ts
2014:2053 (1%)
1870:1909 (1%)
view
38 x 2 src/ui/src/pages/wizards/components
src/ui/src/pages/wizards/components
account-table.tsx
organizational-unit-table.tsx
527:569 (8%)
531:573 (8%)
view
32 x 2 ROOT
ROOT
pnpm-lock.yaml
pnpm-lock.yaml
5646:5677 (<1%)
5777:5808 (<1%)
view
32 x 2 ROOT
ROOT
pnpm-lock.yaml
pnpm-lock.yaml
5646:5677 (<1%)
5684:5715 (<1%)
view
32 x 2 src/lib/config-i18n/src
src/lib/config-i18n/src
en.ts
fr.ts
2659:2691 (<1%)
2474:2506 (1%)
view
32 x 2 ROOT
ROOT
pnpm-lock.yaml
pnpm-lock.yaml
5684:5715 (<1%)
5777:5808 (<1%)
view
31 x 2 src/lib/custom-resources...-encryption/runtime/src
src/lib/custom-resources...t-encryption/lambda/src
index.ts
index.ts
15:64 (100%)
15:64 (100%)
view
30 x 2 src/deployments/cdk/src/common
src/deployments/cdk/src/deployments/config
replacements.ts
create.ts
26:58 (75%)
399:431 (8%)
view
29 x 2 src/deployments/cdk/src/...ments/central-endpoints
src/deployments/cdk/src/...ments/central-endpoints
step-2.ts
step-3.ts
372:406 (9%)
220:254 (16%)
view
29 x 2 src/deployments/cdk/src/...yments/firewall/cluster
src/deployments/cdk/src/...yments/firewall/cluster
step-2.ts
step-2.ts
163:199 (13%)
255:290 (13%)
view
28 x 2 ROOT
ROOT
pnpm-lock.yaml
pnpm-lock.yaml
184:211 (<1%)
297:324 (<1%)
view
27 x 2 src/lib/config-i18n/src
src/lib/config-i18n/src
en.ts
fr.ts
2103:2129 (<1%)
1958:1984 (<1%)
view
26 x 2 src/deployments/cdk/src/deployments/mad
src/deployments/cdk/src/deployments/rsyslog
step-1.ts
step-1.ts
66:96 (36%)
61:91 (39%)
view
24 x 2 src/core/runtime/src
src/core/runtime/src
get-or-create-config.ts
get-or-create-config.ts
115:139 (7%)
203:229 (7%)
view
Duplicated Units
The list of top 20 duplicated units.
See data for all 36 unit duplicates...
Size#FoldersFilesLinesCode
44 x 2 src/lib/custom-resources...-default-encryption/lib
src/lib/custom-resources...-default-encryption/cdk
index.ts
index.ts
42:92 
42:92 
view
36 x 2 src/ui/src/pages/wizards/components
src/ui/src/pages/wizards/components
account-table.tsx
organizational-unit-table.tsx
534:570 
538:574 
view
25 x 3 src/lib/common/src/aws
src/lib/custom-resources...osted-zones/runtime/src
src/lib/custom-resources...osted-zones/runtime/src
sts.ts
index.ts
index.ts
32:59 
50:77 
45:72 
view
25 x 3 src/lib/custom-resources...osted-zones/runtime/src
src/lib/common/src/aws
src/lib/custom-resources...osted-zones/runtime/src
index.ts
sts.ts
index.ts
50:77 
32:59 
45:72 
view
21 x 2 src/deployments/cdk/src/deployments/iam
src/deployments/cdk/src/deployments/iam
tgw-create-peering-roles.ts
tgw-accept-peering-roles.ts
41:64 
40:63 
view
19 x 2 src/deployments/cdk/src/deployments/iam
src/deployments/cdk/src/deployments/iam
s3-put-replication-role.ts
log-group-role.ts
34:54 
34:54 
view
18 x 2 src/lib/custom-resources...-gateway-attachment/cdk
src/lib/custom-resources...service-permissions/cdk
index.ts
index.ts
51:71 
50:70 
view
17 x 11 src/lib/custom-resources...macie-export-config/cdk
src/lib/custom-resources...duty-create-publish/cdk
src/lib/custom-resources...macie-update-config/cdk
src/lib/custom-resources...-macie-enable-admin/cdk
src/lib/custom-resources...rdduty-get-detector/cdk
src/lib/custom-resources...rdduty-enable-admin/cdk
src/lib/custom-resources/cdk-iam-create-role/cdk
src/lib/custom-resources...macie-create-member/cdk
src/lib/custom-resources...ardduty-admin-setup/cdk
src/lib/custom-resources/cdk-macie-enable/cdk
...
index.ts
index.ts
index.ts
index.ts
index.ts
index.ts
index.ts
index.ts
index.ts
index.ts
...
47:66 
50:69 
45:64 
45:64 
52:71 
47:66 
55:74 
47:66 
60:79 
48:67 
...
view
17 x 7 src/lib/custom-resources...on-manager-document/cdk
src/lib/custom-resources...security-hub-enable/cdk
src/lib/custom-resources...-ssm-document-share/cdk
src/lib/custom-resources...-hub-accept-invites/cdk
src/lib/custom-resources...ub-disable-controls/cdk
src/lib/custom-resources...ssm-create-document/cdk
src/lib/custom-resources...ty-hub-send-invites/cdk
index.ts
index.ts
index.ts
index.ts
index.ts
index.ts
index.ts
66:85 
45:64 
47:66 
46:65 
50:69 
54:73 
51:70 
view
16 x 13 src/lib/custom-resources...reate-resolver-rule/cdk
src/lib/custom-resources...-create-hosted-zone/cdk
src/lib/custom-resources...increase-throughput/cdk
src/lib/custom-resources...t-bucket-versioning/cdk
src/lib/custom-resources...-logs-metric-filter/cdk
src/lib/custom-resources...otification-channel/cdk
src/lib/custom-resources/cdk-resource-cleanup/cdk
src/lib/custom-resources...ociate-hosted-zones/cdk
src/lib/custom-resources...iate-resolver-rules/cdk
src/lib/custom-resources...endpoint-connection/cdk
...
index.ts
index.ts
index.ts
index.ts
index.ts
index.ts
index.ts
index.ts
index.ts
index.ts
...
62:80 
56:74 
41:59 
50:68 
57:75 
48:66 
56:74 
59:77 
50:68 
50:68 
...
view
16 x 2 src/lib/custom-resources...eway-create-peering/cdk
src/lib/custom-resources...eway-accept-peering/cdk
index.ts
index.ts
67:85 
53:71 
view
12 x 2 src/deployments/cdk/src/deployments/iam
src/deployments/cdk/src/deployments/iam
tgw-create-peering-roles.ts
tgw-accept-peering-roles.ts
25:39 
25:38 
view
11 x 2 src/lib/custom-resources...t-encryption/lambda/src
src/lib/custom-resources...-encryption/runtime/src
index.ts
index.ts
28:41 
28:41 
view
11 x 3 src/lib/custom-resources...nable-admin/runtime/src
src/lib/custom-resources...eate-member/runtime/src
src/lib/custom-resources...acie-enable/runtime/src
index.ts
index.ts
index.ts
31:44 
33:46 
44:57 
view
11 x 2 src/lib/custom-resources...osted-zones/runtime/src
src/lib/custom-resources...olver-rules/runtime/src
index.ts
index.ts
92:105 
34:47 
view
11 x 2 src/lib/custom-resources...ept-invites/runtime/src
src/lib/custom-resources...end-invites/runtime/src
index.ts
index.ts
24:37 
24:37 
view
10 x 3 src/lib/common/src/aws
src/lib/custom-resources/cdk-cfn-utils/cdk
src/lib/cdk-plugin-assume-role/src
backoff.ts
index.ts
backoff.ts
19:29 
21:31 
19:29 
view
10 x 2 src/lib/custom-resources...-default-encryption/lib
src/lib/custom-resources...-default-encryption/cdk
index.ts
index.ts
28:40 
28:40 
view
9 x 2 src/core/runtime/src/configuration
src/core/runtime/src/configuration
load-control-tower-config.ts
load-organizations-config.ts
273:282 
363:372 
view
9 x 2 src/core/runtime/src/save-outputs-to-ssm
src/core/runtime/src/save-outputs-to-ssm
index.ts
index.ts
81:90 
94:103 
view