From 5795524795e283f6fa072162b2ceaee3ad67803c Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 7 May 2025 12:40:25 +0200 Subject: [PATCH] Ensure clone-all starts error collection --- src/tooling/docs-assembler/Cli/NavigationCommands.cs | 6 ++---- src/tooling/docs-assembler/Cli/RepositoryCommands.cs | 6 ++---- .../src/docs-assembler.Tests/GlobalNavigationTests.cs | 3 +-- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/tooling/docs-assembler/Cli/NavigationCommands.cs b/src/tooling/docs-assembler/Cli/NavigationCommands.cs index b9ac0bc4a..61b1e2861 100644 --- a/src/tooling/docs-assembler/Cli/NavigationCommands.cs +++ b/src/tooling/docs-assembler/Cli/NavigationCommands.cs @@ -34,9 +34,8 @@ private void AssignOutputLogger() public async Task Validate(Cancel ctx = default) { AssignOutputLogger(); - await using var collector = new ConsoleDiagnosticsCollector(logger, githubActionsService); + await using var collector = new ConsoleDiagnosticsCollector(logger, githubActionsService).StartAsync(ctx); var assembleContext = new AssembleContext("dev", collector, new FileSystem(), new FileSystem(), null, null); - _ = collector.StartAsync(ctx); // this validates all path prefixes are unique, early exit if duplicates are detected if (!GlobalNavigationFile.ValidatePathPrefixes(assembleContext) || assembleContext.Collector.Errors > 0) @@ -64,8 +63,7 @@ public async Task ValidateLocalLinkReference([Argument] string? file = null AssignOutputLogger(); file ??= ".artifacts/docs/html/links.json"; - await using var collector = new ConsoleDiagnosticsCollector(logger, githubActionsService); - _ = collector.StartAsync(ctx); + await using var collector = new ConsoleDiagnosticsCollector(logger, githubActionsService).StartAsync(ctx); var assembleContext = new AssembleContext("dev", collector, new FileSystem(), new FileSystem(), null, null); diff --git a/src/tooling/docs-assembler/Cli/RepositoryCommands.cs b/src/tooling/docs-assembler/Cli/RepositoryCommands.cs index 22e58b188..e60b5384a 100644 --- a/src/tooling/docs-assembler/Cli/RepositoryCommands.cs +++ b/src/tooling/docs-assembler/Cli/RepositoryCommands.cs @@ -51,7 +51,7 @@ public async Task CloneAll( var githubEnvironmentInput = githubActionsService.GetInput("environment"); environment ??= !string.IsNullOrEmpty(githubEnvironmentInput) ? githubEnvironmentInput : "dev"; - await using var collector = new ConsoleDiagnosticsCollector(logger, githubActionsService); + await using var collector = new ConsoleDiagnosticsCollector(logger, githubActionsService).StartAsync(ctx); var assembleContext = new AssembleContext(environment, collector, new FileSystem(), new FileSystem(), null, null); var cloner = new AssemblerRepositorySourcer(logger, assembleContext); @@ -85,9 +85,7 @@ public async Task BuildAll( await using var collector = new ConsoleDiagnosticsCollector(logger, githubActionsService) { NoHints = true - }; - - _ = collector.StartAsync(ctx); + }.StartAsync(ctx); var assembleContext = new AssembleContext(environment, collector, new FileSystem(), new FileSystem(), null, null) { diff --git a/tests/docs-assembler.Tests/src/docs-assembler.Tests/GlobalNavigationTests.cs b/tests/docs-assembler.Tests/src/docs-assembler.Tests/GlobalNavigationTests.cs index 9ba1503bd..1e00597e5 100644 --- a/tests/docs-assembler.Tests/src/docs-assembler.Tests/GlobalNavigationTests.cs +++ b/tests/docs-assembler.Tests/src/docs-assembler.Tests/GlobalNavigationTests.cs @@ -249,8 +249,7 @@ public async Task UriResolving() { Assert.SkipUnless(HasCheckouts(), $"Requires local checkout folder: {CheckoutDirectory.FullName}"); - await using var collector = new DiagnosticsCollector([]); - _ = collector.StartAsync(TestContext.Current.CancellationToken); + await using var collector = new DiagnosticsCollector([]).StartAsync(TestContext.Current.CancellationToken); var fs = new FileSystem(); var assembleContext = new AssembleContext("prod", collector, fs, fs, null, null);