diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-02-03 17:31:30 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-02-03 17:31:30 -0800 |
commit | a6864e6681e2bed416376fee865f19db7ce150f9 (patch) | |
tree | 9583a47ddd50fcf3a112826245cd540b5d7a94d0 /lib/chef | |
parent | 22d700e4a1a3c44d6d794fd5c4c1f8932a74cf17 (diff) | |
parent | 49b6276e5a6cb07a1923376c956080e3d425ee23 (diff) | |
download | chef-a6864e6681e2bed416376fee865f19db7ce150f9.tar.gz |
Merge pull request #4523 from chef/chefstyle/fixes
auto-fixing some easy cops
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/chef_fs/file_pattern.rb | 2 | ||||
-rw-r--r-- | lib/chef/exceptions.rb | 2 | ||||
-rw-r--r-- | lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb | 4 | ||||
-rw-r--r-- | lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb | 4 | ||||
-rw-r--r-- | lib/chef/formatters/error_inspectors/node_load_error_inspector.rb | 4 | ||||
-rw-r--r-- | lib/chef/knife/core/status_presenter.rb | 2 | ||||
-rw-r--r-- | lib/chef/knife/ssh.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/batch.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/powershell_script.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/user.rb | 2 | ||||
-rw-r--r-- | lib/chef/run_list/run_list_item.rb | 2 |
11 files changed, 14 insertions, 14 deletions
diff --git a/lib/chef/chef_fs/file_pattern.rb b/lib/chef/chef_fs/file_pattern.rb index 10e8c12c20..74be64cd84 100644 --- a/lib/chef/chef_fs/file_pattern.rb +++ b/lib/chef/chef_fs/file_pattern.rb @@ -258,7 +258,7 @@ class Chef has_double_star = false pattern.split(pattern_special_characters).each_with_index do |part, index| # Odd indexes from the split are symbols. Even are normal bits. - if index % 2 == 0 + if index.even? exact << part if !exact.nil? regexp << part else diff --git a/lib/chef/exceptions.rb b/lib/chef/exceptions.rb index 9a2e9ae3a3..6fe364a91b 100644 --- a/lib/chef/exceptions.rb +++ b/lib/chef/exceptions.rb @@ -205,7 +205,7 @@ class Chef class ImmutableAttributeModification < NoMethodError def initialize super "Node attributes are read-only when you do not specify which precedence level to set. " + - %Q{To set an attribute use code like `node.default["key"] = "value"'} + %q{To set an attribute use code like `node.default["key"] = "value"'} end end diff --git a/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb b/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb index 3d28de0e75..b60b9d91d1 100644 --- a/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb +++ b/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb @@ -37,10 +37,10 @@ class Chef case exception when Net::HTTPServerException, Net::HTTPFatalError humanize_http_exception(error_description) - when *NETWORK_ERROR_CLASSES - describe_network_errors(error_description) when EOFError describe_eof_error(error_description) + when *NETWORK_ERROR_CLASSES + describe_network_errors(error_description) else error_description.section("Unexpected Error:","#{exception.class.name}: #{exception.message}") end diff --git a/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb b/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb index b095dcfd70..5ac39d7a83 100644 --- a/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb +++ b/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb @@ -41,12 +41,12 @@ class Chef def add_explanation(error_description) case exception - when *NETWORK_ERROR_CLASSES - describe_network_errors(error_description) when Net::HTTPServerException, Net::HTTPFatalError humanize_http_exception(error_description) when EOFError describe_eof_error(error_description) + when *NETWORK_ERROR_CLASSES + describe_network_errors(error_description) else error_description.section("Unexpected Error:","#{exception.class.name}: #{exception.message}") end diff --git a/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb b/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb index 292b5a4d4a..b3196caddb 100644 --- a/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb +++ b/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb @@ -43,8 +43,6 @@ class Chef case exception when Net::HTTPServerException, Net::HTTPFatalError humanize_http_exception(error_description) - when *NETWORK_ERROR_CLASSES - describe_network_errors(error_description) when Chef::Exceptions::PrivateKeyMissing error_description.section("Private Key Not Found:",<<-E) Your private key could not be loaded. If the key file exists, ensure that it is @@ -55,6 +53,8 @@ client_key "#{api_key}" E when EOFError describe_eof_error(error_description) + when *NETWORK_ERROR_CLASSES + describe_network_errors(error_description) else error_description.section("Unexpected Error:","#{exception.class.name}: #{exception.message}") end diff --git a/lib/chef/knife/core/status_presenter.rb b/lib/chef/knife/core/status_presenter.rb index 34852fd4f0..13bcf5cab2 100644 --- a/lib/chef/knife/core/status_presenter.rb +++ b/lib/chef/knife/core/status_presenter.rb @@ -101,7 +101,7 @@ class Chef fqdn = (node[:ec2] && node[:ec2][:public_hostname]) || node[:fqdn] name = node["name"] || node.name - hours, minutes, _ = time_difference_in_hms(node["ohai_time"]) + hours, minutes, = time_difference_in_hms(node["ohai_time"]) hours_text = "#{hours} hour#{hours == 1 ? ' ' : 's'}" minutes_text = "#{minutes} minute#{minutes == 1 ? ' ' : 's'}" run_list = "#{node['run_list']}" if config[:run_list] diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb index 139e6d1021..fb36fb67f4 100644 --- a/lib/chef/knife/ssh.rb +++ b/lib/chef/knife/ssh.rb @@ -165,7 +165,7 @@ class Chef if @action_nodes.length == 0 ui.fatal("No nodes returned from search!") else - ui.fatal("#{@action_nodes.length} #{@action_nodes.length > 1 ? "nodes":"node"} found, " + + ui.fatal("#{@action_nodes.length} #{@action_nodes.length > 1 ? "nodes": "node"} found, " + "but does not have the required attribute to establish the connection. " + "Try setting another attribute to open the connection using --attribute.") end diff --git a/lib/chef/provider/batch.rb b/lib/chef/provider/batch.rb index 7f5a711954..bb294afd3f 100644 --- a/lib/chef/provider/batch.rb +++ b/lib/chef/provider/batch.rb @@ -24,7 +24,7 @@ class Chef provides :batch, os: "windows" - def initialize (new_resource, run_context) + def initialize(new_resource, run_context) super(new_resource, run_context, ".bat") end diff --git a/lib/chef/provider/powershell_script.rb b/lib/chef/provider/powershell_script.rb index 19589dbead..77aaa080a9 100644 --- a/lib/chef/provider/powershell_script.rb +++ b/lib/chef/provider/powershell_script.rb @@ -25,7 +25,7 @@ class Chef provides :powershell_script, os: "windows" - def initialize (new_resource, run_context) + def initialize(new_resource, run_context) super(new_resource, run_context, ".ps1") add_exit_status_wrapper end diff --git a/lib/chef/provider/user.rb b/lib/chef/provider/user.rb index 4f29fac340..3b8fe61171 100644 --- a/lib/chef/provider/user.rb +++ b/lib/chef/provider/user.rb @@ -180,7 +180,7 @@ class Chef lock_user Chef::Log.info("#{@new_resource} locked") end - else + else Chef::Log.debug("#{@new_resource} already locked - nothing to do") end end diff --git a/lib/chef/run_list/run_list_item.rb b/lib/chef/run_list/run_list_item.rb index 4ee0f36dff..3e689eddef 100644 --- a/lib/chef/run_list/run_list_item.rb +++ b/lib/chef/run_list/run_list_item.rb @@ -69,7 +69,7 @@ class Chef end def to_s - "#{@type}[#{@name}#{@version ? "@#{@version}" :""}]" + "#{@type}[#{@name}#{@version ? "@#{@version}" : ""}]" end def role? |