Skip to content

Commit a3deb6a

Browse files
hickfordMatthew John Cheetham
andauthored
Apply suggestions from code review
Co-authored-by: Matthew John Cheetham <[email protected]>
1 parent b9cfa9b commit a3deb6a

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

src/shared/GitHub/GitHubAuthentication.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,12 @@ public async Task<AuthenticationPromptResult> GetAuthenticationAsync(Uri targetU
7676
throw new ArgumentException(@$"Must specify at least one {nameof(AuthenticationModes)}", nameof(modes));
7777
}
7878

79-
switch (modes)
79+
// If there is no mode choice to be made and no interaction required,
80+
// just return that result.
81+
if (modes == AuthenticationModes.Browser ||
82+
modes == AuthenticationModes.Device)
8083
{
81-
case AuthenticationModes.Browser:
82-
// no user interaction required
83-
return new AuthenticationPromptResult(AuthenticationModes.Browser);
84-
case AuthenticationModes.Device:
85-
// no user interaction required
86-
return new AuthenticationPromptResult(AuthenticationModes.Device);
87-
default:
88-
break;
84+
return new AuthenticationPromptResult(modes);
8985
}
9086

9187
ThrowIfUserInteractionDisabled();

src/shared/GitHub/GitHubHostProvider.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,7 @@ public static bool IsGitHubDotCom(string targetUrl)
316316

317317
public static bool IsGitHubDotCom(Uri targetUri)
318318
{
319-
if (targetUri is null)
320-
{
321-
throw new ArgumentNullException(nameof(targetUri));
322-
}
319+
EnsureArgument.AbsoluteUri(targetUri, nameof(targetUri));
323320

324321
return StringComparer.OrdinalIgnoreCase.Equals(targetUri.Host, GitHubConstants.GitHubBaseUrlHost);
325322
}

0 commit comments

Comments
 (0)