Skip to content

Commit 8a2ff07

Browse files
Potential fix for pull request finding 'Nested 'if' statements can be combined'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
1 parent ca42d6a commit 8a2ff07

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/services/Elastic.Documentation.Services/ChangelogService.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,12 @@ Cancel ctx
4141
}
4242

4343
// Validate that if PR is just a number, owner and repo must be provided
44-
if (!string.IsNullOrWhiteSpace(input.Pr) && int.TryParse(input.Pr, out _))
44+
if (!string.IsNullOrWhiteSpace(input.Pr)
45+
&& int.TryParse(input.Pr, out _)
46+
&& (string.IsNullOrWhiteSpace(input.Owner) || string.IsNullOrWhiteSpace(input.Repo)))
4547
{
46-
if (string.IsNullOrWhiteSpace(input.Owner) || string.IsNullOrWhiteSpace(input.Repo))
47-
{
48-
collector.EmitError(string.Empty, "When --pr is specified as just a number, both --owner and --repo must be provided");
49-
return false;
50-
}
48+
collector.EmitError(string.Empty, "When --pr is specified as just a number, both --owner and --repo must be provided");
49+
return false;
5150
}
5251

5352
// If PR is specified, try to fetch PR information and derive title/type

0 commit comments

Comments
 (0)