Do not alter pull_requests while iterating on it
Deleting elements of an array while iterating on it results in never seeing the last element. > a = [1,2,3] => [1, 2, 3] > a.each do |e| > p a > a.delete(e) > end [1, 2, 3] [2, 3] => [2]
This commit is contained in:
parent
0140986091
commit
1ec72afe32
|
@ -120,22 +120,22 @@ module GitHubChangelogGenerator
|
|||
issues_a.push dict unless added
|
||||
end
|
||||
|
||||
added_pull_requests = []
|
||||
pull_requests.each do |dict|
|
||||
added = false
|
||||
dict.labels.each do |label|
|
||||
if @options[:bug_labels].include? label.name
|
||||
bugs_a.push dict
|
||||
added = true
|
||||
added_pull_requests.push dict
|
||||
next
|
||||
end
|
||||
if @options[:enhancement_labels].include? label.name
|
||||
enhancement_a.push dict
|
||||
added = true
|
||||
added_pull_requests.push dict
|
||||
next
|
||||
end
|
||||
end
|
||||
pull_requests.delete(dict) if added
|
||||
end
|
||||
added_pull_requests.each { |p| pull_requests.delete(p) }
|
||||
|
||||
[bugs_a, enhancement_a, issues_a]
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user