summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-11-15 15:03:32 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2016-12-06 13:08:26 -0800
commitdb85ca494a484024404f1090c493613cc9521662 (patch)
treecc655fce7e3bfaa450a697889f2e8f2e5c80d38d
parentd218f942628da9a7302f1cc166abec0ea4fdeba2 (diff)
downloadchef-db85ca494a484024404f1090c493613cc9521662.tar.gz
fix Style/MultilineIfModifier
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--chef-config/lib/chef-config/mixin/fuzzy_hostname_matcher.rb8
-rw-r--r--lib/chef/application.rb7
-rw-r--r--lib/chef/application/windows_service_manager.rb10
-rw-r--r--lib/chef/data_collector.rb12
-rw-r--r--lib/chef/data_collector/messages.rb14
-rw-r--r--lib/chef/provider/osx_profile.rb6
-rw-r--r--lib/chef/resource/file/verification.rb10
-rw-r--r--spec/spec_helper.rb8
8 files changed, 46 insertions, 29 deletions
diff --git a/chef-config/lib/chef-config/mixin/fuzzy_hostname_matcher.rb b/chef-config/lib/chef-config/mixin/fuzzy_hostname_matcher.rb
index 6dd678840a..1c0184a4ce 100644
--- a/chef-config/lib/chef-config/mixin/fuzzy_hostname_matcher.rb
+++ b/chef-config/lib/chef-config/mixin/fuzzy_hostname_matcher.rb
@@ -21,9 +21,11 @@ module ChefConfig
module FuzzyHostnameMatcher
def fuzzy_hostname_match_any?(hostname, matches)
- return matches.to_s.split(/\s*,\s*/).compact.any? do |m|
- fuzzy_hostname_match?(hostname, m)
- end if (hostname != nil) && (matches != nil)
+ if (hostname != nil) && (matches != nil)
+ return matches.to_s.split(/\s*,\s*/).compact.any? do |m|
+ fuzzy_hostname_match?(hostname, m)
+ end
+ end
false
end
diff --git a/lib/chef/application.rb b/lib/chef/application.rb
index e917a4eaf7..cdea2544a3 100644
--- a/lib/chef/application.rb
+++ b/lib/chef/application.rb
@@ -120,9 +120,10 @@ class Chef
end
def set_specific_recipes
- Chef::Config[:specific_recipes] =
- cli_arguments.map { |file| File.expand_path(file) } if
- cli_arguments.respond_to?(:map)
+ if cli_arguments.respond_to?(:map)
+ Chef::Config[:specific_recipes] =
+ cli_arguments.map { |file| File.expand_path(file) }
+ end
end
# Initialize and configure the logger.
diff --git a/lib/chef/application/windows_service_manager.rb b/lib/chef/application/windows_service_manager.rb
index 6f81dccc67..fd0ce0b174 100644
--- a/lib/chef/application/windows_service_manager.rb
+++ b/lib/chef/application/windows_service_manager.rb
@@ -126,10 +126,12 @@ class Chef
:password => @password,
:dependencies => @dependencies
)
- ::Win32::Service.configure(
- :service_name => @service_name,
- :delayed_start => @delayed_start
- ) unless @delayed_start.nil?
+ unless @delayed_start.nil?
+ ::Win32::Service.configure(
+ :service_name => @service_name,
+ :delayed_start => @delayed_start
+ )
+ end
puts "Service '#{@service_name}' has successfully been installed."
end
when "status"
diff --git a/lib/chef/data_collector.rb b/lib/chef/data_collector.rb
index 0e676145eb..df3bce6167 100644
--- a/lib/chef/data_collector.rb
+++ b/lib/chef/data_collector.rb
@@ -462,8 +462,10 @@ class Chef
end
def validate_data_collector_server_url!
- raise Chef::Exceptions::ConfigurationError,
- "Chef::Config[:data_collector][:server_url] is empty. Please supply a valid URL." if data_collector_server_url.empty?
+ if data_collector_server_url.empty?
+ raise Chef::Exceptions::ConfigurationError,
+ "Chef::Config[:data_collector][:server_url] is empty. Please supply a valid URL."
+ end
begin
uri = URI(data_collector_server_url)
@@ -471,8 +473,10 @@ class Chef
raise Chef::Exceptions::ConfigurationError, "Chef::Config[:data_collector][:server_url] (#{data_collector_server_url}) is not a valid URI."
end
- raise Chef::Exceptions::ConfigurationError,
- "Chef::Config[:data_collector][:server_url] (#{data_collector_server_url}) is a URI with no host. Please supply a valid URL." if uri.host.nil?
+ if uri.host.nil?
+ raise Chef::Exceptions::ConfigurationError,
+ "Chef::Config[:data_collector][:server_url] (#{data_collector_server_url}) is a URI with no host. Please supply a valid URL."
+ end
end
end
end
diff --git a/lib/chef/data_collector/messages.rb b/lib/chef/data_collector/messages.rb
index f63242f85e..c0683534a9 100644
--- a/lib/chef/data_collector/messages.rb
+++ b/lib/chef/data_collector/messages.rb
@@ -82,12 +82,14 @@ class Chef
"deprecations" => reporter_data[:deprecations],
}
- message["error"] = {
- "class" => run_status.exception.class,
- "message" => run_status.exception.message,
- "backtrace" => run_status.exception.backtrace,
- "description" => reporter_data[:error_descriptions],
- } if run_status.exception
+ if run_status.exception
+ message["error"] = {
+ "class" => run_status.exception.class,
+ "message" => run_status.exception.message,
+ "backtrace" => run_status.exception.backtrace,
+ "description" => reporter_data[:error_descriptions],
+ }
+ end
message
end
diff --git a/lib/chef/provider/osx_profile.rb b/lib/chef/provider/osx_profile.rb
index 69ecf2ddb9..a25ac9539f 100644
--- a/lib/chef/provider/osx_profile.rb
+++ b/lib/chef/provider/osx_profile.rb
@@ -44,8 +44,10 @@ class Chef
)
@new_profile_hash = get_profile_hash(@new_resource.profile)
- @new_profile_hash["PayloadUUID"] =
- config_uuid(@new_profile_hash) if @new_profile_hash
+ if @new_profile_hash
+ @new_profile_hash["PayloadUUID"] =
+ config_uuid(@new_profile_hash)
+ end
if @new_profile_hash
@new_profile_identifier = @new_profile_hash["PayloadIdentifier"]
diff --git a/lib/chef/resource/file/verification.rb b/lib/chef/resource/file/verification.rb
index cf5585e5cf..3400684bc5 100644
--- a/lib/chef/resource/file/verification.rb
+++ b/lib/chef/resource/file/verification.rb
@@ -108,10 +108,12 @@ class Chef
def verify_command(path, opts)
# First implementation interpolated `file`; docs & RFC claim `path`
# is interpolated. Until `file` can be deprecated, interpolate both.
- Chef.deprecated(:verify_file,
- "%{file} is deprecated in verify command and will not be "\
- "supported in Chef 13. Please use %{path} instead."
- ) if @command.include?("%{file}")
+ if @command.include?("%{file}")
+ Chef.deprecated(:verify_file,
+ "%{file} is deprecated in verify command and will not be "\
+ "supported in Chef 13. Please use %{path} instead."
+ )
+ end
command = @command % { :file => path, :path => path }
interpreter = Chef::GuardInterpreter.for_resource(@parent_resource, command, @command_opts)
interpreter.evaluate
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index dff2450dd8..9fd8e935c7 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -218,9 +218,11 @@ RSpec.configure do |config|
end
# raise if anyone commits any test to CI with :focus set on it
- config.before(:example, :focus) do
- raise "This example was committed with `:focus` and should not have been"
- end if ENV["CI"]
+ if ENV["CI"]
+ config.before(:example, :focus) do
+ raise "This example was committed with `:focus` and should not have been"
+ end
+ end
config.before(:suite) do
ARGV.clear