aws-samples / terraform-sample-workshop
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
  • 79% duplication:
    • 1,346 cleaned lines of cleaned code (without empty lines, comments, and frequently duplicated constructs such as imports)
    • 1,074 duplicated lines
  • 49 duplicates
system79% (1,074 lines)
Duplication per Extension
tf79% (1,074 lines)
Duplication per Component (primary)
module_1/one_file_tf/simple_nginx_stack59% (155 lines)
module_2/modularized_tf/modules/providers/aws/vpc100% (154 lines)
module_3/modularized_tf/base_modules/providers/aws/vpc100% (154 lines)
module_2/modularized_tf/modules/providers/aws/asg97% (98 lines)
module_3/modularized_tf/base_modules/providers/aws/asg97% (98 lines)
module_2/modularized_tf/environments/providers/aws/prd58% (92 lines)
module_3/modularized_tf/environments/providers/aws/prd86% (66 lines)
module_2/modularized_tf/modules/providers/aws/elb100% (51 lines)
module_3/modularized_tf/base_modules/providers/aws/elb100% (51 lines)
module_3/modularized_tf/component_modules/nginx-webserver-stack42% (39 lines)
module_2/modularized_tf/modules/providers/aws/launch_config91% (31 lines)
module_3/modularized_tf/base_modules/providers/aws/launch_config91% (31 lines)
module_2/modularized_tf/modules/providers/aws/security_group67% (27 lines)
module_3/modularized_tf/base_modules/providers/aws/security_group67% (27 lines)

Duplication Between Components (50+ lines)

G module_2/modularized_tf/modules/providers/aws/vpc module_2/modularized_tf/modules/providers/aws/vpc module_3/modularized_tf/base_modules/providers/aws/vpc module_3/modularized_tf/base_modules/providers/aws/vpc module_2/modularized_tf/modules/providers/aws/vpc--module_3/modularized_tf/base_modules/providers/aws/vpc 308 module_1/one_file_tf/simple_nginx_stack module_1/one_file_tf/simple_nginx_stack module_1/one_file_tf/simple_nginx_stack--module_2/modularized_tf/modules/providers/aws/vpc 250 module_1/one_file_tf/simple_nginx_stack--module_3/modularized_tf/base_modules/providers/aws/vpc 250 module_2/modularized_tf/modules/providers/aws/asg module_2/modularized_tf/modules/providers/aws/asg module_3/modularized_tf/base_modules/providers/aws/asg module_3/modularized_tf/base_modules/providers/aws/asg module_2/modularized_tf/modules/providers/aws/asg--module_3/modularized_tf/base_modules/providers/aws/asg 196 module_2/modularized_tf/environments/providers/aws/prd module_2/modularized_tf/environments/providers/aws/prd module_3/modularized_tf/environments/providers/aws/prd module_3/modularized_tf/environments/providers/aws/prd module_2/modularized_tf/environments/providers/aws/prd--module_3/modularized_tf/environments/providers/aws/prd 146 module_3/modularized_tf/component_modules/nginx-webserver-stack module_3/modularized_tf/component_modules/nginx-webserver-stack module_2/modularized_tf/environments/providers/aws/prd--module_3/modularized_tf/component_modules/nginx-webserver-stack 78 module_2/modularized_tf/modules/providers/aws/elb module_2/modularized_tf/modules/providers/aws/elb module_3/modularized_tf/base_modules/providers/aws/elb module_3/modularized_tf/base_modules/providers/aws/elb module_2/modularized_tf/modules/providers/aws/elb--module_3/modularized_tf/base_modules/providers/aws/elb 102 module_3/modularized_tf/component_modules/nginx-webserver-stack--module_3/modularized_tf/environments/providers/aws/prd 66 module_2/modularized_tf/modules/providers/aws/launch_config module_2/modularized_tf/modules/providers/aws/launch_config module_3/modularized_tf/base_modules/providers/aws/launch_config module_3/modularized_tf/base_modules/providers/aws/launch_config module_2/modularized_tf/modules/providers/aws/launch_config--module_3/modularized_tf/base_modules/providers/aws/launch_config 62 module_2/modularized_tf/modules/providers/aws/security_group module_2/modularized_tf/modules/providers/aws/security_group module_3/modularized_tf/base_modules/providers/aws/security_group module_3/modularized_tf/base_modules/providers/aws/security_group module_2/modularized_tf/modules/providers/aws/security_group--module_3/modularized_tf/base_modules/providers/aws/security_group 54

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 49 duplicates...
Size#FoldersFilesLinesCode
104 x 2 module_2/modularized_tf/modules/providers/aws/vpc
module_3/modularized_tf/...dules/providers/aws/vpc
main.tf
main.tf
5:135 (100%)
5:135 (100%)
view
104 x 2 module_1/one_file_tf/simple_nginx_stack
module_2/modularized_tf/modules/providers/aws/vpc
main.tf
main.tf
20:150 (49%)
5:135 (100%)
view
104 x 2 module_1/one_file_tf/simple_nginx_stack
module_3/modularized_tf/...dules/providers/aws/vpc
main.tf
main.tf
20:150 (49%)
5:135 (100%)
view
70 x 2 module_2/modularized_tf/modules/providers/aws/asg
module_3/modularized_tf/...dules/providers/aws/asg
main.tf
main.tf
5:83 (100%)
5:83 (100%)
view
33 x 2 module_2/modularized_tf/...ions/nginx-sample-stack
module_3/modularized_tf/...s/nginx-webserver-stack
vars.tf
vars.tf
5:48 (100%)
5:48 (89%)
view
33 x 2 module_2/modularized_tf/...ions/nginx-sample-stack
module_3/modularized_tf/...ions/nginx-sample-stack
vars.tf
vars.tf
5:48 (100%)
5:48 (100%)
view
33 x 2 module_3/modularized_tf/...s/nginx-webserver-stack
module_3/modularized_tf/...ions/nginx-sample-stack
vars.tf
vars.tf
5:48 (89%)
5:48 (100%)
view
28 x 2 module_2/modularized_tf/modules/providers/aws/asg
module_3/modularized_tf/...dules/providers/aws/asg
vars.tf
vars.tf
5:44 (100%)
5:44 (100%)
view
26 x 2 module_2/modularized_tf/modules/providers/aws/vpc
module_3/modularized_tf/...dules/providers/aws/vpc
vars.tf
vars.tf
5:37 (100%)
5:37 (100%)
view
24 x 2 module_2/modularized_tf/modules/providers/aws/vpc
module_3/modularized_tf/...dules/providers/aws/vpc
output.tf
output.tf
5:35 (100%)
5:35 (100%)
view
23 x 2 module_2/modularized_tf/modules/providers/aws/elb
module_3/modularized_tf/...dules/providers/aws/elb
vars.tf
vars.tf
5:35 (100%)
5:35 (100%)
view
22 x 2 module_2/modularized_tf/modules/providers/aws/elb
module_3/modularized_tf/...dules/providers/aws/elb
main.tf
main.tf
5:28 (100%)
5:28 (100%)
view
21 x 2 module_1/one_file_tf/simple_nginx_stack
module_3/modularized_tf/...dules/providers/aws/vpc
vars.tf
vars.tf
13:39 (42%)
11:37 (80%)
view
21 x 2 module_1/one_file_tf/simple_nginx_stack
module_2/modularized_tf/modules/providers/aws/vpc
vars.tf
vars.tf
13:39 (42%)
11:37 (80%)
view
19 x 2 module_2/modularized_tf/...iders/aws/launch_config
module_3/modularized_tf/...iders/aws/launch_config
main.tf
main.tf
5:27 (100%)
5:27 (100%)
view
15 x 2 module_2/modularized_tf/...ions/nginx-sample-stack
module_3/modularized_tf/...ions/nginx-sample-stack
main.tf
main.tf
5:21 (22%)
5:21 (68%)
view
12 x 2 module_2/modularized_tf/...iders/aws/launch_config
module_3/modularized_tf/...iders/aws/launch_config
vars.tf
vars.tf
5:23 (100%)
5:23 (100%)
view
11 x 2 module_2/modularized_tf/...ecurity_group/create_sg
module_3/modularized_tf/...ecurity_group/create_sg
main.tf
main.tf
5:16 (100%)
5:16 (100%)
view
9 x 2 module_3/modularized_tf/...dules/providers/aws/asg
module_3/modularized_tf/...dules/providers/aws/asg
main.tf
main.tf
16:24 (12%)
45:53 (12%)
view
9 x 2 module_2/modularized_tf/...ions/nginx-sample-stack
module_3/modularized_tf/...ions/nginx-sample-stack
data.tf
data.tf
5:14 (100%)
5:14 (100%)
view