]> git.openstreetmap.org Git - chef.git/commitdiff
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 fd40acb79a7c1bec6b5979d91096a3f9eb1531d6..e819633a2818498e5b271407e3d4aec1dad05e2c 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 32dacc5008edb362e791a1ad5bd0b2ed7bd13ff8..65cb9c86d9b2f2e09721b8308f15686356cb6975 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 c058524b91a4a9303a6bdbc4971cf51b23a44d0e..193983471f7a9e0d60f4b3e419a0bdab3a2cc48b 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