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

API tweaks from real use #2

Merged
merged 2 commits into from
Jul 2, 2024
Merged

API tweaks from real use #2

merged 2 commits into from
Jul 2, 2024

Conversation

cmyr
Copy link
Member

@cmyr cmyr commented Jun 28, 2024

After trying to integrate this into the bulk builder, I've ran into a few little things I needed to change.

cmyr added 2 commits June 28, 2024 12:29
After trying to integrate this into the bulk builder, I've ran into a
few little things I needed to change.
.expect("errored before now if url was malformed"),
.as_deref()
.and_then(repo_name_from_url)
.expect("already checked")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's very annoying when these sort of checks hit and don't tell you anything about where the problem occurred. These days I'm fond of unwrap_or_else(|| panic!) so you can report context.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using expect here as basically an alternative to a comment; this be unreachable because in order to get here we already called this function once on this input and succeeded.

assert_eq!(
repo_name_from_url("https://github.com/hyper-type/Advent"),
Some("Advent"),
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this means we get a collision if font A has org1/a_name as repo and font B has org2/a_name. While perhaps unlikely I tend to think this would be a valid config.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree this is possible, but unlikely. Opened #4 to track.

Copy link
Contributor

@rsheeter rsheeter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with minor concern about repo name collisons

@cmyr cmyr merged commit a127509 into main Jul 2, 2024
1 check passed
@cmyr cmyr deleted the ready-to-use branch July 2, 2024 15:28
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.

2 participants