aws / amazon-ecs-agent
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
  • 5% duplication:
    • 37,476 cleaned lines of cleaned code (without empty lines, comments, and frequently duplicated constructs such as imports)
    • 2,183 duplicated lines
  • 293 duplicates
system5% (2,183 lines)
Duplication per Extension
go5% (2,019 lines)
ps121% (146 lines)
yml60% (18 lines)
Duplication per Component (primary)
agent/ecs_client6% (343 lines)
agent/acs13% (275 lines)
agent/handlers15% (242 lines)
agent/dockerclient6% (155 lines)
agent/taskresource3% (140 lines)
agent/app7% (126 lines)
agent/tcs13% (126 lines)
agent/api2% (125 lines)
agent/engine1% (79 lines)
agent/ecr26% (73 lines)
agent/stats4% (60 lines)
agent/config4% (52 lines)
scripts18% (50 lines)
agent/eni5% (47 lines)
misc/windows-deploy11% (36 lines)
agent/containermetadata6% (27 lines)
agent/logger3% (26 lines)
agent/ec24% (22 lines)
agent/eventhandler4% (20 lines)
agent/ecscni2% (20 lines)
ROOT60% (18 lines)
agent/utils2% (18 lines)
misc/netkitten21% (12 lines)
misc/volumes-test85% (12 lines)
misc/container-health-windows92% (12 lines)
misc/stats-windows92% (12 lines)
misc/exec-command-agent-test22% (12 lines)
agent/credentials6% (11 lines)
agent/statemanager3% (11 lines)
agent/fsx8% (7 lines)
agent/asm<1% (7 lines)
agent/ssm7% (7 lines)
agent/async0% (0 lines)
agent/s30% (0 lines)
agent/eventstream0% (0 lines)
agent/wsclient0% (0 lines)
agent/statechange0% (0 lines)
agent/gpu0% (0 lines)
agent/gogenerate0% (0 lines)
agent/sighandlers0% (0 lines)
agent/httpclient0% (0 lines)
agent/doctor0% (0 lines)
agent/data0% (0 lines)
agent0% (0 lines)
agent/version0% (0 lines)
agent/metrics0% (0 lines)
misc/gremlin0% (0 lines)
misc/pause-container0% (0 lines)

Duplication Between Components (50+ lines)

G agent/acs agent/acs agent/ecs_client agent/ecs_client agent/acs--agent/ecs_client 236 agent/ecr agent/ecr agent/acs--agent/ecr 50 agent/tcs agent/tcs agent/acs--agent/tcs 128 agent/ecs_client--agent/tcs 100 agent/ecr--agent/ecs_client 146 agent/ecr--agent/tcs 101 misc/windows-deploy misc/windows-deploy scripts scripts misc/windows-deploy--scripts 79 misc/container-health-windows misc/container-health-windows misc/container-health-windows--scripts 59 misc/exec-command-agent-test misc/exec-command-agent-test misc/exec-command-agent-test--scripts 59 misc/volumes-test misc/volumes-test misc/volumes-test--scripts 59 misc/netkitten misc/netkitten misc/netkitten--scripts 59 misc/stats-windows misc/stats-windows misc/stats-windows--scripts 59

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 293 duplicates...
Size#FoldersFilesLinesCode
26 x 2 agent/acs/model/ecsacs
agent/tcs/model/ecstcs
api.go
api.go
285:340 (3%)
72:127 (5%)
view
26 x 2 agent/ecr/model/ecr
agent/tcs/model/ecstcs
api.go
api.go
237:292 (24%)
741:796 (5%)
view
26 x 2 agent/ecr/model/ecr
agent/ecs_client/model/ecs
api.go
api.go
182:237 (24%)
8002:8059 (<1%)
view
25 x 2 agent/ecr/model/ecr
agent/tcs/model/ecstcs
api.go
api.go
185:237 (23%)
328:380 (5%)
view
25 x 2 agent/ecs_client/model/ecs
agent/tcs/model/ecstcs
api.go
api.go
8007:8059 (<1%)
328:380 (5%)
view
25 x 2 agent/ecr/model/ecr
agent/ecs_client/model/ecs
api.go
api.go
240:292 (23%)
11134:11186 (<1%)
view
25 x 2 agent/ecs_client/model/ecs
agent/tcs/model/ecstcs
api.go
api.go
11134:11186 (<1%)
744:796 (5%)
view
25 x 2 agent/acs/model/ecsacs
agent/ecs_client/model/ecs
api.go
api.go
43:95 (3%)
3851:3903 (<1%)
view
25 x 2 agent/acs/model/ecsacs
agent/tcs/model/ecstcs
api.go
api.go
1482:1534 (3%)
744:796 (5%)
view
25 x 2 agent/acs/model/ecsacs
agent/ecs_client/model/ecs
api.go
api.go
1482:1534 (3%)
11134:11186 (<1%)
view
25 x 2 agent/acs/model/ecsacs
agent/ecr/model/ecr
api.go
api.go
1482:1534 (3%)
240:292 (23%)
view
23 x 2 agent/app
agent/app
agent_capability_unix.go
agent_capability_unspecified.go
59:101 (18%)
37:79 (37%)
view
23 x 2 agent/stats
agent/stats
queue.go
queue.go
332:366 (8%)
436:470 (8%)
view
23 x 2 agent/app
agent/app
agent_capability_unspecified.go
agent_capability_windows.go
79:123 (37%)
58:102 (32%)
view
16 x 2 agent/api/task
agent/api/task
task_linux.go
task_unsupported.go
206:240 (10%)
49:80 (45%)
view
13 x 2 agent/ecr/model/ecr
agent/ecs_client/model/ecs
service.go
service.go
86:105 (28%)
83:102 (29%)
view
13 x 2 agent/taskresource/asmsecret
agent/taskresource/ssmsecret
asmsecret.go
ssmsecret.go
496:515 (4%)
462:481 (5%)
view
12 x 2 misc/container-health-windows
scripts
build.ps1
run-integ-tests.ps1
1:12 (92%)
1:12 (18%)
view
12 x 2 scripts
scripts
generate_image.ps1
run-integ-tests.ps1
1:12 (8%)
1:12 (18%)
view
12 x 2 scripts
scripts
generate_image.ps1
run-unit-tests.ps1
1:12 (8%)
1:12 (52%)
view
Duplicated Units
The list of top 20 duplicated units.
See data for all 33 unit duplicates...
Size#FoldersFilesLinesCode
26 x 2 agent/app
agent/app
agent_capability_unix.go
agent_capability_unspecified.go
61:99 
39:77 
view
19 x 2 agent/ecs_client/model/ecs
agent/ecs_client/model/ecs
api.go
api.go
6398:6418 
10200:10220 
view
18 x 2 agent/tcs/model/ecstcs
agent/tcs/model/ecstcs
api.go
api.go
1000:1019 
1054:1073 
view
16 x 2 agent/ecs_client/model/ecs
agent/ecs_client/model/ecs
api.go
api.go
5895:5912 
12058:12075 
view
14 x 2 agent/config
agent/config
conditional.go
conditional.go
52:68 
92:108 
view
9 x 2 agent/ecs_client/model/ecs
agent/ecs_client/model/ecs
api.go
api.go
4052:4062 
6324:6334 
view
9 x 2 agent/ecs_client/model/ecs
agent/ecs_client/model/ecs
api.go
api.go
6802:6812 
13378:13388 
view
9 x 2 agent/ecs_client/model/ecs
agent/ecs_client/model/ecs
api.go
api.go
6876:6886 
7185:7195 
view
9 x 2 agent/config
agent/config
conditional.go
conditional.go
40:49 
80:89 
view
9 x 2 agent/asm/mocks
agent/asm/mocks
secretsmanagerapi_mocks.go
secretsmanagerapi_mocks.go
483:492 
566:575 
view
8 x 2 agent/api/task
agent/api/task
task_unsupported.go
task_linux.go
53:61 
213:221 
view
7 x 2 agent/taskresource/ssmsecret
agent/taskresource/asmsecret
ssmsecret.go
asmsecret.go
168:175 
172:179 
view
7 x 2 agent/taskresource/ssmsecret
agent/taskresource/asmsecret
ssmsecret.go
asmsecret.go
232:240 
236:244 
view
7 x 2 agent/taskresource/ssmsecret
agent/taskresource/asmsecret
ssmsecret.go
asmsecret.go
398:407 
432:441 
view
6 x 2 agent/ecs_client/model/ecs
agent/ecr/model/ecr
service.go
service.go
107:116 
110:119 
view
6 x 2 agent/containermetadata/mocks
agent/dockerclient/dockerapi/mocks
containermetadata_mocks.go
dockerapi_mocks.go
169:175 
164:170 
view
6 x 4 agent/api/mocks
agent/api/mocks
agent/ec2/mocks
agent/ecscni/mocks
api_mocks.go
api_mocks.go
ec2_mocks.go
ecscni_mocks.go
219:225 
234:240 
85:91 
113:119 
view
6 x 2 agent/api/mocks
agent/ec2/mocks
api_mocks.go
ec2_mocks.go
249:255 
416:422 
view
6 x 2 agent/httpclient/mock
agent/ec2/http/mocks
httpclient.go
http_mocks.go
52:58 
52:58 
view
6 x 2 agent/taskresource/ssmsecret
agent/taskresource/asmsecret
ssmsecret.go
asmsecret.go
379:386 
413:420 
view