Skip to content

Commit 26c84d8

Browse files
Refactor org/repo validation for clarity and consistency
1 parent e700d9d commit 26c84d8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/gei/Commands/MigrateRepo/MigrateRepoCommandArgs.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public override void Validate(OctoLogger log)
9797
{
9898
throw new OctoshiftCliException("The --use-github-storage flag was provided with a connection string for an Azure storage account. Archive cannot be uploaded to both locations.");
9999
}
100-
ValidateOrgAndRepoNames(); return;
100+
ValidateOrgAndRepoNames();
101101
}
102102

103103
private void DefaultTargetRepo(OctoLogger log)
@@ -119,19 +119,19 @@ private void DefaultSourcePat(OctoLogger log)
119119
}
120120
private void ValidateOrgAndRepoNames()
121121
{
122-
if (!string.IsNullOrWhiteSpace(GithubSourceOrg) && Uri.IsWellFormedUriString(GithubSourceOrg, UriKind.Absolute))
122+
if (GithubSourceOrg.HasValue() && Uri.IsWellFormedUriString(GithubSourceOrg, UriKind.Absolute))
123123
{
124124
throw new OctoshiftCliException("GithubSourceOrg should be an org name, not a URL.");
125125
}
126-
if (!string.IsNullOrWhiteSpace(GithubTargetOrg) && Uri.IsWellFormedUriString(GithubTargetOrg, UriKind.Absolute))
126+
if (GithubTargetOrg.HasValue() && Uri.IsWellFormedUriString(GithubTargetOrg, UriKind.Absolute))
127127
{
128128
throw new OctoshiftCliException("GithubTargetOrg should be an org name, not a URL.");
129129
}
130-
if (!string.IsNullOrWhiteSpace(SourceRepo) && Uri.IsWellFormedUriString(SourceRepo, UriKind.Absolute))
130+
if (SourceRepo.HasValue() && Uri.IsWellFormedUriString(SourceRepo, UriKind.Absolute))
131131
{
132132
throw new OctoshiftCliException("SourceRepo should be a repo name, not a URL.");
133133
}
134-
if (!string.IsNullOrWhiteSpace(TargetRepo) && Uri.IsWellFormedUriString(TargetRepo, UriKind.Absolute))
134+
if (TargetRepo.HasValue() && Uri.IsWellFormedUriString(TargetRepo, UriKind.Absolute))
135135
{
136136
throw new OctoshiftCliException("TargetRepo should be a repo name, not a URL.");
137137
}

0 commit comments

Comments
 (0)