Skip to content

Commit 75902a3

Browse files
committed
formatting and BOM files cleanup
1 parent 1c1ab39 commit 75902a3

File tree

10 files changed

+40
-30
lines changed

10 files changed

+40
-30
lines changed

docs-builder.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
22
Microsoft Visual Studio Solution File, Format Version 12.00
33
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.Markdown", "src\Elastic.Markdown\Elastic.Markdown.csproj", "{4D198E25-C211-41DC-9E84-B15E89BD7048}"
44
EndProject

src/Elastic.Markdown.Refactor/Elastic.Markdown.Refactor.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>net9.0</TargetFramework>

src/Elastic.Markdown/Elastic.Markdown.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Razor">
1+
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
44
<TargetFramework>net9.0</TargetFramework>

src/Elastic.Markdown/Myst/CodeBlocks/EnhancedCodeBlockParser.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protected override EnhancedCodeBlock CreateFencedBlock(BlockProcessor processor)
3131
if (processor.Context is not ParserContext context)
3232
throw new Exception("Expected parser context to be of type ParserContext");
3333

34-
var lineSpan = processor.Line.AsSpan();
34+
var lineSpan = processor.Line.AsSpan();
3535
var codeBlock = lineSpan.IndexOf("{applies_to}") > -1
3636
? new AppliesToDirective(this, context) { IndentCount = processor.Indent }
3737
: new EnhancedCodeBlock(this, context) { IndentCount = processor.Indent };
@@ -116,7 +116,6 @@ private static void ProcessAppliesToDirective(AppliesToDirective appliesToDirect
116116
{
117117
var applicableTo = YamlSerialization.Deserialize<ApplicableTo>(yaml);
118118
appliesToDirective.AppliesTo = applicableTo;
119-
120119
}
121120
catch (Exception e)
122121
{
@@ -162,6 +161,7 @@ private static void ProcessCallOuts(StringLineGroup lines, string language, Enha
162161
EnumerateAnnotations(matchClassicCallout, ref span, ref callOutIndex, originatingLine, false)
163162
);
164163
}
164+
165165
// only support magic callouts for smaller line lengths
166166
if (callOuts.Count == 0 && span.Length < 200)
167167
{
@@ -170,6 +170,7 @@ private static void ProcessCallOuts(StringLineGroup lines, string language, Enha
170170
EnumerateAnnotations(matchInline, ref span, ref callOutIndex, originatingLine, true)
171171
);
172172
}
173+
173174
codeBlock.CallOuts.AddRange(callOuts);
174175
}
175176

@@ -191,7 +192,6 @@ private static void ProcessCallOuts(StringLineGroup lines, string language, Enha
191192
var newSpan = line.Slice.AsSpan()[..callout.SliceStart];
192193
var s = new StringSlice(newSpan.ToString());
193194
lines.Lines[callout.Line - 1] = new StringLine(ref s);
194-
195195
}
196196
}
197197

@@ -263,6 +263,7 @@ private static List<CallOut> ParseClassicCallOuts(ValueMatch match, ref ReadOnly
263263
if (span[i] == '<')
264264
allStartIndices.Add(i);
265265
}
266+
266267
var callOuts = new List<CallOut>();
267268
foreach (var individualStartIndex in allStartIndices)
268269
{
@@ -281,6 +282,7 @@ private static List<CallOut> ParseClassicCallOuts(ValueMatch match, ref ReadOnly
281282
});
282283
}
283284
}
285+
284286
return callOuts;
285287
}
286288
}

src/Elastic.Markdown/Myst/FrontMatter/Applicability.cs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Elastic.Markdown.Myst.FrontMatter;
1414
public record ApplicabilityOverTime : IReadOnlyCollection<Applicability>
1515
{
1616
private readonly IReadOnlyCollection<Applicability> _items;
17-
public ApplicabilityOverTime(Applicability[] items) => _items = items;
17+
private ApplicabilityOverTime(Applicability[] items) => _items = items;
1818

1919
// <lifecycle> [version]
2020
public static bool TryParse(string? value, out ApplicabilityOverTime? availability)
@@ -56,14 +56,15 @@ public virtual bool Equals(ApplicabilityOverTime? other)
5656
public override int GetHashCode()
5757
{
5858
var comparer = StructuralComparisons.StructuralEqualityComparer;
59-
return (EqualityComparer<Type>.Default.GetHashCode(EqualityContract) * -1521134295)
60-
+ comparer.GetHashCode(_items);
59+
return
60+
EqualityComparer<Type>.Default.GetHashCode(EqualityContract) * -1521134295
61+
+ comparer.GetHashCode(_items);
6162
}
6263

6364

6465
public static explicit operator ApplicabilityOverTime(string b)
6566
{
66-
var productAvailability = TryParse(b, out var version) ? version : null;
67+
var productAvailability = TryParse(b, out var version) ? version : null;
6768
return productAvailability ?? throw new ArgumentException($"'{b}' is not a valid applicability string array.");
6869
}
6970

@@ -128,7 +129,6 @@ public static explicit operator Applicability(string b)
128129
return productAvailability ?? throw new ArgumentException($"'{b}' is not a valid applicability string.");
129130
}
130131

131-
// <lifecycle> [version]
132132
public static bool TryParse(string? value, [NotNullWhen(true)] out Applicability? availability)
133133
{
134134
if (string.IsNullOrWhiteSpace(value) || string.Equals(value.Trim(), "all", StringComparison.InvariantCultureIgnoreCase))
@@ -143,6 +143,7 @@ public static bool TryParse(string? value, [NotNullWhen(true)] out Applicability
143143
availability = null;
144144
return false;
145145
}
146+
146147
var lifecycle = tokens[0].ToLowerInvariant() switch
147148
{
148149
"preview" => ProductLifecycle.TechnicalPreview,
@@ -158,13 +159,15 @@ public static bool TryParse(string? value, [NotNullWhen(true)] out Applicability
158159
_ => throw new ArgumentOutOfRangeException(nameof(tokens), tokens, $"Unknown product lifecycle: {tokens[0]}")
159160
};
160161

161-
var version = tokens.Length < 2 ? null : tokens[1] switch
162-
{
163-
null => AllVersions.Instance,
164-
"all" => AllVersions.Instance,
165-
"" => AllVersions.Instance,
166-
var t => SemVersionConverter.TryParse(t, out var v) ? v : null
167-
};
162+
var version = tokens.Length < 2
163+
? null
164+
: tokens[1] switch
165+
{
166+
null => AllVersions.Instance,
167+
"all" => AllVersions.Instance,
168+
"" => AllVersions.Instance,
169+
var t => SemVersionConverter.TryParse(t, out var v) ? v : null
170+
};
168171
availability = new Applicability { Version = version, Lifecycle = lifecycle };
169172
return true;
170173
}

src/Elastic.Markdown/Myst/FrontMatter/ApplicableTo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// See the LICENSE file in the project root for more information
44

55
using System.Diagnostics.CodeAnalysis;
6-
using System.Text;
76
using YamlDotNet.Core;
87
using YamlDotNet.Core.Events;
98
using YamlDotNet.Serialization;
@@ -85,6 +84,7 @@ public record ServerlessProjectApplicability
8584
Security = ApplicabilityOverTime.GenerallyAvailable
8685
};
8786
}
87+
8888
public class ApplicableToConverter : IYamlTypeConverter
8989
{
9090
public bool Accepts(Type type) => type == typeof(ApplicableTo);
@@ -137,7 +137,7 @@ private static void AssignDeploymentType(Dictionary<object, object?> dictionary,
137137
Ece = av,
138138
Eck = av,
139139
Ess = av,
140-
Self = av,
140+
Self = av
141141
};
142142
}
143143
else if (deploymentType is Dictionary<object, object?> deploymentDictionary)
@@ -210,7 +210,7 @@ private static void AssignServerless(Dictionary<object, object?> dictionary, App
210210

211211
private static bool TryGetProjectApplicability(
212212
Dictionary<object, object?> dictionary,
213-
[NotNullWhen(true)]out ServerlessProjectApplicability? applicability
213+
[NotNullWhen(true)] out ServerlessProjectApplicability? applicability
214214
)
215215
{
216216
applicability = null;

src/Elastic.Markdown/Myst/FrontMatter/Deployment.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace Elastic.Markdown.Myst.FrontMatter;
1010

1111
[YamlSerializable]
12-
[Obsolete( "Use YamlFrontMatter.Apply instead see also DeploymentMode")]
12+
[Obsolete("Use YamlFrontMatter.Apply instead see also DeploymentMode")]
1313
public record Deployment
1414
{
1515
[YamlMember(Alias = "self")]
@@ -26,7 +26,7 @@ public record Deployment
2626
}
2727

2828
[YamlSerializable]
29-
[Obsolete( "Use YamlFrontMatter.Apply instead")]
29+
[Obsolete("Use YamlFrontMatter.Apply instead")]
3030
public record SelfManagedDeployment
3131
{
3232
[YamlMember(Alias = "stack")]
@@ -47,7 +47,7 @@ public record SelfManagedDeployment
4747
}
4848

4949
[YamlSerializable]
50-
[Obsolete( "Use YamlFrontMatter.Apply instead")]
50+
[Obsolete("Use YamlFrontMatter.Apply instead")]
5151
public record CloudManagedDeployment
5252
{
5353
[YamlMember(Alias = "hosted")]
@@ -61,11 +61,10 @@ public record CloudManagedDeployment
6161
Hosted = Applicability.GenerallyAvailable,
6262
Serverless = Applicability.GenerallyAvailable
6363
};
64-
6564
}
6665

6766
#pragma warning disable CS0618 // Type or member is obsolete
68-
[Obsolete( "Use DeploymentAvailability instead" )]
67+
[Obsolete("Use DeploymentAvailability instead")]
6968
public class DeploymentConverter : IYamlTypeConverter
7069
{
7170
public bool Accepts(Type type) => type == typeof(Deployment);
@@ -79,6 +78,7 @@ public class DeploymentConverter : IYamlTypeConverter
7978
if (string.Equals(value.Value, "all", StringComparison.InvariantCultureIgnoreCase))
8079
return Deployment.All;
8180
}
81+
8282
var deserialized = rootDeserializer.Invoke(typeof(Dictionary<string, string>));
8383
if (deserialized is not Dictionary<string, string> { Count: > 0 } dictionary)
8484
return null;
@@ -91,6 +91,7 @@ public class DeploymentConverter : IYamlTypeConverter
9191
deployment.Cloud.Serverless = version;
9292
deployment.Cloud.Hosted = version;
9393
}
94+
9495
if (TryGetAvailability("self", out version))
9596
{
9697
deployment.SelfManaged ??= new SelfManagedDeployment();
@@ -104,34 +105,38 @@ public class DeploymentConverter : IYamlTypeConverter
104105
deployment.SelfManaged ??= new SelfManagedDeployment();
105106
deployment.SelfManaged.Stack = version;
106107
}
108+
107109
if (TryGetAvailability("ece", out version))
108110
{
109111
deployment.SelfManaged ??= new SelfManagedDeployment();
110112
deployment.SelfManaged.Ece = version;
111113
}
114+
112115
if (TryGetAvailability("eck", out version))
113116
{
114117
deployment.SelfManaged ??= new SelfManagedDeployment();
115118
deployment.SelfManaged.Eck = version;
116119
}
120+
117121
if (TryGetAvailability("hosted", out version))
118122
{
119123
deployment.Cloud ??= new CloudManagedDeployment();
120124
deployment.Cloud.Hosted = version;
121125
}
126+
122127
if (TryGetAvailability("serverless", out version))
123128
{
124129
deployment.Cloud ??= new CloudManagedDeployment();
125130
deployment.Cloud.Serverless = version;
126131
}
132+
127133
return deployment;
128134

129135
bool TryGetAvailability(string key, out Applicability? semVersion)
130136
{
131137
semVersion = null;
132138
return dictionary.TryGetValue(key, out var v) && Applicability.TryParse(v, out semVersion);
133139
}
134-
135140
}
136141

137142
public void WriteYaml(IEmitter emitter, object? value, Type type, ObjectSerializer serializer) =>

src/docs-assembler/docs-assembler.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Razor">
1+
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
44
<TargetFramework>net9.0</TargetFramework>

src/docs-builder/docs-builder.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Razor">
1+
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
44
<TargetFramework>net9.0</TargetFramework>

tests/authoring/authoring.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>net9.0</TargetFramework>

0 commit comments

Comments
 (0)