From 7a3ca23fd977ca4f894cba54f76d64a77562f012 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Tue, 15 Nov 2016 15:09:41 -0800 Subject: fix Style/VariableInterpolation Signed-off-by: Lamont Granquist --- lib/chef/cookbook/chefignore.rb | 2 +- lib/chef/cookbook/cookbook_version_loader.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/chef/cookbook') diff --git a/lib/chef/cookbook/chefignore.rb b/lib/chef/cookbook/chefignore.rb index 71ef53c9e5..dce58ecdb8 100644 --- a/lib/chef/cookbook/chefignore.rb +++ b/lib/chef/cookbook/chefignore.rb @@ -52,7 +52,7 @@ class Chef ignore_globs << line.strip unless line =~ COMMENTS_AND_WHITESPACE end else - Chef::Log.debug("No chefignore file found at #@ignore_file no files will be ignored") + Chef::Log.debug("No chefignore file found at #{@ignore_file} no files will be ignored") end ignore_globs end diff --git a/lib/chef/cookbook/cookbook_version_loader.rb b/lib/chef/cookbook/cookbook_version_loader.rb index af8b2e043e..d253c956b2 100644 --- a/lib/chef/cookbook/cookbook_version_loader.rb +++ b/lib/chef/cookbook/cookbook_version_loader.rb @@ -308,7 +308,7 @@ class Chef begin @metadata.from_file(file) rescue Chef::Exceptions::JSON::ParseError - Chef::Log.error("Error evaluating metadata.rb for #@inferred_cookbook_name in " + file) + Chef::Log.error("Error evaluating metadata.rb for #{@inferred_cookbook_name} in " + file) raise end end @@ -317,7 +317,7 @@ class Chef begin @metadata.from_json(IO.read(file)) rescue Chef::Exceptions::JSON::ParseError - Chef::Log.error("Couldn't parse cookbook metadata JSON for #@inferred_cookbook_name in " + file) + Chef::Log.error("Couldn't parse cookbook metadata JSON for #{@inferred_cookbook_name} in " + file) raise end end @@ -336,7 +336,7 @@ class Chef # metadata contains a name key. @metadata.name(data["cookbook_name"]) unless data["metadata"].key?("name") rescue Chef::Exceptions::JSON::ParseError - Chef::Log.error("Couldn't parse cookbook metadata JSON for #@inferred_cookbook_name in " + file) + Chef::Log.error("Couldn't parse cookbook metadata JSON for #{@inferred_cookbook_name} in " + file) raise end end @@ -347,7 +347,7 @@ class Chef data = Chef::JSONCompat.parse(IO.read(uploaded_cookbook_version_file)) @frozen = data["frozen?"] rescue Chef::Exceptions::JSON::ParseError - Chef::Log.error("Couldn't parse cookbook metadata JSON for #@inferred_cookbook_name in #{uploaded_cookbook_version_file}") + Chef::Log.error("Couldn't parse cookbook metadata JSON for #{@inferred_cookbook_name} in #{uploaded_cookbook_version_file}") raise end end -- cgit v1.2.1 From 76427185b3dddfc9901dc2cbe5f1f7a6c9af661c Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Tue, 15 Nov 2016 15:13:44 -0800 Subject: fix Style/NilComparison Signed-off-by: Lamont Granquist --- lib/chef/cookbook/metadata.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/chef/cookbook') diff --git a/lib/chef/cookbook/metadata.rb b/lib/chef/cookbook/metadata.rb index 02f9831d70..65307c455b 100644 --- a/lib/chef/cookbook/metadata.rb +++ b/lib/chef/cookbook/metadata.rb @@ -862,12 +862,12 @@ INVALID return if !options[:choice].is_a?(Array) || options[:choice].empty? if options[:default].is_a?(String) && options[:default] != "" - raise ArgumentError, "Default must be one of your choice values!" if options[:choice].index(options[:default]) == nil + raise ArgumentError, "Default must be one of your choice values!" if options[:choice].index(options[:default]).nil? end if options[:default].is_a?(Array) && !options[:default].empty? options[:default].each do |val| - raise ArgumentError, "Default values must be a subset of your choice values!" if options[:choice].index(val) == nil + raise ArgumentError, "Default values must be a subset of your choice values!" if options[:choice].index(val).nil? end end end -- cgit v1.2.1