aws-solutions / maintaining-personalized-experiences-with-machine-learning
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
  • 24% duplication:
    • 8,329 cleaned lines of cleaned code (without empty lines, comments, and frequently duplicated constructs such as imports)
    • 2,049 duplicated lines
  • 324 duplicates
system24% (2,049 lines)
Duplication per Extension
py24% (2,049 lines)
Duplication per Component (primary)
infrastructure/personalize35% (953 lines)
cdk_solution_helper_py/helpers_cdk16% (318 lines)
scheduler/cdk42% (273 lines)
aws_lambda/shared4% (72 lines)
scheduler/common8% (50 lines)
aws_lambda/create_batch_segment_job71% (38 lines)
aws_lambda/create_batch_inference_job63% (37 lines)
cdk_solution_helper_py/helpers_common23% (36 lines)
aws_lambda/create_recommender81% (30 lines)
aws_lambda/create_filter82% (29 lines)
aws_lambda/create_solution_version67% (29 lines)
aws_lambda/create_dataset_group69% (29 lines)
aws_lambda/create_event_tracker90% (28 lines)
aws_lambda/create_dataset_import_job64% (27 lines)
aws_lambda/create_campaign48% (23 lines)
aws_lambda/create_schema88% (22 lines)
aws_lambda/create_solution37% (21 lines)
aws_lambda/create_dataset52% (18 lines)
infrastructure30% (16 lines)
aws_lambda0% (0 lines)
aws_lambda/create_timestamp0% (0 lines)
aws_lambda/sns_notification0% (0 lines)
aws_lambda/s3_event0% (0 lines)
aws_lambda/create_config0% (0 lines)
aws_lambda/prepare_input0% (0 lines)

Duplication Between Components (50+ lines)

G infrastructure/personalize infrastructure/personalize scheduler/cdk scheduler/cdk infrastructure/personalize--scheduler/cdk 241 scheduler/common scheduler/common scheduler/cdk--scheduler/common 66 cdk_solution_helper_py/helpers_cdk cdk_solution_helper_py/helpers_cdk cdk_solution_helper_py/helpers_cdk--infrastructure/personalize 204 cdk_solution_helper_py/helpers_cdk--scheduler/cdk 68 cdk_solution_helper_py/helpers_common cdk_solution_helper_py/helpers_common cdk_solution_helper_py/helpers_cdk--cdk_solution_helper_py/helpers_common 66 cdk_solution_helper_py/helpers_cdk--scheduler/common 58 aws_lambda/create_batch_inference_job aws_lambda/create_batch_inference_job aws_lambda/create_batch_segment_job aws_lambda/create_batch_segment_job aws_lambda/create_batch_inference_job--aws_lambda/create_batch_segment_job 72 aws_lambda/create_solution_version aws_lambda/create_solution_version aws_lambda/create_batch_inference_job--aws_lambda/create_solution_version 55 aws_lambda/create_dataset_import_job aws_lambda/create_dataset_import_job aws_lambda/create_batch_inference_job--aws_lambda/create_dataset_import_job 50 aws_lambda/create_batch_segment_job--aws_lambda/create_solution_version 51 aws_lambda/create_batch_segment_job--aws_lambda/create_dataset_import_job 54 cdk_solution_helper_py/helpers_common--scheduler/cdk 66 cdk_solution_helper_py/helpers_common--scheduler/common 64 aws_lambda/create_filter aws_lambda/create_filter aws_lambda/create_recommender aws_lambda/create_recommender aws_lambda/create_filter--aws_lambda/create_recommender 58 aws_lambda/create_event_tracker aws_lambda/create_event_tracker aws_lambda/create_event_tracker--aws_lambda/create_filter 57 aws_lambda/create_event_tracker--aws_lambda/create_recommender 57 aws_lambda/create_dataset_import_job--aws_lambda/create_solution_version 51

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 324 duplicates...
Size#FoldersFilesLinesCode
63 x 2 source/infrastructure/personalize/step_functions
source/scheduler/cdk/aws_solutions/scheduler/cdk
scheduler_fragment.py
scheduler_fragment.py
17:91 (100%)
17:91 (100%)
view
51 x 2 source/cdk_solution_help...tions/cdk/stepfunctions
source/infrastructure/personalize/step_functions
solution_fragment.py
personalization_fragment.py
24:82 (98%)
24:82 (98%)
view
34 x 2 source/infrastructure/pe...ze/aws_lambda/functions
source/infrastructure/pe...ze/aws_lambda/functions
create_batch_inference_job.py
create_batch_segment_job.py
36:70 (40%)
36:70 (40%)
view
33 x 2 source/infrastructure/personalize/step_functions
source/infrastructure/personalize/step_functions
scheduled_dataset_import.py
scheduled_solution_maintenance.py
56:88 (52%)
77:109 (39%)
view
28 x 2 source/scheduler/cdk/aws...cheduler/cdk/aws_lambda
source/scheduler/cdk/aws...cheduler/cdk/aws_lambda
create_scheduled_task.py
update_scheduled_task.py
46:75 (58%)
46:75 (58%)
view
27 x 2 source/aws_lambda/create_batch_segment_job
source/aws_lambda/create_dataset_import_job
handler.py
handler.py
46:80 (51%)
35:69 (65%)
view
25 x 2 source/aws_lambda/create_batch_inference_job
source/aws_lambda/create_dataset_import_job
handler.py
handler.py
53:85 (43%)
37:69 (60%)
view
25 x 2 source/aws_lambda/create_batch_inference_job
source/aws_lambda/create_batch_segment_job
handler.py
handler.py
53:85 (43%)
48:80 (48%)
view
22 x 2 source/aws_lambda/create_batch_inference_job
source/aws_lambda/create_campaign
handler.py
handler.py
51:75 (38%)
40:64 (47%)
view
22 x 2 source/cdk_solution_help...ons/cdk/aws_lambda/java
source/cdk_solution_help...s/cdk/aws_lambda/python
function.py
function.py
91:117 (28%)
163:189 (17%)
view
21 x 2 source/aws_lambda/create_recommender
source/aws_lambda/create_solution_version
handler.py
handler.py
36:64 (58%)
42:69 (50%)
view
21 x 2 source/aws_lambda/create_solution
source/aws_lambda/create_solution_version
handler.py
handler.py
55:82 (38%)
42:69 (50%)
view
21 x 2 source/aws_lambda/create_recommender
source/aws_lambda/create_solution
handler.py
handler.py
36:64 (58%)
55:82 (38%)
view
21 x 2 source/cdk_solution_help...olutions/cdk/aws_lambda
source/infrastructure/pe...ze/aws_lambda/functions
environment.py
environment.py
22:48 (100%)
22:48 (100%)
view
20 x 2 source/aws_lambda/create_batch_segment_job
source/aws_lambda/create_solution_version
handler.py
handler.py
53:80 (38%)
43:69 (47%)
view
20 x 2 source/aws_lambda/create_campaign
source/aws_lambda/create_dataset_import_job
handler.py
handler.py
42:64 (43%)
37:59 (48%)
view
20 x 2 source/aws_lambda/create_event_tracker
source/aws_lambda/create_solution_version
handler.py
handler.py
31:58 (66%)
43:69 (47%)
view
20 x 2 source/aws_lambda/create_event_tracker
source/aws_lambda/create_solution
handler.py
handler.py
31:58 (66%)
56:82 (36%)
view
20 x 2 source/aws_lambda/create_batch_inference_job
source/aws_lambda/create_event_tracker
handler.py
handler.py
58:85 (35%)
31:58 (66%)
view
20 x 2 source/aws_lambda/create_batch_segment_job
source/aws_lambda/create_recommender
handler.py
handler.py
53:80 (38%)
37:64 (55%)
view
Duplicated Units
The list of top 9 duplicated units.
See data for all 9 unit duplicates...
Size#FoldersFilesLinesCode
22 x 2 source/scheduler/cdk/aws...cheduler/cdk/aws_lambda
source/scheduler/cdk/aws...cheduler/cdk/aws_lambda
update_scheduled_task.py
create_scheduled_task.py
0:0 
0:0 
view
26 x 2 source/cdk_solution_help...ons/cdk/aws_lambda/java
source/cdk_solution_help...s/cdk/aws_lambda/python
function.py
function.py
0:0 
0:0 
view
13 x 2 source/cdk_solution_help...tions/cdk/stepfunctions
source/infrastructure/personalize/step_functions
solution_fragment.py
personalization_fragment.py
0:0 
0:0 
view
12 x 2 source/cdk_solution_help...olutions/cdk/aws_lambda
source/infrastructure/pe...ze/aws_lambda/functions
environment.py
environment.py
0:0 
0:0 
view
9 x 2 source/scheduler/cdk/aws_solutions/scheduler/cdk
source/infrastructure/personalize/step_functions
scheduler_fragment.py
scheduler_fragment.py
0:0 
0:0 
view
10 x 4 source/cdk_solution_helper_py/helpers_cdk
source/cdk_solution_helper_py/helpers_common
source/scheduler/cdk
source/scheduler/common
setup.py
setup.py
setup.py
setup.py
0:0 
0:0 
0:0 
0:0 
view
7 x 2 source/scheduler/cdk/aws...cheduler/cdk/aws_lambda
source/scheduler/cdk/aws...cheduler/cdk/aws_lambda
read_scheduled_task.py
delete_scheduled_task.py
0:0 
0:0 
view
6 x 2 source/cdk_solution_help...sh/src/custom_resources
source/cdk_solution_help...me/src/custom_resources
hash.py
name.py
0:0 
0:0 
view
6 x 2 source/cdk_solution_help...tions/cdk/stepfunctions
source/infrastructure/personalize/step_functions
solution_fragment.py
personalization_fragment.py
0:0 
0:0 
view