summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-11-15 15:04:53 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2016-12-06 13:08:26 -0800
commit2e92c709459dffef54f9d671e10ec9a949a94962 (patch)
tree7b24e597c763df50cf4459e7bfa9f8bb1a5014d9
parentdb85ca494a484024404f1090c493613cc9521662 (diff)
downloadchef-2e92c709459dffef54f9d671e10ec9a949a94962.tar.gz
fix Style/SelfAssignment
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--lib/chef/chef_fs/chef_fs_data_store.rb2
-rw-r--r--lib/chef/encrypted_data_bag_item.rb2
-rw-r--r--lib/chef/environment.rb2
-rw-r--r--lib/chef/knife/core/ui.rb2
-rw-r--r--lib/chef/mixin/deep_merge.rb2
-rw-r--r--lib/chef/mixin/wide_string.rb2
-rw-r--r--spec/functional/resource/user/useradd_spec.rb2
-rw-r--r--spec/unit/decorator/lazy_spec.rb2
-rw-r--r--tasks/gemfile_util.rb4
9 files changed, 10 insertions, 10 deletions
diff --git a/lib/chef/chef_fs/chef_fs_data_store.rb b/lib/chef/chef_fs/chef_fs_data_store.rb
index 6b3e830f8d..9893cf7245 100644
--- a/lib/chef/chef_fs/chef_fs_data_store.rb
+++ b/lib/chef/chef_fs/chef_fs_data_store.rb
@@ -326,7 +326,7 @@ class Chef
else
relative << path[1]
end
- relative = relative + file[:path].split("/")
+ relative += file[:path].split("/")
file["url"] = ChefZero::RestBase.build_uri(request.base_uri, relative)
end
end
diff --git a/lib/chef/encrypted_data_bag_item.rb b/lib/chef/encrypted_data_bag_item.rb
index e696199c63..d30c7945e9 100644
--- a/lib/chef/encrypted_data_bag_item.rb
+++ b/lib/chef/encrypted_data_bag_item.rb
@@ -121,7 +121,7 @@ class Chef::EncryptedDataBagItem
#
def self.load(data_bag, name, secret = nil)
raw_hash = Chef::DataBagItem.load(data_bag, name)
- secret = secret || self.load_secret
+ secret ||= self.load_secret
self.new(raw_hash, secret)
end
diff --git a/lib/chef/environment.rb b/lib/chef/environment.rb
index c41df768b9..eb335b0237 100644
--- a/lib/chef/environment.rb
+++ b/lib/chef/environment.rb
@@ -171,7 +171,7 @@ class Chef
unless params[:cookbook_version].nil?
params[:cookbook_version].each do |index, cookbook_constraint_spec|
unless cookbook_constraint_spec.nil? || cookbook_constraint_spec.size == 0
- valid = valid && update_cookbook_constraint_from_param(index, cookbook_constraint_spec)
+ valid &&= update_cookbook_constraint_from_param(index, cookbook_constraint_spec)
end
end
end
diff --git a/lib/chef/knife/core/ui.rb b/lib/chef/knife/core/ui.rb
index 0e07dd704f..e9a9a236c2 100644
--- a/lib/chef/knife/core/ui.rb
+++ b/lib/chef/knife/core/ui.rb
@@ -138,7 +138,7 @@ class Chef
end
def ask_question(question, opts = {})
- question = question + "[#{opts[:default]}] " if opts[:default]
+ question += "[#{opts[:default]}] " if opts[:default]
if opts[:default] && config[:defaults]
opts[:default]
diff --git a/lib/chef/mixin/deep_merge.rb b/lib/chef/mixin/deep_merge.rb
index c0b2d0d0c5..7016b08ff7 100644
--- a/lib/chef/mixin/deep_merge.rb
+++ b/lib/chef/mixin/deep_merge.rb
@@ -75,7 +75,7 @@ class Chef
end
when Array
if dest.kind_of?(Array)
- dest = dest | source
+ dest |= source
else
dest = source
end
diff --git a/lib/chef/mixin/wide_string.rb b/lib/chef/mixin/wide_string.rb
index 4342ef1650..ef7828e2d8 100644
--- a/lib/chef/mixin/wide_string.rb
+++ b/lib/chef/mixin/wide_string.rb
@@ -34,7 +34,7 @@ class Chef
ustring = (ustring + "").force_encoding("UTF-8") if ustring.respond_to?(:force_encoding) && ustring.encoding.name != "UTF-8"
# ensure we have the double-null termination Windows Wide likes
- ustring = ustring + "\000\000" if ustring.length == 0 || ustring[-1].chr != "\000"
+ ustring += "\000\000" if ustring.length == 0 || ustring[-1].chr != "\000"
# encode it all as UTF-16LE AKA Windows Wide Character AKA Windows Unicode
ustring = begin
diff --git a/spec/functional/resource/user/useradd_spec.rb b/spec/functional/resource/user/useradd_spec.rb
index 874155c107..268ce5c9d2 100644
--- a/spec/functional/resource/user/useradd_spec.rb
+++ b/spec/functional/resource/user/useradd_spec.rb
@@ -119,7 +119,7 @@ describe Chef::Provider::User::Useradd, metadata do
break if status.exitstatus != 8
sleep 1
- max_retries = max_retries - 1
+ max_retries -= 1
rescue UserNotFound
break
end
diff --git a/spec/unit/decorator/lazy_spec.rb b/spec/unit/decorator/lazy_spec.rb
index 4ea8301b63..46c8955ae8 100644
--- a/spec/unit/decorator/lazy_spec.rb
+++ b/spec/unit/decorator/lazy_spec.rb
@@ -21,7 +21,7 @@ require "spec_helper"
describe Chef::Decorator::Lazy do
let(:decorator) do
@a = 0
- Chef::Decorator::Lazy.new { @a = @a + 1 }
+ Chef::Decorator::Lazy.new { @a += 1 }
end
it "decorates an object" do
diff --git a/tasks/gemfile_util.rb b/tasks/gemfile_util.rb
index e21299705a..03a729148a 100644
--- a/tasks/gemfile_util.rb
+++ b/tasks/gemfile_util.rb
@@ -255,8 +255,8 @@ module GemfileUtil
result = {}
gems.each do |name, g|
dep_groups = g[:declared_groups] - [ :only_a_runtime_dependency_of_other_gems ]
- dep_groups = dep_groups & groups if groups
- dep_groups = dep_groups - without_groups if without_groups
+ dep_groups &= groups if groups
+ dep_groups -= without_groups if without_groups
if dep_groups.any?
result[name] ||= g
g[:dependencies].each do |dep|