From d0dbda11796e819d4a640f9ee58d5a308a109a19 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Thu, 20 Oct 2016 11:54:46 -0700 Subject: fixes for rubocop 0.44.1 engine a few cops we have enabled got a little more accurate/stricter Signed-off-by: Lamont Granquist --- lib/chef/application/client.rb | 4 ++-- lib/chef/application/solo.rb | 2 +- lib/chef/provider/package/windows/exe.rb | 7 ++++--- lib/chef/provider/package/windows/msi.rb | 2 +- spec/spec_helper.rb | 4 ++-- spec/unit/provider/deploy_spec.rb | 2 +- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/chef/application/client.rb b/lib/chef/application/client.rb index cbaa494b71..000aff905b 100644 --- a/lib/chef/application/client.rb +++ b/lib/chef/application/client.rb @@ -202,7 +202,7 @@ class Chef::Application::Client < Chef::Application :short => "-o RunlistItem,RunlistItem...", :long => "--override-runlist RunlistItem,RunlistItem...", :description => "Replace current run list with specified items for a single run", - :proc => lambda {|items| + :proc => lambda { |items| items = items.split(",") items.compact.map do |item| Chef::RunList::RunListItem.new(item) @@ -213,7 +213,7 @@ class Chef::Application::Client < Chef::Application :short => "-r RunlistItem,RunlistItem...", :long => "--runlist RunlistItem,RunlistItem...", :description => "Permanently replace current run list with specified items", - :proc => lambda {|items| + :proc => lambda { |items| items = items.split(",") items.compact.map do |item| Chef::RunList::RunListItem.new(item) diff --git a/lib/chef/application/solo.rb b/lib/chef/application/solo.rb index 446a0f007d..1481338a9c 100644 --- a/lib/chef/application/solo.rb +++ b/lib/chef/application/solo.rb @@ -166,7 +166,7 @@ class Chef::Application::Solo < Chef::Application :short => "-o RunlistItem,RunlistItem...", :long => "--override-runlist RunlistItem,RunlistItem...", :description => "Replace current run list with specified items", - :proc => lambda {|items| + :proc => lambda { |items| items = items.split(",") items.compact.map do |item| Chef::RunList::RunListItem.new(item) diff --git a/lib/chef/provider/package/windows/exe.rb b/lib/chef/provider/package/windows/exe.rb index 44a2f19d1e..60065d9019 100644 --- a/lib/chef/provider/package/windows/exe.rb +++ b/lib/chef/provider/package/windows/exe.rb @@ -89,9 +89,10 @@ class Chef end def current_installed_version - @current_installed_version ||= uninstall_entries.count == 0 ? nil : begin - uninstall_entries.map { |entry| entry.display_version }.uniq - end + @current_installed_version ||= + if uninstall_entries.count != 0 + uninstall_entries.map { |entry| entry.display_version }.uniq + end end # http://unattended.sourceforge.net/installers.php diff --git a/lib/chef/provider/package/windows/msi.rb b/lib/chef/provider/package/windows/msi.rb index ac771688e7..96c6728ef4 100644 --- a/lib/chef/provider/package/windows/msi.rb +++ b/lib/chef/provider/package/windows/msi.rb @@ -50,7 +50,7 @@ class Chef Chef::Log.debug("#{new_resource} checking package status and version for #{product_code}") get_installed_version(product_code) else - uninstall_entries.count == 0 ? nil : begin + if uninstall_entries.count != 0 uninstall_entries.map { |entry| entry.display_version }.uniq end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 47a5ec7f9f..7559e797bc 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -174,13 +174,13 @@ RSpec.configure do |config| running_platform_arch = `uname -m`.strip unless windows? - config.filter_run_excluding :arch => lambda {|target_arch| + config.filter_run_excluding :arch => lambda { |target_arch| running_platform_arch != target_arch } # Functional Resource tests that are provider-specific: # context "on platforms that use useradd", :provider => {:user => Chef::Provider::User::Useradd}} do #... - config.filter_run_excluding :provider => lambda {|criteria| + config.filter_run_excluding :provider => lambda { |criteria| type, target_provider = criteria.first node = TEST_NODE.dup diff --git a/spec/unit/provider/deploy_spec.rb b/spec/unit/provider/deploy_spec.rb index e69714280c..b30ddb736a 100644 --- a/spec/unit/provider/deploy_spec.rb +++ b/spec/unit/provider/deploy_spec.rb @@ -556,7 +556,7 @@ describe Chef::Provider::Deploy do @resource.deploy_to("/my/app") expect(mock_execution).to receive(:user).with("notCoolMan") expect(mock_execution).to receive(:group).with("Ggroup") - expect(mock_execution).to receive(:cwd) {|*args| + expect(mock_execution).to receive(:cwd) { |*args| if args.empty? nil else -- cgit v1.2.1