-
Notifications
You must be signed in to change notification settings - Fork 67
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
github: Don't match a user unless the prefix is correct #147
Conversation
This fixes a longstanding annoying issue where github queries users based on any match within username, whereas generally people don't intend to use it this way. When picking a valid user match, require the prefix to match the stated query in addition to looking for the minimum size.
Reviews in this chain: |
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.
🎉
revup/github_utils.py
Outdated
if this_node["totalCount"] > len(this_node["nodes"]): | ||
logging.warning("Too many matching users found for {}".format(user_id)) |
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.
Will this warn if there are multiple substring matches but only one prefix match?
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.
this warning is for when github tells you there are more matches than it can return (max return is set to 25 atm). this would mainly happen if you there were more than 25 aarons, you wouldn't be able to match against a later alphabetical one without being more specific
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.
one warning that would be new that i'm not handling here is if none of the 25 returned names from github actually prefix match. in that case we would just take the first one rather than the shortest one. i think this is fine for now, but i'll add a warning for this case
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.
Yeah that seems fine
0ea3dc4
to
5d71794
Compare
This fixes a longstanding annoying issue where github
queries users based on any match within username, whereas
generally people don't intend to use it this way.
When picking a valid user match, require the prefix to match
the stated query in addition to looking for the minimum size.