Skip to content

Commit c2295b7

Browse files
Dominic ClealJeff McCune
authored andcommitted
(#18494) Rearrange loop to remove Ruby 2.0 warning
Ruby 2.0 warned of the complex assignments in the while loop: lib/puppet/file_serving/fileset.rb:139: warning: found = in conditional, should be == The block that shifts to the next recursion level has been removed from the loop expression to prevent the interpreter from warning.
1 parent 7ac8582 commit c2295b7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/puppet/file_serving/fileset.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def perform_recursion
136136
result = []
137137
return result unless recurse?(depth)
138138

139-
while dir_path = current_dirs.shift or ((depth += 1) and recurse?(depth) and current_dirs = next_dirs and next_dirs = [] and dir_path = current_dirs.shift)
139+
while dir_path = current_dirs.shift
140140
next unless stat = stat(dir_path)
141141
next unless stat.directory?
142142

@@ -153,6 +153,14 @@ def perform_recursion
153153
# And to our list of files/directories to iterate over.
154154
next_dirs << File.join(dir_path, file_path)
155155
end
156+
157+
# Move to the next recusion level
158+
if current_dirs.empty?
159+
depth += 1
160+
break unless recurse?(depth)
161+
current_dirs = next_dirs
162+
next_dirs = []
163+
end
156164
end
157165

158166
result

0 commit comments

Comments
 (0)