-
-
Notifications
You must be signed in to change notification settings - Fork 849
Fixing bug when filtering pull requests without labels #771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,12 +159,14 @@ def include_issues_by_labels(issues) | |
# @param [Array] issues Issues & PRs to filter when without labels | ||
# @return [Array] Issues & PRs without labels or empty array if | ||
# add_issues_wo_labels or add_pr_wo_labels are false | ||
def filter_wo_labels(issues) | ||
if (!issues.empty? && issues.first.key?("pull_requests") && options[:add_pr_wo_labels]) || options[:add_issues_wo_labels] | ||
issues | ||
else | ||
issues.select { |issue| issue["labels"].map { |l| l["name"] }.any? } | ||
def filter_wo_labels(items) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had to change the internals of this method beyond the initial issue of The original implementation, with the corrected value, would return all pull requests even when |
||
if items.any? && items.first.key?("pull_request") | ||
return items if options[:add_pr_wo_labels] | ||
elsif options[:add_issues_wo_labels] | ||
return items | ||
end | ||
# The default is to filter items without labels | ||
items.select { |item| item["labels"].map { |l| l["name"] }.any? } | ||
end | ||
|
||
# @todo Document this | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disabled this cop for all specs instead of the per-spec solution that was used previously. Let me know if this is not desirable.