summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-06-28 09:01:33 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2016-06-28 09:01:33 -0700
commitc6886235e5b8bf6956d16f5d48fd1035418fbc68 (patch)
treeef3c19eb7ab397b21912d2c94e58ce34e9d23be1
parent945f23be7a43d90ae7ed402d05363b3ff0c11bff (diff)
downloadchef-lcg/rubocop-0.41.1.tar.gz
fixes for rubocop 0.41.1lcg/rubocop-0.41.1
looks like existing rubocop rules got more accurate.
-rw-r--r--lib/chef/application/client.rb8
-rw-r--r--lib/chef/application/solo.rb4
-rw-r--r--lib/chef/chef_fs/data_handler/data_handler_base.rb2
-rw-r--r--lib/chef/mixin/powershell_type_coercions.rb2
-rw-r--r--lib/chef/monkey_patches/webrick-utils.rb2
-rw-r--r--lib/chef/node/attribute.rb2
-rw-r--r--lib/chef/provider/package/yum/yum_cache.rb2
-rw-r--r--lib/chef/provider/remote_file/ftp.rb2
-rw-r--r--lib/chef/provider/remote_file/sftp.rb2
-rw-r--r--lib/chef/resource.rb2
-rw-r--r--lib/chef/resource_builder.rb2
-rw-r--r--lib/chef/search/query.rb4
-rw-r--r--spec/functional/rebooter_spec.rb10
-rw-r--r--spec/functional/resource/dsc_script_spec.rb3
14 files changed, 23 insertions, 24 deletions
diff --git a/lib/chef/application/client.rb b/lib/chef/application/client.rb
index 77c86ad559..62d4c816d9 100644
--- a/lib/chef/application/client.rb
+++ b/lib/chef/application/client.rb
@@ -193,9 +193,9 @@ 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 {|item|
+ items.compact.map { |item|
Chef::RunList::RunListItem.new(item)
}
}
@@ -204,9 +204,9 @@ 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 {|item|
+ items.compact.map { |item|
Chef::RunList::RunListItem.new(item)
}
}
diff --git a/lib/chef/application/solo.rb b/lib/chef/application/solo.rb
index d2516926c4..9aa5bf206f 100644
--- a/lib/chef/application/solo.rb
+++ b/lib/chef/application/solo.rb
@@ -157,9 +157,9 @@ 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 {|item|
+ items.compact.map { |item|
Chef::RunList::RunListItem.new(item)
}
}
diff --git a/lib/chef/chef_fs/data_handler/data_handler_base.rb b/lib/chef/chef_fs/data_handler/data_handler_base.rb
index b34aff4b98..8fab561918 100644
--- a/lib/chef/chef_fs/data_handler/data_handler_base.rb
+++ b/lib/chef/chef_fs/data_handler/data_handler_base.rb
@@ -93,7 +93,7 @@ class Chef
# name to recipe[name]. Then calls uniq on the result.
#
def normalize_run_list(run_list)
- run_list.map {|item|
+ run_list.map { |item|
case item.to_s
when /^recipe\[.*\]$/
item # explicit recipe
diff --git a/lib/chef/mixin/powershell_type_coercions.rb b/lib/chef/mixin/powershell_type_coercions.rb
index 381cbed637..6159c87948 100644
--- a/lib/chef/mixin/powershell_type_coercions.rb
+++ b/lib/chef/mixin/powershell_type_coercions.rb
@@ -63,7 +63,7 @@ class Chef
end
def unsafe?(s)
- ["'", '#', "`", '"'].any? do |x|
+ ["'", "#", "`", '"'].any? do |x|
s.include? x
end
end
diff --git a/lib/chef/monkey_patches/webrick-utils.rb b/lib/chef/monkey_patches/webrick-utils.rb
index 7880adb202..bce9243e0e 100644
--- a/lib/chef/monkey_patches/webrick-utils.rb
+++ b/lib/chef/monkey_patches/webrick-utils.rb
@@ -31,7 +31,7 @@ module WEBrick
Socket::AI_PASSIVE) # flag
last_error = nil
sockets = []
- res.each {|ai|
+ res.each { |ai|
begin
logger.debug("TCPServer.new(#{ai[3]}, #{port})") if logger
sock = TCPServer.new(ai[3], port)
diff --git a/lib/chef/node/attribute.rb b/lib/chef/node/attribute.rb
index ab97cf99bf..937788fd90 100644
--- a/lib/chef/node/attribute.rb
+++ b/lib/chef/node/attribute.rb
@@ -480,7 +480,7 @@ class Chef
end
def inspect
- "#<#{self.class} " << (COMPONENTS + [:@merged_attributes, :@properties]).map {|iv|
+ "#<#{self.class} " << (COMPONENTS + [:@merged_attributes, :@properties]).map { |iv|
"#{iv}=#{instance_variable_get(iv).inspect}"
}.join(", ") << ">"
end
diff --git a/lib/chef/provider/package/yum/yum_cache.rb b/lib/chef/provider/package/yum/yum_cache.rb
index fb25a91c8c..7462529113 100644
--- a/lib/chef/provider/package/yum/yum_cache.rb
+++ b/lib/chef/provider/package/yum/yum_cache.rb
@@ -197,7 +197,7 @@ class Chef
def shabang?(file)
::File.open(file, "r") do |f|
- f.read(2) == '#!'
+ f.read(2) == "#!"
end
rescue Errno::ENOENT
false
diff --git a/lib/chef/provider/remote_file/ftp.rb b/lib/chef/provider/remote_file/ftp.rb
index 5935e83301..22eea41aa3 100644
--- a/lib/chef/provider/remote_file/ftp.rb
+++ b/lib/chef/provider/remote_file/ftp.rb
@@ -153,7 +153,7 @@ class Chef
def parse_path
path = uri.path.sub(%r{\A/}, "%2F") # re-encode the beginning slash because uri library decodes it.
directories = path.split(%r{/}, -1)
- directories.each {|d|
+ directories.each { |d|
d.gsub!(/%([0-9A-Fa-f][0-9A-Fa-f])/) { [$1].pack("H2") }
}
unless filename = directories.pop
diff --git a/lib/chef/provider/remote_file/sftp.rb b/lib/chef/provider/remote_file/sftp.rb
index 530977e3c8..751c21eb82 100644
--- a/lib/chef/provider/remote_file/sftp.rb
+++ b/lib/chef/provider/remote_file/sftp.rb
@@ -68,7 +68,7 @@ class Chef
def validate_path!
path = uri.path.sub(%r{\A/}, "%2F") # re-encode the beginning slash because uri library decodes it.
directories = path.split(%r{/}, -1)
- directories.each {|d|
+ directories.each { |d|
d.gsub!(/%([0-9A-Fa-f][0-9A-Fa-f])/) { [$1].pack("H2") }
}
unless filename = directories.pop
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb
index 262aa84781..38d37d9944 100644
--- a/lib/chef/resource.rb
+++ b/lib/chef/resource.rb
@@ -1270,7 +1270,7 @@ class Chef
run_context.immediate_notifications(self).each { |n|
n.resolve_resource_reference(run_context.resource_collection)
}
- run_context.delayed_notifications(self).each {|n|
+ run_context.delayed_notifications(self).each { |n|
n.resolve_resource_reference(run_context.resource_collection)
}
end
diff --git a/lib/chef/resource_builder.rb b/lib/chef/resource_builder.rb
index d1f5c2e022..e31fa9e3f8 100644
--- a/lib/chef/resource_builder.rb
+++ b/lib/chef/resource_builder.rb
@@ -31,7 +31,7 @@ class Chef
attr_reader :resource
# FIXME (ruby-2.1 syntax): most of these are mandatory
- def initialize(type:nil, name:nil, created_at: nil, params: nil, run_context: nil, cookbook_name: nil, recipe_name: nil, enclosing_provider: nil)
+ def initialize(type: nil, name: nil, created_at: nil, params: nil, run_context: nil, cookbook_name: nil, recipe_name: nil, enclosing_provider: nil)
@type = type
@name = name
@created_at = created_at
diff --git a/lib/chef/search/query.rb b/lib/chef/search/query.rb
index ebf13bec36..024ec38a16 100644
--- a/lib/chef/search/query.rb
+++ b/lib/chef/search/query.rb
@@ -29,7 +29,7 @@ class Chef
attr_accessor :rest
attr_reader :config
- def initialize(url = nil, config:Chef::Config)
+ def initialize(url = nil, config: Chef::Config)
@config = config
@url = url
end
@@ -146,7 +146,7 @@ WARNDEP
qstr
end
- def call_rest_service(type, query:"*:*", rows:nil, start:0, sort:"X_CHEF_id_CHEF_X asc", filter_result:nil)
+ def call_rest_service(type, query: "*:*", rows: nil, start: 0, sort: "X_CHEF_id_CHEF_X asc", filter_result: nil)
query_string = create_query_string(type, query, rows, start, sort)
if filter_result
diff --git a/spec/functional/rebooter_spec.rb b/spec/functional/rebooter_spec.rb
index 4b77c40e91..0006f3bcdb 100644
--- a/spec/functional/rebooter_spec.rb
+++ b/spec/functional/rebooter_spec.rb
@@ -50,15 +50,15 @@ describe Chef::Platform::Rebooter do
let(:rebooter) { Chef::Platform::Rebooter }
- describe '#reboot_if_needed!' do
+ describe "#reboot_if_needed!" do
- it 'should not call #shell_out! when reboot has not been requested' do
+ it "should not call #shell_out! when reboot has not been requested" do
expect(rebooter).to receive(:shell_out!).exactly(0).times
expect(rebooter).to receive(:reboot_if_needed!).once.and_call_original
rebooter.reboot_if_needed!(run_context.node)
end
- describe 'calling #shell_out! to reboot' do
+ describe "calling #shell_out! to reboot" do
before(:each) do
run_context.request_reboot(reboot_info)
@@ -77,7 +77,7 @@ describe Chef::Platform::Rebooter do
end
end
- describe 'when using #reboot_if_needed!' do
+ describe "when using #reboot_if_needed!" do
include_context "test a reboot method"
it "should produce the correct string on Windows" do
@@ -89,7 +89,7 @@ describe Chef::Platform::Rebooter do
end
end
- describe 'when using #reboot!' do
+ describe "when using #reboot!" do
include_context "test a reboot method"
it "should produce the correct string on Windows" do
diff --git a/spec/functional/resource/dsc_script_spec.rb b/spec/functional/resource/dsc_script_spec.rb
index 5ee97f04a3..3383ce0625 100644
--- a/spec/functional/resource/dsc_script_spec.rb
+++ b/spec/functional/resource/dsc_script_spec.rb
@@ -166,8 +166,7 @@ User dsctestusercreate
EOH
}
- let(:dsc_user_config_data) {
- <<-EOH
+ let(:dsc_user_config_data) { <<-EOH
@{
AllNodes = @(
@{