| Total Complexity | 2 | 
| Total Lines | 17 | 
| 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 | # frozen_string_literal: true | ||
| 10 | class SetMembers < Action | ||
| 11 | attr_accessor :group | ||
| 12 | |||
| 13 | # @param [AMA::Chef::User::Model::Group] group | ||
| 14 | def initialize(group) | ||
| 15 | @group = group | ||
| 16 | end | ||
| 17 | |||
| 18 | def apply(resource_factory) | ||
| 19 | group = @group | ||
| 20 |               resource_factory.group "#{group.id}:members:set" do | ||
| 21 | group_name group.id.to_s | ||
| 22 | members group.members.to_a | ||
| 23 | append false | ||
| 24 | end | ||
| 25 | end | ||
| 26 | end | ||
| 27 | end | ||
| 32 |