diff options
author | Tim Smith <tsmith@chef.io> | 2020-08-06 15:54:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-06 15:54:35 -0700 |
commit | 9c4beaff4c84f6e2f5748e15ac9f6f1b6adf1919 (patch) | |
tree | df5d6e3744bb23200f9b193db2efaa6533cc5bbc | |
parent | 96953d42f369f3c128c82448434c953379b9fe47 (diff) | |
parent | 777d8183baf58f6f3fbc8befe51c8801d76beb74 (diff) | |
download | chef-9c4beaff4c84f6e2f5748e15ac9f6f1b6adf1919.tar.gz |
Merge pull request #10269 from chef/rubocop_Style_RedundantAssignment
Resolve Style/RedundantAssignment warnings
-rw-r--r-- | chef-config/lib/chef-config/workstation_config_loader.rb | 12 | ||||
-rw-r--r-- | lib/chef/node/attribute.rb | 6 | ||||
-rw-r--r-- | lib/chef/resource_collection/stepable_iterator.rb | 3 |
3 files changed, 8 insertions, 13 deletions
diff --git a/chef-config/lib/chef-config/workstation_config_loader.rb b/chef-config/lib/chef-config/workstation_config_loader.rb index 846ca674e1..4e44a24fd7 100644 --- a/chef-config/lib/chef-config/workstation_config_loader.rb +++ b/chef-config/lib/chef-config/workstation_config_loader.rb @@ -140,13 +140,11 @@ module ChefConfig end def working_directory - a = if ChefUtils.windows? - env["CD"] - else - env["PWD"] - end || Dir.pwd - - a + if ChefUtils.windows? + env["CD"] + else + env["PWD"] + end || Dir.pwd end def apply_credentials(creds, profile) diff --git a/lib/chef/node/attribute.rb b/lib/chef/node/attribute.rb index e9a48d8b0e..29b60a98d5 100644 --- a/lib/chef/node/attribute.rb +++ b/lib/chef/node/attribute.rb @@ -563,11 +563,10 @@ class Chef # @param path [Array] Array of args to method chain to descend into the node object # @return [attr] Deep Merged values (may be VividMash, Hash, Array, etc) from the node object def merge_defaults(path) - ret = DEFAULT_COMPONENTS.inject(NIL) do |merged, component_ivar| + DEFAULT_COMPONENTS.inject(NIL) do |merged, component_ivar| component_value = apply_path(instance_variable_get(component_ivar), path) deep_merge!(merged, component_value) end - ret end # Deep merge the override attribute levels with array merging. @@ -577,11 +576,10 @@ class Chef # @param path [Array] Array of args to method chain to descend into the node object # @return [attr] Deep Merged values (may be VividMash, Hash, Array, etc) from the node object def merge_overrides(path) - ret = OVERRIDE_COMPONENTS.inject(NIL) do |merged, component_ivar| + OVERRIDE_COMPONENTS.inject(NIL) do |merged, component_ivar| component_value = apply_path(instance_variable_get(component_ivar), path) deep_merge!(merged, component_value) end - ret end # needed for __path__ diff --git a/lib/chef/resource_collection/stepable_iterator.rb b/lib/chef/resource_collection/stepable_iterator.rb index d010c29be5..24a8f676d5 100644 --- a/lib/chef/resource_collection/stepable_iterator.rb +++ b/lib/chef/resource_collection/stepable_iterator.rb @@ -20,8 +20,7 @@ class Chef class StepableIterator def self.for_collection(new_collection) - instance = new(new_collection) - instance + new(new_collection) end attr_accessor :collection |