Skip to content

Commit 35160d2

Browse files
committed
Run dotnet format ahead of enforcing it through build automation
1 parent b8a151b commit 35160d2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+286
-251
lines changed

build/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ dotnet publish {generatorSource}
3838
app.Add("notices", async Task<int> (Cancel ctx) =>
3939
{
4040
var packages = await "dotnet thirdlicense --project src/docs-builder/docs-builder.csproj --output NOTICE.txt";
41-
var packageLines = packages.Split(Environment.NewLine).Where(l=>l.StartsWith("+"));
41+
var packageLines = packages.Split(Environment.NewLine).Where(l => l.StartsWith("+"));
4242

4343
await File.WriteAllTextAsync("NOTICE.txt",
4444
$"""

src/Elastic.Markdown/BuildContext.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public BuildContext(IFileSystem readFileSystem, IFileSystem writeFileSystem, str
5252
: WriteFileSystem.DirectoryInfo.New(Path.Combine(Paths.Root.FullName, ".artifacts/docs/html"));
5353

5454
ConfigurationPath =
55-
ReadFileSystem.FileInfo.New(Path.Combine(SourcePath.FullName, "docset.yml"));
55+
ReadFileSystem.FileInfo.New(Path.Combine(SourcePath.FullName, "docset.yml"));
5656

5757
if (ConfigurationPath.FullName != SourcePath.FullName)
5858
SourcePath = ConfigurationPath.Directory!;
@@ -63,7 +63,7 @@ public BuildContext(IFileSystem readFileSystem, IFileSystem writeFileSystem, str
6363
private IDirectoryInfo FindDocsFolderFromRoot(IDirectoryInfo rootPath)
6464
{
6565
if (rootPath.Exists &&
66-
ReadFileSystem.File.Exists(Path.Combine(rootPath.FullName, "docset.yml")))
66+
ReadFileSystem.File.Exists(Path.Combine(rootPath.FullName, "docset.yml")))
6767
return rootPath;
6868

6969
var docsFolder = rootPath.EnumerateFiles("docset.yml", SearchOption.AllDirectories).FirstOrDefault();

src/Elastic.Markdown/Diagnostics/DiagnosticsChannel.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public class DiagnosticsCollector(ILoggerFactory loggerFactory, IReadOnlyCollect
7373
: IHostedService
7474
{
7575
private readonly IReadOnlyCollection<IDiagnosticsOutput> _outputs =
76-
[new LogDiagnosticOutput(loggerFactory.CreateLogger<LogDiagnosticOutput>()), ..outputs];
76+
[new LogDiagnosticOutput(loggerFactory.CreateLogger<LogDiagnosticOutput>()), .. outputs];
7777

7878
public DiagnosticsChannel Channel { get; } = new();
7979

@@ -88,7 +88,8 @@ public class DiagnosticsCollector(ILoggerFactory loggerFactory, IReadOnlyCollect
8888

8989
public Task StartAsync(Cancel ctx)
9090
{
91-
if (_started is not null) return _started;
91+
if (_started is not null)
92+
return _started;
9293
_started = Task.Run(async () =>
9394
{
9495
await Channel.WaitToWrite();

src/Elastic.Markdown/Diagnostics/ProcessorDiagnosticExtensions.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ public static class ProcessorDiagnosticExtensions
1515
public static void EmitError(this InlineProcessor processor, int line, int column, int length, string message)
1616
{
1717
var context = processor.GetContext();
18-
if (context.SkipValidation) return;
18+
if (context.SkipValidation)
19+
return;
1920
var d = new Diagnostic
2021
{
2122
Severity = Severity.Error,
@@ -32,7 +33,8 @@ public static void EmitError(this InlineProcessor processor, int line, int colum
3233
public static void EmitWarning(this InlineProcessor processor, int line, int column, int length, string message)
3334
{
3435
var context = processor.GetContext();
35-
if (context.SkipValidation) return;
36+
if (context.SkipValidation)
37+
return;
3638
var d = new Diagnostic
3739
{
3840
Severity = Severity.Warning,
@@ -47,7 +49,8 @@ public static void EmitWarning(this InlineProcessor processor, int line, int col
4749

4850
public static void EmitError(this ParserContext context, int line, int column, int length, string message, Exception? e = null)
4951
{
50-
if (context.SkipValidation) return;
52+
if (context.SkipValidation)
53+
return;
5154
var d = new Diagnostic
5255
{
5356
Severity = Severity.Error,
@@ -62,7 +65,8 @@ public static void EmitError(this ParserContext context, int line, int column, i
6265

6366
public static void EmitWarning(this ParserContext context, int line, int column, int length, string message)
6467
{
65-
if (context.SkipValidation) return;
68+
if (context.SkipValidation)
69+
return;
6670
var d = new Diagnostic
6771
{
6872
Severity = Severity.Warning,
@@ -99,7 +103,8 @@ public static void EmitWarning(this BuildContext context, IFileInfo file, string
99103

100104
public static void EmitError(this IBlockExtension block, string message, Exception? e = null)
101105
{
102-
if (block.SkipValidation) return;
106+
if (block.SkipValidation)
107+
return;
103108

104109
var d = new Diagnostic
105110
{
@@ -115,7 +120,8 @@ public static void EmitError(this IBlockExtension block, string message, Excepti
115120

116121
public static void EmitWarning(this IBlockExtension block, string message)
117122
{
118-
if (block.SkipValidation) return;
123+
if (block.SkipValidation)
124+
return;
119125

120126
var d = new Diagnostic
121127
{

src/Elastic.Markdown/DocumentationGenerator.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ ILoggerFactory logger
6161
{
6262
var stateFile = DocumentationSet.OutputStateFile;
6363
stateFile.Refresh();
64-
if (!stateFile.Exists) return null;
64+
if (!stateFile.Exists)
65+
return null;
6566
var contents = stateFile.FileSystem.File.ReadAllText(stateFile.FullName);
6667
return JsonSerializer.Deserialize(contents, SourceGenerationContext.Default.GenerationState);
6768
}
@@ -177,7 +178,7 @@ private bool CompilationNotNeeded(GenerationState? generationState, out HashSet<
177178
else if (DocumentationSet.LastWrite <= outputSeenChanges)
178179
{
179180
_logger.LogInformation($"No compilation: no changes since last observed: {generationState.LastSeenChanges} "
180-
+ "Pass --force to force a full regeneration");
181+
+ "Pass --force to force a full regeneration");
181182
return true;
182183
}
183184

src/Elastic.Markdown/IO/ConfigurationFile.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public ConfigurationFile(IFileInfo sourceFile, IDirectoryInfo rootPath, BuildCon
8686
break;
8787
}
8888
}
89-
Globs = ImplicitFolders.Select(f=> Glob.Parse($"{f}/*.md")).ToArray();
89+
Globs = ImplicitFolders.Select(f => Glob.Parse($"{f}/*.md")).ToArray();
9090
}
9191

9292
private List<ITocItem> ReadChildren(KeyValuePair<YamlNode, YamlNode> entry, string parentPath)
@@ -167,7 +167,8 @@ private List<ITocItem> ReadChildren(KeyValuePair<YamlNode, YamlNode> entry, stri
167167
{
168168
found = false;
169169
var file = ReadString(entry);
170-
if (file is null) return null;
170+
if (file is null)
171+
return null;
171172

172173
var path = Path.Combine(_rootPath.FullName, parentPath.TrimStart('/'), file);
173174
if (!_context.ReadFileSystem.FileInfo.New(path).Exists)

src/Elastic.Markdown/IO/DocumentationFolder.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public DocumentationFolder(IReadOnlyCollection<ITocItem> toc,
4646
{
4747
var children = folder.Children;
4848
if (children.Count == 0
49-
&& folderLookup.TryGetValue(folder.Path, out var documentationFiles))
49+
&& folderLookup.TryGetValue(folder.Path, out var documentationFiles))
5050
{
5151
children = documentationFiles
5252
.Select(d => new TocFile(d.RelativePath, true, []))
@@ -61,7 +61,7 @@ public DocumentationFolder(IReadOnlyCollection<ITocItem> toc,
6161
Index ??= FilesInOrder.FirstOrDefault();
6262
if (Index != null)
6363
FilesInOrder = FilesInOrder.Except(new[] { Index }).ToList();
64-
OwnFiles = [..FilesInOrder];
64+
OwnFiles = [.. FilesInOrder];
6565
}
6666

6767
public bool HoldsCurrent(MarkdownFile current) =>
@@ -71,7 +71,8 @@ public bool HoldsCurrent(MarkdownFile current) =>
7171

7272
public async Task Resolve(Cancel ctx = default)
7373
{
74-
if (_resolved) return;
74+
if (_resolved)
75+
return;
7576

7677
await Parallel.ForEachAsync(FilesInOrder, ctx, async (file, token) => await file.MinimalParse(token));
7778
await Parallel.ForEachAsync(GroupsInOrder, ctx, async (group, token) => await group.Resolve(token));

src/Elastic.Markdown/IO/DocumentationSet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public DocumentationSet(BuildContext context)
5454
FlatMappedFiles = Files.ToDictionary(file => file.RelativePath, file => file);
5555
var folderFiles = Files
5656
.GroupBy(file => file.RelativeFolder)
57-
.ToDictionary(g=>g.Key, g=>g.ToArray());
57+
.ToDictionary(g => g.Key, g => g.ToArray());
5858

5959
Tree = new DocumentationFolder(Configuration.TableOfContents, FlatMappedFiles, folderFiles);
6060
}

src/Elastic.Markdown/IO/MarkdownFile.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ private void ReadDocumentInstructions(MarkdownDocument document)
9797
_tableOfContent[t.Slug] = t;
9898

9999
var labels = document.Descendants<DirectiveBlock>()
100-
.Select(b=>b.CrossReferenceName)
101-
.Where(l=>!string.IsNullOrWhiteSpace(l))
100+
.Select(b => b.CrossReferenceName)
101+
.Where(l => !string.IsNullOrWhiteSpace(l))
102102
.Select(_slugHelper.GenerateSlug)
103103
.ToArray();
104-
foreach(var label in labels)
104+
foreach (var label in labels)
105105
{
106106
if (!string.IsNullOrEmpty(label))
107107
_additionalLabels.Add(label);

src/Elastic.Markdown/IO/Paths.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ private static DirectoryInfo RootDirectoryInfo()
99
{
1010
var directory = new DirectoryInfo(Directory.GetCurrentDirectory());
1111
while (directory != null &&
12-
(directory.GetFiles("*.sln").Length == 0 || directory.GetDirectories(".git").Length == 0))
12+
(directory.GetFiles("*.sln").Length == 0 || directory.GetDirectories(".git").Length == 0))
1313
directory = directory.Parent;
1414
return directory ?? new DirectoryInfo(Directory.GetCurrentDirectory());
1515
}

0 commit comments

Comments
 (0)