Total Complexity | 2 |
Total Lines | 19 |
Duplicated Lines | 100 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
1 | module Awspec::Generator |
||
3 | View Code Duplication | class RdsDbParameterGroup |
|
|
|||
4 | include Awspec::Helper::Finder |
||
5 | def generate_by_paramater_group(paramater_group) |
||
6 | @paramater_group = paramater_group |
||
7 | res = select_all_rds_db_parameters(@paramater_group) |
||
8 | ERB.new(db_paramater_group_template, nil, '-').result(binding).gsub(/^\n/, '') |
||
9 | end |
||
10 | |||
11 | def db_paramater_group_template |
||
12 | template = <<-'EOF' |
||
13 | describe rds_db_parameter_group('<%= @paramater_group %>') do |
||
14 | <% res.each do |key, value| %> |
||
15 | its('<%= key %>') { should eq '<%= value %>' } |
||
16 | <% end %> |
||
17 | end |
||
18 | EOF |
||
19 | template |
||
20 | end |
||
21 | end |
||
22 | end |
||
24 |