More rubocop cleanup
authorTom Hughes <tom@compton.nu>
Tue, 3 Feb 2015 18:00:48 +0000 (18:00 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 4 Feb 2015 08:24:25 +0000 (08:24 +0000)
.rubocop_todo.yml
cookbooks/chef/libraries/remote_directory.rb
cookbooks/munin/providers/plugin.rb

index fd40acb..e819633 100644 (file)
@@ -46,20 +46,11 @@ Style/AccessModifierIndentation:
 Style/Documentation:
   Enabled: false
 
-# Offense count: 2
-Style/EmptyElse:
-  Enabled: false
-
 # Offense count: 32
 # Configuration parameters: Exclude.
 Style/FileName:
   Enabled: false
 
-# Offense count: 1
-# Configuration parameters: MinBodyLength.
-Style/GuardClause:
-  Enabled: false
-
 # Offense count: 3116
 # Cop supports --auto-correct.
 # Configuration parameters: SupportedStyles.
index 32dacc5..65cb9c8 100644 (file)
@@ -11,15 +11,16 @@ class Chef
           files_transferred << ::File.dirname(::File.join(@new_resource.path, cookbook_file_relative_path))
           files_transferred << ::File.join(@new_resource.path, cookbook_file_relative_path)
         end
-        if @new_resource.purge
-          files_to_purge = Set.new(
-                                   Dir.glob(::File.join(@new_resource.path, '**', '*'), ::File::FNM_DOTMATCH).select do |name|
-                                     name !~ /(?:^|#{Regexp.escape(::File::SEPARATOR)})\.\.?$/
-                                   end
-                                   )
-          files_to_purge = files_to_purge - files_transferred
-          purge_unmanaged_files(files_to_purge)
-        end
+
+        return unless @new_resource.purge
+
+        files_to_purge = Set.new(
+          Dir.glob(::File.join(@new_resource.path, '**', '*'), ::File::FNM_DOTMATCH).select do |name|
+            name !~ /(?:^|#{Regexp.escape(::File::SEPARATOR)})\.\.?$/
+          end
+        )
+        files_to_purge = files_to_purge - files_transferred
+        purge_unmanaged_files(files_to_purge)
       end
     end
   end
index c058524..1939834 100644 (file)
@@ -79,8 +79,6 @@ def target_path
     "/usr/local/share/munin/plugins/#{target}"
   when ::File.exist?("/usr/share/munin/plugins/#{target}")
     "/usr/share/munin/plugins/#{target}"
-  else
-    nil
   end
 end