act icon indicating copy to clipboard operation
act copied to clipboard

Code Cleanup : Regex for github.com and GHE can be unified to a single one

Open kavishdahekar opened this issue 1 year ago • 0 comments

Currently, the findGitSlug method relies on two separate regexes for identifying a github.com or a GHE domain from a given repo URL.

  1. Although findGitSlug returns either "CodeCommit", "GitHub" or "GitHubEnterprise" - this return value is never used elsewhere.
  2. The code does not differentiate between github.com and GHE domain elsewhere, so a single regex is sufficient to extract both : ^https?://([^/]+)/(.+)/(.+?)(?:\.git)?$

If acceptable, I would be happy to make this fix and modify the tests.

kavishdahekar avatar Aug 02 '24 17:08 kavishdahekar