| 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_parameter_group(parameter_group) |
||
| 6 | @parameter_group = parameter_group |
||
| 7 | res = select_all_rds_db_parameters(@parameter_group) |
||
| 8 | ERB.new(db_parameter_group_template, nil, '-').result(binding).gsub(/^\n/, '') |
||
| 9 | end |
||
| 10 | |||
| 11 | def db_parameter_group_template |
||
| 12 | template = <<-'EOF' |
||
| 13 | describe rds_db_parameter_group('<%= @parameter_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 |