diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-08-09 12:50:27 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-08-16 18:41:25 -0700 |
commit | d0f4283fe47cbbe251eb34fee8657901374ff336 (patch) | |
tree | 55589ec4e6e9c425aec18850944209ecd79923fa | |
parent | 7037433634d0b02574d03a8465541ea2f49d3f39 (diff) | |
download | chef-d0f4283fe47cbbe251eb34fee8657901374ff336.tar.gz |
"fix" Lint/NestedMethodDefinition cops
these are all awful, but fixing them will be time consuming. by disabling
them on the existing offenses we can enable the cop to prevent more of this
creeping into the codebase.
-rw-r--r-- | chef-config/lib/chef-config/package_task.rb | 4 | ||||
-rw-r--r-- | lib/chef/cookbook_site_streaming_uploader.rb | 4 | ||||
-rw-r--r-- | lib/chef/knife/cookbook_show.rb | 2 | ||||
-rw-r--r-- | lib/chef/shell/ext.rb | 4 | ||||
-rw-r--r-- | lib/chef/shell/shell_session.rb | 2 |
5 files changed, 8 insertions, 8 deletions
diff --git a/chef-config/lib/chef-config/package_task.rb b/chef-config/lib/chef-config/package_task.rb index eb257ff4b5..de830c09d3 100644 --- a/chef-config/lib/chef-config/package_task.rb +++ b/chef-config/lib/chef-config/package_task.rb @@ -182,7 +182,7 @@ module ChefConfig IO.write(version_file_path, new_version) end - def update_version_rb + def update_version_rb # rubocop:disable Lint/NestedMethodDefinition puts "Updating #{version_rb_path} to include version #{version} ..." contents = <<-VERSION_RB # Copyright:: Copyright 2010-2016, Chef Software, Inc. @@ -223,7 +223,7 @@ end IO.write(version_rb_path, contents) end - def update_gemfile_lock + def update_gemfile_lock # rubocop:disable Lint/NestedMethodDefinition if File.exist?(gemfile_lock_path) puts "Updating #{gemfile_lock_path} to include version #{version} ..." contents = IO.read(gemfile_lock_path) diff --git a/lib/chef/cookbook_site_streaming_uploader.rb b/lib/chef/cookbook_site_streaming_uploader.rb index 9fb8d0d4bc..760a48ab3a 100644 --- a/lib/chef/cookbook_site_streaming_uploader.rb +++ b/lib/chef/cookbook_site_streaming_uploader.rb @@ -149,11 +149,11 @@ class Chef alias :to_s :body # BUGBUG this makes the response compatible with what respsonse_steps expects to test headers (response.headers[] -> response[]) - def headers + def headers # rubocop:disable Lint/NestedMethodDefinition self end - def status + def status # rubocop:disable Lint/NestedMethodDefinition code.to_i end end diff --git a/lib/chef/knife/cookbook_show.rb b/lib/chef/knife/cookbook_show.rb index a20e62ffc2..615c1962be 100644 --- a/lib/chef/knife/cookbook_show.rb +++ b/lib/chef/knife/cookbook_show.rb @@ -63,7 +63,7 @@ class Chef node[:platform_version] = config[:platform_version] if config.has_key?(:platform_version) class << node - def attribute?(name) + def attribute?(name) # rubocop:disable Lint/NestedMethodDefinition has_key?(name) end end diff --git a/lib/chef/shell/ext.rb b/lib/chef/shell/ext.rb index 40d7e10d2e..eab1d13e4d 100644 --- a/lib/chef/shell/ext.rb +++ b/lib/chef/shell/ext.rb @@ -39,13 +39,13 @@ module Shell # irb breaks if you prematurely define IRB::JobMangager # so these methods need to be defined at the latest possible time. unless jobs.respond_to?(:select_session_by_context) - def jobs.select_session_by_context(&block) + def jobs.select_session_by_context(&block) # rubocop:disable Lint/NestedMethodDefinition @jobs.select { |job| block.call(job[1].context.main) } end end unless jobs.respond_to?(:session_select) - def jobs.select_shell_session(target_context) + def jobs.select_shell_session(target_context) # rubocop:disable Lint/NestedMethodDefinition session = if target_context.kind_of?(Class) select_session_by_context { |main| main.kind_of?(target_context) } else diff --git a/lib/chef/shell/shell_session.rb b/lib/chef/shell/shell_session.rb index 0a8cba5be3..a458286157 100644 --- a/lib/chef/shell/shell_session.rb +++ b/lib/chef/shell/shell_session.rb @@ -126,7 +126,7 @@ module Shell end def shorten_node_inspect - def @node.inspect + def @node.inspect # rubocop:disable Lint/NestedMethodDefinition "<Chef::Node:0x#{self.object_id.to_s(16)} @name=\"#{self.name}\">" end end |