Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork852
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Fixing bug when filtering pull requests without labels#771
Uh oh!
There was an error while loading.Please reload this page.
Conversation
ferrarimarco commentedMar 18, 2020
Hi@douglasmiller ! Can you please add a test case? Thanks! |
douglasmiller commentedMar 18, 2020
Working on tests already |
| issues | ||
| else | ||
| issues.select{ |issue|issue["labels"].map{ |l|l["name"]}.any?} | ||
| deffilter_wo_labels(items) |
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 had to change the internals of this method beyond the initial issue ofpull_request being incorrectly plural.
The original implementation, with the corrected value, would return all pull requests even when:add_pr_wo_labels was false when:add_issues_wo_labels was true. This was exposed when writing tests.
| Metrics/MethodLength: | ||
| Enabled:false | ||
| Metrics/ModuleLength: |
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.
olleolleolle left a comment
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.
Thanks for taking the time to improve the tests - while also fixing the defect!
This looks just right,@douglasmiller - thanks, again!
LGTM!
The
filter_wo_labelsmethod is excluding pull requests that do not have labels even though the:add_pr_wo_labels/pr-wo-labelsoption is set to true.This is due to an incorrect key being used to identify that the object being considered is a pull request.