-
Notifications
You must be signed in to change notification settings - Fork 30
feat: added check for invalid username and if it is invalid find related names #200
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
base: main
Are you sure you want to change the base?
Conversation
…t have close proximity
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.
Thank you for the PR! It looks pretty good already. Left some comments.
@@ -1,6 +1,7 @@ | |||
use anyhow::Context; | |||
use octocrab::models::{App, Repository}; | |||
use octocrab::{Error, Octocrab}; | |||
use strsim::levenshtein; |
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.
The strtim
dependency is missing.
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.
oh shit, forgotten to push it, done now !
async fn find_similar_usernames(&self, username: &str) -> anyhow::Result<Vec<String>> { | ||
const MAX_DISTANCE: usize = 2; | ||
|
||
let search_results = self |
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 wouldn't use the GitHub search API for this, that could be slow, and unknown GH users are not relevant anyway. Instead, we should try to search for known users in the team database. It will also be easier to test it like this.
But we can also skip the "find similar" functionality in this PR, if you want.
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 wouldn't use the GitHub search API for this, that could be slow, and unknown GH users are not relevant anyway. Instead, we should try to search for known users in the team database. It will also be easier to test it like this.
so we should use this right ?
Line 51 in 417c8e7
pub(crate) async fn load_permissions( |
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.
Yes, the reviewer list from the team API.
Fixes #191