Skip to content
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

Fixing bug when filtering pull requests without labels #771

Merged

Conversation

douglasmiller
Copy link
Contributor

The filter_wo_labels method is excluding pull requests that do not have labels even though the :add_pr_wo_labels/pr-wo-labels option is set to true.

This is due to an incorrect key being used to identify that the object being considered is a pull request.

@ferrarimarco
Copy link
Contributor

Hi @douglasmiller ! Can you please add a test case? Thanks!

@douglasmiller
Copy link
Contributor Author

Working on tests already

issues
else
issues.select { |issue| issue["labels"].map { |l| l["name"] }.any? }
def filter_wo_labels(items)
Copy link
Contributor Author

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 of pull_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.

@@ -27,6 +27,10 @@ Metrics/ClassLength:
Metrics/MethodLength:
Enabled: false

Metrics/ModuleLength:
Copy link
Contributor Author

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.

Copy link
Collaborator

@olleolleolle olleolleolle left a 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!

@ferrarimarco ferrarimarco merged commit 7bd94fc into github-changelog-generator:master Apr 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants