summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2015-02-23 18:23:28 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2015-02-23 18:23:28 -0800
commita462a5237230d36ab1d889ccf70c579f6adc2972 (patch)
tree539a02f60794b57137a3b251428580f7bb203fb4
parenta402a2602ec10f00a8398c6437530a49a2a05fc6 (diff)
parente5bd51fb9c14d8bd96aca4d90a2dc1438da5a33e (diff)
downloadchef-a462a5237230d36ab1d889ccf70c579f6adc2972.tar.gz
Merge pull request #2954 from chef/lcg/lint-fixes
Lcg/lint fixes
-rw-r--r--lib/chef/chef_fs/file_system/chef_repository_file_system_cookbook_dir.rb6
-rw-r--r--lib/chef/mixin/shell_out.rb10
-rw-r--r--lib/chef/provider/package/freebsd/base.rb4
-rw-r--r--lib/chef/resource/powershell_script.rb2
-rw-r--r--lib/chef/user.rb4
-rw-r--r--lib/chef/whitelist.rb10
-rw-r--r--lib/chef/win32/security/ace.rb2
-rw-r--r--lib/chef/win32/security/acl.rb4
-rw-r--r--lib/chef/win32/version.rb6
9 files changed, 24 insertions, 24 deletions
diff --git a/lib/chef/chef_fs/file_system/chef_repository_file_system_cookbook_dir.rb b/lib/chef/chef_fs/file_system/chef_repository_file_system_cookbook_dir.rb
index 20a3f4e2be..a7f1d733b1 100644
--- a/lib/chef/chef_fs/file_system/chef_repository_file_system_cookbook_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_repository_file_system_cookbook_dir.rb
@@ -36,11 +36,11 @@ class Chef
# We need the canonical cookbook name if we are using versioned cookbooks, but we don't
# want to spend a lot of time adding code to the main Chef libraries
if root.versioned_cookbooks
- _canonical_name = canonical_cookbook_name(File.basename(file_path))
- fail "When versioned_cookbooks mode is on, cookbook #{file_path} must match format <cookbook_name>-x.y.z" unless _canonical_name
+ canonical_name = canonical_cookbook_name(File.basename(file_path))
+ fail "When versioned_cookbooks mode is on, cookbook #{file_path} must match format <cookbook_name>-x.y.z" unless canonical_name
# KLUDGE: We shouldn't have to use instance_variable_set
- loader.instance_variable_set(:@cookbook_name, _canonical_name)
+ loader.instance_variable_set(:@cookbook_name, canonical_name)
end
loader.load_cookbooks
diff --git a/lib/chef/mixin/shell_out.rb b/lib/chef/mixin/shell_out.rb
index d3c14fa408..529023056d 100644
--- a/lib/chef/mixin/shell_out.rb
+++ b/lib/chef/mixin/shell_out.rb
@@ -76,17 +76,17 @@ class Chef
def run_command_compatible_options(command_args)
return command_args unless command_args.last.is_a?(Hash)
- _command_args = command_args.dup
- _options = _command_args.last
+ my_command_args = command_args.dup
+ my_options = my_command_args.last
DEPRECATED_OPTIONS.each do |old_option, new_option|
# Edge case: someone specifies :command_log_level and 'command_log_level' in the option hash
- next unless value = _options.delete(old_option) || _options.delete(old_option.to_s)
+ next unless value = my_options.delete(old_option) || my_options.delete(old_option.to_s)
deprecate_option old_option, new_option
- _options[new_option] = value
+ my_options[new_option] = value
end
- return _command_args
+ return my_command_args
end
private
diff --git a/lib/chef/provider/package/freebsd/base.rb b/lib/chef/provider/package/freebsd/base.rb
index b0f05667ff..6a3b97a4fd 100644
--- a/lib/chef/provider/package/freebsd/base.rb
+++ b/lib/chef/provider/package/freebsd/base.rb
@@ -48,10 +48,10 @@ class Chef
# Otherwise look up the path to the ports directory using 'whereis'
else
whereis = shell_out!("whereis -s #{port}", :env => nil)
- unless _path = whereis.stdout[/^#{Regexp.escape(port)}:\s+(.+)$/, 1]
+ unless path = whereis.stdout[/^#{Regexp.escape(port)}:\s+(.+)$/, 1]
raise Chef::Exceptions::Package, "Could not find port with the name #{port}"
end
- _path
+ path
end
end
diff --git a/lib/chef/resource/powershell_script.rb b/lib/chef/resource/powershell_script.rb
index a88fb5701b..1b8aef94a2 100644
--- a/lib/chef/resource/powershell_script.rb
+++ b/lib/chef/resource/powershell_script.rb
@@ -34,8 +34,6 @@ class Chef
)
end
- protected
-
# Allow callers evaluating guards to request default
# attribute values. This is needed to allow
# convert_boolean_return to be true in guard context by default,
diff --git a/lib/chef/user.rb b/lib/chef/user.rb
index 6569a97f00..42fa6b5fa1 100644
--- a/lib/chef/user.rb
+++ b/lib/chef/user.rb
@@ -165,8 +165,6 @@ class Chef
Chef::User.from_hash(response)
end
- private
-
# Gross. Transforms an API response in the form of:
# [ { "user" => { "username" => USERNAME }}, ...]
# into the form
@@ -179,5 +177,7 @@ class Chef
end
new_response
end
+
+ private_class_method :transform_ohc_list_response
end
end
diff --git a/lib/chef/whitelist.rb b/lib/chef/whitelist.rb
index 86c229d22c..3682f7187e 100644
--- a/lib/chef/whitelist.rb
+++ b/lib/chef/whitelist.rb
@@ -32,17 +32,15 @@ class Chef
new_data = {}
whitelist.each do |item|
- self.add_data(data, new_data, item)
+ add_data(data, new_data, item)
end
new_data
end
- private
-
# Walk the data has according to the keys provided by the whitelisted item
# and add the data to the whitelisting result.
def self.add_data(data, new_data, item)
- parts = self.to_array(item)
+ parts = to_array(item)
all_data = data
filtered_data = new_data
@@ -68,6 +66,8 @@ class Chef
new_data
end
+ private_class_method :add_data
+
# Accepts a String or an Array, and returns an Array of String keys that
# are used to traverse the data hash. Strings are split on "/", Arrays are
# assumed to contain exact keys (that is, Array elements will not be split
@@ -80,5 +80,7 @@ class Chef
parts
end
+ private_class_method :to_array
+
end
end
diff --git a/lib/chef/win32/security/ace.rb b/lib/chef/win32/security/ace.rb
index 3aeae35532..1f54b1cafb 100644
--- a/lib/chef/win32/security/ace.rb
+++ b/lib/chef/win32/security/ace.rb
@@ -106,8 +106,6 @@ class Chef
struct[:AceType]
end
- private
-
def self.create_ace_with_mask_and_sid(type, flags, mask, sid)
size_needed = size_with_sid(sid)
pointer = FFI::MemoryPointer.new size_needed
diff --git a/lib/chef/win32/security/acl.rb b/lib/chef/win32/security/acl.rb
index fd43b75cbf..e129d5c9a0 100644
--- a/lib/chef/win32/security/acl.rb
+++ b/lib/chef/win32/security/acl.rb
@@ -90,11 +90,13 @@ class Chef
def to_s
"[#{self.collect { |ace| ace.to_s }.join(", ")}]"
end
- private
def self.align_dword(size)
(size + 4 - 1) & 0xfffffffc
end
+
+ private_class_method :align_dword
+
end
end
end
diff --git a/lib/chef/win32/version.rb b/lib/chef/win32/version.rb
index 6a5bd35a26..17c27e4780 100644
--- a/lib/chef/win32/version.rb
+++ b/lib/chef/win32/version.rb
@@ -34,18 +34,18 @@ class Chef
# http://msdn.microsoft.com/en-us/library/ms724833(v=vs.85).aspx
# http://msdn.microsoft.com/en-us/library/ms724358(v=vs.85).aspx
- private
-
def self.get_system_metrics(n_index)
GetSystemMetrics(n_index)
end
+ private_class_method :get_system_metrics
+
def self.method_name_from_marketing_name(marketing_name)
"#{marketing_name.gsub(/\s/, '_').gsub(/\./, '_').downcase}?"
# "#{marketing_name.gsub(/\s/, '_').gsub(//, '_').downcase}?"
end
- public
+ private_class_method :method_name_from_marketing_name
WIN_VERSIONS = {
"Windows 10" => {:major => 6, :minor => 4, :callable => lambda{ |product_type, suite_mask| product_type == VER_NT_WORKSTATION }},