Skip to content

Commit ec4157e

Browse files
Potential fix for pull request finding 'Missed opportunity to use Where'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
1 parent 660847e commit ec4157e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,10 @@ Cancel ctx
9292
}
9393

9494
// Validate lifecycle values in products
95-
foreach (var product in input.Products)
95+
foreach (var product in input.Products.Where(product => !string.IsNullOrWhiteSpace(product.Lifecycle) && !config.AvailableLifecycles.Contains(product.Lifecycle)))
9696
{
97-
if (!string.IsNullOrWhiteSpace(product.Lifecycle) && !config.AvailableLifecycles.Contains(product.Lifecycle))
98-
{
99-
collector.EmitError(string.Empty, $"Lifecycle '{product.Lifecycle}' for product '{product.Product}' is not in the list of available lifecycles. Available lifecycles: {string.Join(", ", config.AvailableLifecycles)}");
100-
return false;
101-
}
97+
collector.EmitError(string.Empty, $"Lifecycle '{product.Lifecycle}' for product '{product.Product}' is not in the list of available lifecycles. Available lifecycles: {string.Join(", ", config.AvailableLifecycles)}");
98+
return false;
10299
}
103100

104101
// Build changelog data from input

0 commit comments

Comments
 (0)