Skip to content

Commit 2344259

Browse files
committed
Ensure assemble build shows no hints but we now expose --show-hints to enable it
1 parent f7c6f51 commit 2344259

File tree

7 files changed

+28
-14
lines changed

7 files changed

+28
-14
lines changed

src/Elastic.Documentation/Diagnostics/DiagnosticsCollector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class DiagnosticsCollector(IReadOnlyCollection<IDiagnosticsOutput> output
2929

3030
public ConcurrentBag<string> CrossLinks { get; } = [];
3131

32-
public bool NoHints { get; init; }
32+
public bool NoHints { get; set; }
3333

3434
public DiagnosticsCollector StartAsync(Cancel ctx)
3535
{

src/Elastic.Documentation/Diagnostics/IDiagnosticsCollector.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ public interface IDiagnosticsCollector : IAsyncDisposable, IHostedService
1414
int Errors { get; }
1515
int Hints { get; }
1616

17+
bool NoHints { get; set; }
18+
1719
DiagnosticsChannel Channel { get; }
1820
ConcurrentBag<string> CrossLinks { get; }
1921
HashSet<string> OffendingFiles { get; }

src/services/Elastic.Documentation.Assembler/Building/AssemblerBuildService.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
using Elastic.Documentation.Configuration.Assembler;
1212
using Elastic.Documentation.Configuration.Navigation;
1313
using Elastic.Documentation.Diagnostics;
14-
using Elastic.Documentation.Legacy;
1514
using Elastic.Documentation.LegacyDocs;
1615
using Elastic.Documentation.Services;
1716
using Microsoft.Extensions.Logging;
@@ -27,8 +26,17 @@ ICoreService githubActionsService
2726
{
2827
private readonly ILogger _logger = logFactory.CreateLogger<AssemblerBuildService>();
2928

30-
public async Task<bool> BuildAll(IDiagnosticsCollector collector, bool? strict, string? environment, bool? metadataOnly, IReadOnlySet<Exporter>? exporters, FileSystem fs, Cancel ctx)
29+
public async Task<bool> BuildAll(
30+
IDiagnosticsCollector collector,
31+
bool? strict, string? environment,
32+
bool? metadataOnly,
33+
bool? showHints,
34+
IReadOnlySet<Exporter>? exporters,
35+
FileSystem fs,
36+
Cancel ctx
37+
)
3138
{
39+
collector.NoHints = !showHints.GetValueOrDefault(false);
3240
strict ??= false;
3341
exporters ??= metadataOnly.GetValueOrDefault(false) ? ExportOptions.MetadataOnly : ExportOptions.Default;
3442
// ensure we never generate a documentation state for assembler builds

src/services/Elastic.Documentation.Assembler/Indexing/AssemblerIndexService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,6 @@ public async Task<bool> Index(IDiagnosticsCollector collector,
133133

134134
var exporters = new HashSet<Exporter> { noSemantic.GetValueOrDefault(false) ? ElasticsearchNoSemantic : Elasticsearch };
135135

136-
return await BuildAll(collector, strict: false, environment, metadataOnly: true, exporters, fileSystem, ctx);
136+
return await BuildAll(collector, strict: false, environment, metadataOnly: true, showHints: false, exporters, fileSystem, ctx);
137137
}
138138
}

src/tooling/Elastic.Documentation.Tooling/DocumentationTooling.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ public static TBuilder AddDocumentationToolingDefaults<TBuilder>(this TBuilder b
3737
var isHelp = sp.GetRequiredService<CliInvocation>();
3838
if (isHelp.IsHelpOrVersion)
3939
return new DiagnosticsCollector([]);
40-
return new ConsoleDiagnosticsCollector(logFactory, githubActionsService)
41-
{
42-
NoHints = false
43-
};
40+
return new ConsoleDiagnosticsCollector(logFactory, githubActionsService);
4441
})
4542
.AddSingleton(sp =>
4643
{

src/tooling/docs-assembler/Cli/RepositoryCommands.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ public async Task<int> BuildAll(
9090
var fs = new FileSystem();
9191
var service = new AssemblerBuildService(logFactory, assemblyConfiguration, configurationContext, githubActionsService);
9292
serviceInvoker.AddCommand(service, (strict, environment, metadataOnly, exporters, fs), strict ?? false,
93-
static async (s, collector, state, ctx) => await s.BuildAll(collector, state.strict, state.environment, state.metadataOnly, state.exporters, state.fs, ctx)
93+
static async (s, collector, state, ctx) =>
94+
await s.BuildAll(collector, state.strict, state.environment, state.metadataOnly, false, state.exporters, state.fs, ctx)
9495
);
9596

9697
return await serviceInvoker.InvokeAsync(ctx);

src/tooling/docs-builder/Commands/Assembler/AssemblerCommands.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,21 @@ ICoreService githubActionsService
3232
/// <param name="fetchLatest"> If true, fetch the latest commit of the branch instead of the link registry entry ref</param>
3333
/// <param name="assumeCloned"> If true, assume the repository folder already exists on disk assume it's cloned already, primarily used for testing</param>
3434
/// <param name="metadataOnly"> Only emit documentation metadata to output, ignored if 'exporters' is also set </param>
35+
/// <param name="showHints"> Show hints from all documentation sets during assembler build</param>
3536
/// <param name="exporters"> Set available exporters:
3637
/// html, es, config, links, state, llm, redirect, metadata, none.
3738
/// Defaults to (html, config, links, state, redirect) or 'default'.
3839
/// </param>
3940
/// <param name="serve"> Serve the documentation on port 4000 after succesful build</param>
4041
/// <param name="ctx"></param>
4142
[Command("")]
42-
public async Task<int> CloneAll(
43+
public async Task<int> CloneAndBuild(
4344
bool? strict = null,
4445
string? environment = null,
4546
bool? fetchLatest = null,
4647
bool? assumeCloned = null,
4748
bool? metadataOnly = null,
49+
bool? showHints = null,
4850
[ExporterParser] IReadOnlySet<Exporter>? exporters = null,
4951
bool serve = false,
5052
Cancel ctx = default
@@ -59,8 +61,9 @@ static async (s, collector, state, ctx) => await s.CloneAll(collector, state.str
5961

6062
var buildService = new AssemblerBuildService(logFactory, assemblyConfiguration, configurationContext, githubActionsService);
6163
var fs = new FileSystem();
62-
serviceInvoker.AddCommand(buildService, (strict, environment, metadataOnly, exporters, fs), strict ?? false,
63-
static async (s, collector, state, ctx) => await s.BuildAll(collector, state.strict, state.environment, state.metadataOnly, state.exporters, state.fs, ctx)
64+
serviceInvoker.AddCommand(buildService, (strict, environment, metadataOnly, showHints, exporters, fs), strict ?? false,
65+
static async (s, collector, state, ctx) =>
66+
await s.BuildAll(collector, state.strict, state.environment, state.metadataOnly, state.showHints, state.exporters, state.fs, ctx)
6467
);
6568
var result = await serviceInvoker.InvokeAsync(ctx);
6669

@@ -114,6 +117,7 @@ static async (s, collector, state, ctx) => await s.CloneAll(collector, state.str
114117
/// <param name="strict"> Treat warnings as errors and fail the build on warnings</param>
115118
/// <param name="environment"> The environment to build</param>
116119
/// <param name="metadataOnly"> Only emit documentation metadata to output, ignored if 'exporters' is also set </param>
120+
/// <param name="showHints"> Show hints from all documentation sets during assembler build</param>
117121
/// <param name="exporters"> Set available exporters:
118122
/// html, es, config, links, state, llm, redirect, metadata, none.
119123
/// Defaults to (html, config, links, state, redirect) or 'default'.
@@ -124,6 +128,7 @@ public async Task<int> BuildAll(
124128
bool? strict = null,
125129
string? environment = null,
126130
bool? metadataOnly = null,
131+
bool? showHints = null,
127132
[ExporterParser] IReadOnlySet<Exporter>? exporters = null,
128133
Cancel ctx = default
129134
)
@@ -132,8 +137,9 @@ public async Task<int> BuildAll(
132137

133138
var fs = new FileSystem();
134139
var service = new AssemblerBuildService(logFactory, assemblyConfiguration, configurationContext, githubActionsService);
135-
serviceInvoker.AddCommand(service, (strict, environment, metadataOnly, exporters, fs), strict ?? false,
136-
static async (s, collector, state, ctx) => await s.BuildAll(collector, state.strict, state.environment, state.metadataOnly, state.exporters, state.fs, ctx)
140+
serviceInvoker.AddCommand(service, (strict, environment, metadataOnly, showHints, exporters, fs), strict ?? false,
141+
static async (s, collector, state, ctx) =>
142+
await s.BuildAll(collector, state.strict, state.environment, state.metadataOnly, state.showHints, state.exporters, state.fs, ctx)
137143
);
138144

139145
return await serviceInvoker.InvokeAsync(ctx);

0 commit comments

Comments
 (0)