Skip to content

Extract github url identifier helper#1888

Merged
norascheuch merged 1 commit intomainfrom
nora/refactor-githubnwoowner-helper
Dec 20, 2022
Merged

Extract github url identifier helper#1888
norascheuch merged 1 commit intomainfrom
nora/refactor-githubnwoowner-helper

Conversation

@norascheuch
Copy link
Copy Markdown
Contributor

This PR cleans up how we validate github owner and NWOs as well as refactors a bit of the flow surrounding the current usage of the helper.

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

Copy link
Copy Markdown
Contributor

@shati-patel shati-patel left a comment

Choose a reason for hiding this comment

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

Looks good! I've left a few comments, but none of them are blocking 🐻‍❄️

}

/**
* Extracts an NOW from a GitHub URL.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor :)

Suggested change
* Extracts an NOW from a GitHub URL.
* Extracts an NWO from a GitHub URL.

* @param identifier The GitHub NWO
* @returns
*/
export function validGitHubNwo(identifier: string): boolean {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor (feel free to ignore if this would make conflicts etc annoying!) 👍🏽
I'd probably name this function "isValid..." since that sounds more like a true/false check. Similar for the other functions :)

Suggested change
export function validGitHubNwo(identifier: string): boolean {
export function isValidGitHubNwo(identifier: string): boolean {

}

if (!looksLikeGithubRepo(githubRepo)) {
const nwo = getNwoFromGitHubUrl(githubRepo) || githubRepo;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for tidying up this section! 🧹

@norascheuch norascheuch merged commit 6350ac7 into main Dec 20, 2022
@norascheuch norascheuch deleted the nora/refactor-githubnwoowner-helper branch December 20, 2022 11:01
@norascheuch
Copy link
Copy Markdown
Contributor Author

I will implement both changes in the "Add database" button PR

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