summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2018-03-21 12:54:20 -0700
committerGitHub <noreply@github.com>2018-03-21 12:54:20 -0700
commit747bae1be7da455be111bf2c27d97b9bd329adb7 (patch)
tree95721674d98599218fd71648363b47b37117fef7
parent8a3c2532c9062496916eee16248b92fc1c9d8d4a (diff)
parentbd7c5c0fb7dfd6005a8e5bc3944f77230069445e (diff)
downloadchef-747bae1be7da455be111bf2c27d97b9bd329adb7.tar.gz
Merge pull request #7023 from chef/lcg/rubocop-fixes
rubocop fixes from engine bump to 0.54.0
-rw-r--r--lib/chef/chef_fs/command_line.rb18
-rw-r--r--lib/chef/config_fetcher.rb2
-rw-r--r--lib/chef/data_collector.rb4
-rw-r--r--lib/chef/dsl/platform_introspection.rb4
-rw-r--r--lib/chef/file_access_control/unix.rb4
-rw-r--r--lib/chef/knife/deps.rb2
-rw-r--r--lib/chef/monkey_patches/net_http.rb14
-rw-r--r--lib/chef/provider/package/rpm.rb2
-rw-r--r--lib/chef/util/windows/net_user.rb4
-rw-r--r--spec/unit/knife/osc_user_reregister_spec.rb2
-rw-r--r--spec/unit/knife/osc_user_show_spec.rb2
-rw-r--r--spec/unit/user_spec.rb2
12 files changed, 30 insertions, 30 deletions
diff --git a/lib/chef/chef_fs/command_line.rb b/lib/chef/chef_fs/command_line.rb
index 2aefe2fa88..5f449bad04 100644
--- a/lib/chef/chef_fs/command_line.rb
+++ b/lib/chef/chef_fs/command_line.rb
@@ -146,38 +146,38 @@ class Chef
if old_entry.dir?
if new_entry.dir?
if recurse_depth == 0
- return [ [ :common_subdirectories, old_entry, new_entry ] ]
+ [ [ :common_subdirectories, old_entry, new_entry ] ]
else
- return Chef::ChefFS::Parallelizer.parallelize(Chef::ChefFS::FileSystem.child_pairs(old_entry, new_entry)) do |old_child, new_child|
+ Chef::ChefFS::Parallelizer.parallelize(Chef::ChefFS::FileSystem.child_pairs(old_entry, new_entry)) do |old_child, new_child|
Chef::ChefFS::CommandLine.diff_entries(old_child, new_child, recurse_depth ? recurse_depth - 1 : nil, get_content)
end.flatten(1)
end
# If old is a directory and new is a file
elsif new_entry.exists?
- return [ [ :directory_to_file, old_entry, new_entry ] ]
+ [ [ :directory_to_file, old_entry, new_entry ] ]
# If old is a directory and new does not exist
elsif new_entry.parent.can_have_child?(old_entry.name, old_entry.dir?)
- return [ [ :deleted, old_entry, new_entry ] ]
+ [ [ :deleted, old_entry, new_entry ] ]
# If the new entry does not and *cannot* exist, report that.
else
- return [ [ :new_cannot_upload, old_entry, new_entry ] ]
+ [ [ :new_cannot_upload, old_entry, new_entry ] ]
end
# If new is a directory and old is a file
elsif new_entry.dir?
if old_entry.exists?
- return [ [ :file_to_directory, old_entry, new_entry ] ]
+ [ [ :file_to_directory, old_entry, new_entry ] ]
# If new is a directory and old does not exist
elsif old_entry.parent.can_have_child?(new_entry.name, new_entry.dir?)
- return [ [ :added, old_entry, new_entry ] ]
+ [ [ :added, old_entry, new_entry ] ]
# If the new entry does not and *cannot* exist, report that.
else
- return [ [ :old_cannot_upload, old_entry, new_entry ] ]
+ [ [ :old_cannot_upload, old_entry, new_entry ] ]
end
# Neither is a directory, so they are diffable with file diff
@@ -239,7 +239,7 @@ class Chef
end
end
rescue Chef::ChefFS::FileSystem::FileSystemError => e
- return [ [ :error, old_entry, new_entry, nil, nil, e ] ]
+ [ [ :error, old_entry, new_entry, nil, nil, e ] ]
end
class << self
diff --git a/lib/chef/config_fetcher.rb b/lib/chef/config_fetcher.rb
index e14428157c..ad03c845ab 100644
--- a/lib/chef/config_fetcher.rb
+++ b/lib/chef/config_fetcher.rb
@@ -58,7 +58,7 @@ class Chef
Pathname.new(config_location).realpath.to_s
false
rescue Errno::ENOENT
- return true
+ true
end
def http
diff --git a/lib/chef/data_collector.rb b/lib/chef/data_collector.rb
index 6d8b3d6e5f..bee2e88543 100644
--- a/lib/chef/data_collector.rb
+++ b/lib/chef/data_collector.rb
@@ -511,12 +511,12 @@ class Chef
def validate_and_return_uri(uri)
URI(uri)
rescue URI::InvalidURIError
- return nil
+ nil
end
def validate_and_create_file(file)
send_to_file_location(file, "")
- return true
+ true
# Rescue exceptions raised by the file path being non-existent or not writeable and re-raise them to the user
# with clearer explanatory text.
rescue Errno::ENOENT
diff --git a/lib/chef/dsl/platform_introspection.rb b/lib/chef/dsl/platform_introspection.rb
index 2e31e0b95b..734ed40691 100644
--- a/lib/chef/dsl/platform_introspection.rb
+++ b/lib/chef/dsl/platform_introspection.rb
@@ -96,11 +96,11 @@ class Chef
# Lets not break because someone passes a weird string like 'default' :)
Chef::Log.debug(e)
Chef::Log.debug "InvalidCookbookVersion exceptions are common and expected here: the generic constraint matcher attempted to match something which is not a constraint. Moving on to next version or constraint"
- return nil
+ nil
rescue Chef::Exceptions::InvalidPlatformVersion => e
Chef::Log.debug "Caught InvalidPlatformVersion, this means that Chef::Version::Platform does not know how to turn #{node_version} into an x.y.z format"
Chef::Log.debug(e)
- return nil
+ nil
end
def set(platforms, value)
diff --git a/lib/chef/file_access_control/unix.rb b/lib/chef/file_access_control/unix.rb
index 66f724ddd8..ee96bf5045 100644
--- a/lib/chef/file_access_control/unix.rb
+++ b/lib/chef/file_access_control/unix.rb
@@ -132,7 +132,7 @@ class Chef
a.failure_message(Chef::Exceptions::GroupIDNotFound, "cannot determine group id for '#{resource.group}', does the group exist on this system?")
a.whyrun("Assuming group #{resource.group} would have been created")
end
- return nil
+ nil
end
def should_update_group?
@@ -279,7 +279,7 @@ class Chef
a.failure_message(Chef::Exceptions::UserIDNotFound, "cannot determine user id for '#{resource.owner}', does the user exist on this system?")
a.whyrun("Assuming user #{resource.owner} would have been created")
end
- return nil
+ nil
end
def suid_bit_set?
diff --git a/lib/chef/knife/deps.rb b/lib/chef/knife/deps.rb
index b5c6d6379a..eec92cc9a3 100644
--- a/lib/chef/knife/deps.rb
+++ b/lib/chef/knife/deps.rb
@@ -73,7 +73,7 @@ class Chef
def get_dependencies(entry)
if entry.parent && entry.parent.path == "/cookbooks"
- return entry.chef_object.metadata.dependencies.keys.map { |cookbook| "/cookbooks/#{cookbook}" }
+ entry.chef_object.metadata.dependencies.keys.map { |cookbook| "/cookbooks/#{cookbook}" }
elsif entry.parent && entry.parent.path == "/nodes"
node = Chef::JSONCompat.parse(entry.read)
diff --git a/lib/chef/monkey_patches/net_http.rb b/lib/chef/monkey_patches/net_http.rb
index c1cb87bffd..15ccf0fff5 100644
--- a/lib/chef/monkey_patches/net_http.rb
+++ b/lib/chef/monkey_patches/net_http.rb
@@ -33,13 +33,13 @@ if Net::HTTP.instance_methods.map { |m| m.to_s }.include?("proxy_uri")
#
# ruby -r'net/http' -e 'Net::HTTP.new("::1", 80).proxy_uri'
# /Users/ddeleo/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/uri/generic.rb:214:in `initialize': the scheme http does not accept registry part: ::1:80 (or bad hostname?) (URI::InvalidURIError)
- # from /Users/ddeleo/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/uri/http.rb:84:in `initialize'
- # from /Users/ddeleo/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/uri/common.rb:214:in `new'
- # from /Users/ddeleo/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/uri/common.rb:214:in `parse'
- # from /Users/ddeleo/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/uri/common.rb:747:in `parse'
- # from /Users/ddeleo/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/uri/common.rb:994:in `URI'
- # from /Users/ddeleo/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1027:in `proxy_uri'
- # from -e:1:in `<main>'
+ # from /Users/ddeleo/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/uri/http.rb:84:in `initialize'
+ # from /Users/ddeleo/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/uri/common.rb:214:in `new'
+ # from /Users/ddeleo/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/uri/common.rb:214:in `parse'
+ # from /Users/ddeleo/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/uri/common.rb:747:in `parse'
+ # from /Users/ddeleo/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/uri/common.rb:994:in `URI'
+ # from /Users/ddeleo/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1027:in `proxy_uri'
+ # from -e:1:in `<main>'
#
# https://bugs.ruby-lang.org/issues/9129
#
diff --git a/lib/chef/provider/package/rpm.rb b/lib/chef/provider/package/rpm.rb
index d3f9b2f5f0..3061ffccc5 100644
--- a/lib/chef/provider/package/rpm.rb
+++ b/lib/chef/provider/package/rpm.rb
@@ -118,7 +118,7 @@ class Chef
return false unless scheme
%w{http https ftp file}.include?(scheme.downcase)
rescue URI::InvalidURIError
- return false
+ false
end
end
end
diff --git a/lib/chef/util/windows/net_user.rb b/lib/chef/util/windows/net_user.rb
index 059a04d59a..cf8bf3615a 100644
--- a/lib/chef/util/windows/net_user.rb
+++ b/lib/chef/util/windows/net_user.rb
@@ -95,9 +95,9 @@ class Chef::Util::Windows::NetUser < Chef::Util::Windows
def validate_credentials(passwd)
token = Security.logon_user(@username, nil, passwd,
LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT)
- return true
+ true
rescue Chef::Exceptions::Win32APIError
- return false
+ false
end
def get_info
diff --git a/spec/unit/knife/osc_user_reregister_spec.rb b/spec/unit/knife/osc_user_reregister_spec.rb
index ae6b4be9a8..de706dfa42 100644
--- a/spec/unit/knife/osc_user_reregister_spec.rb
+++ b/spec/unit/knife/osc_user_reregister_spec.rb
@@ -19,7 +19,7 @@
require "spec_helper"
# DEPRECATION NOTE
-# This code only remains to support users still operating with
+# This code only remains to support users still operating with
# Open Source Chef Server 11 and should be removed once support
# for OSC 11 ends. New development should occur in user_reregister_spec.rb.
diff --git a/spec/unit/knife/osc_user_show_spec.rb b/spec/unit/knife/osc_user_show_spec.rb
index d6efbef870..ecdb0a9fce 100644
--- a/spec/unit/knife/osc_user_show_spec.rb
+++ b/spec/unit/knife/osc_user_show_spec.rb
@@ -19,7 +19,7 @@
require "spec_helper"
# DEPRECATION NOTE
-# This code only remains to support users still operating with
+# This code only remains to support users still operating with
# Open Source Chef Server 11 and should be removed once support
# for OSC 11 ends. New development should occur user_show_spec.rb.
diff --git a/spec/unit/user_spec.rb b/spec/unit/user_spec.rb
index a1806db987..10a79f6c8a 100644
--- a/spec/unit/user_spec.rb
+++ b/spec/unit/user_spec.rb
@@ -17,7 +17,7 @@
#
# DEPRECATION NOTE
-# This code only remains to support users still operating with
+# This code only remains to support users still operating with
# Open Source Chef Server 11 and should be removed once support
# for OSC 11 ends. New development should occur in user_spec.rb.