Skip to content

Commit d0c280c

Browse files
committed
fix issue with Microsoft.CodeAnalysis.CSharp version
1 parent 9b6ffba commit d0c280c

6 files changed

Lines changed: 121 additions & 14 deletions

File tree

.github/dependabot.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,8 @@ updates:
5656
- "xunit.extensibility.*"
5757
- "xunit.runner.*"
5858
ignore:
59-
- dependency-name: FluentAssertions
60-
versions: [">=8.0.0"]
6159
- dependency-name: AutoMapper
6260
versions: [">=15.0.0"]
6361
- dependency-name: MediatR
6462
versions: [">=13.0.0"]
63+
- dependency-name: Microsoft.CodeAnalysis.CSharp

Directory.Packages.props

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<ItemGroup>
88
<PackageVersion Include="Aspire.Hosting.AppHost" Version="13.2.3" />
99
<PackageVersion Include="AspNetCore.SecurityKey" Version="4.1.0" />
10-
<PackageVersion Include="AssemblyMetadata.Generators" Version="2.1.0" />
10+
<PackageVersion Include="AssemblyMetadata.Generators" Version="2.2.0" />
1111
<PackageVersion Include="AutoMapper" Version="[14.0.0]" />
1212
<PackageVersion Include="AwesomeAssertions" Version="9.4.0" />
1313
<PackageVersion Include="Azure.Communication.Email" Version="1.1.0" />
@@ -25,14 +25,14 @@
2525
<PackageVersion Include="MailKit" Version="4.16.0" />
2626
<PackageVersion Include="MediatR" Version="[12.5.0]" />
2727
<PackageVersion Include="MessagePack" Version="3.1.4" />
28-
<PackageVersion Include="Meziantou.Analyzer" Version="3.0.50" />
28+
<PackageVersion Include="Meziantou.Analyzer" Version="3.0.52" />
2929
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.7" />
3030
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="10.0.7" />
3131
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="10.0.7" />
3232
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="10.0.7" />
33-
<PackageVersion Include="Microsoft.Bcl.Memory" Version="10.0.6" />
34-
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="[5.3.0]" />
35-
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="10.0.6" />
33+
<PackageVersion Include="Microsoft.Bcl.Memory" Version="10.0.7" />
34+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="[4.8.0]" />
35+
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="10.0.7" />
3636
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.7" />
3737
<PackageVersion Include="Microsoft.Extensions.Caching.Abstractions" Version="10.0.7" />
3838
<PackageVersion Include="Microsoft.Extensions.Caching.Hybrid" Version="10.5.0" />
@@ -60,18 +60,18 @@
6060
<PackageVersion Include="OpenTelemetry.Instrumentation.SqlClient" Version="1.15.2" />
6161
<PackageVersion Include="Riok.Mapperly" Version="4.3.1" />
6262
<PackageVersion Include="Rocks" Version="10.1.0" />
63-
<PackageVersion Include="Scalar.AspNetCore" Version="2.14.1" />
63+
<PackageVersion Include="Scalar.AspNetCore" Version="2.14.4" />
6464
<PackageVersion Include="SendGrid.Extensions.DependencyInjection" Version="1.0.1" />
6565
<PackageVersion Include="Serilog.AspNetCore" Version="10.0.0" />
6666
<PackageVersion Include="starkbank-ecdsa" Version="1.3.3" />
67-
<PackageVersion Include="System.IO.Hashing" Version="10.0.6" />
67+
<PackageVersion Include="System.IO.Hashing" Version="10.0.7" />
6868
<PackageVersion Include="System.Linq.Dynamic.Core" Version="1.7.2" />
6969
<PackageVersion Include="System.Text.Json" Version="10.0.4" />
7070
<PackageVersion Include="SystemTextJsonPatch" Version="5.0.0" />
7171
<PackageVersion Include="TestHost.Abstracts" Version="2.0.0" />
7272
<PackageVersion Include="Testcontainers.MongoDb" Version="4.11.0" />
7373
<PackageVersion Include="Testcontainers.MsSql" Version="4.11.0" />
74-
<PackageVersion Include="TUnit" Version="1.37.10" />
74+
<PackageVersion Include="TUnit" Version="1.37.36" />
7575
<PackageVersion Include="Twilio" Version="7.14.7" />
7676
<PackageVersion Include="Verify.TUnit" Version="31.16.1" />
7777
<PackageVersion Include="YamlDotNet" Version="17.0.1" />

src/Arbiter.Mapping.Generators/Infrastructure/CollectionBuilderAttribute.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#pragma warning disable IDE0130 // Namespace does not match folder structure
2+
13
using System.ComponentModel;
24

35
namespace System.Runtime.CompilerServices;

src/Arbiter.Mapping.Generators/Infrastructure/IndentedStringBuilder.cs

Lines changed: 107 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
using System.Diagnostics.CodeAnalysis;
12
using System.Text;
23

34
namespace Arbiter.Mapping.Generators.Infrastructure;
45

56
/// <summary>
67
/// A thin wrapper over <see cref="StringBuilder" /> that adds indentation to each line built.
78
/// </summary>
8-
internal class IndentedStringBuilder
9+
[ExcludeFromCodeCoverage]
10+
public class IndentedStringBuilder
911
{
1012
private const byte IndentSize = 4;
1113
private byte _indent;
@@ -24,7 +26,7 @@ public virtual int Length
2426
/// </summary>
2527
/// <param name="value">The string to append.</param>
2628
/// <returns>This builder so that additional calls can be chained.</returns>
27-
public virtual IndentedStringBuilder Append(string value)
29+
public virtual IndentedStringBuilder Append(string? value)
2830
{
2931
DoIndent();
3032

@@ -33,6 +35,23 @@ public virtual IndentedStringBuilder Append(string value)
3335
return this;
3436
}
3537

38+
/// <summary>
39+
/// Appends the current indent and then the given string to the string being built.
40+
/// </summary>
41+
/// <param name="value">The value to append.</param>
42+
/// <returns>This builder so that additional calls can be chained.</returns>
43+
public virtual IndentedStringBuilder Append<T>(T? value)
44+
{
45+
if (value == null)
46+
return this;
47+
48+
DoIndent();
49+
50+
_stringBuilder.Append(value.ToString());
51+
52+
return this;
53+
}
54+
3655
/// <summary>
3756
/// Appends the current indent and then the given char to the string being built.
3857
/// </summary>
@@ -77,6 +96,66 @@ public virtual IndentedStringBuilder Append(IEnumerable<char> value)
7796
return this;
7897
}
7998

99+
/// <summary>
100+
/// Appends the current indent and then the given strings to the string being built.
101+
/// </summary>
102+
/// <typeparam name="T">The type of the members of values.</typeparam>
103+
/// <param name="separator">The string to use as a separator. separator is included in the concatenated and appended strings only if values has more than one element.</param>
104+
/// <param name="values">A collection that contains the objects to concatenate and append to the current instance of the string builder.</param>
105+
/// <returns>This builder so that additional calls can be chained.</returns>
106+
public virtual IndentedStringBuilder AppendJoin<T>(IEnumerable<T> values, string separator)
107+
{
108+
if (values is null)
109+
throw new ArgumentNullException(nameof(values));
110+
111+
separator ??= string.Empty;
112+
113+
DoIndent();
114+
115+
var wroteValue = false;
116+
117+
foreach (var value in values)
118+
{
119+
if (wroteValue)
120+
_stringBuilder.Append(separator);
121+
122+
_stringBuilder.Append(value);
123+
wroteValue = true;
124+
}
125+
126+
return this;
127+
}
128+
129+
/// <summary>Appends the current indent and then the given strings to the string being built.</summary>
130+
/// <typeparam name="T">The type of the members of values.</typeparam>
131+
/// <param name="values">A collection that contains the objects to concatenate and append to the current instance of the string builder.</param>
132+
/// <param name="separator">The string to use as a separator. separator is included in the concatenated and appended strings only if values has more than one element.</param>
133+
/// <param name="condition"></param>
134+
/// <returns>This builder so that additional calls can be chained.</returns>
135+
public virtual IndentedStringBuilder AppendJoinIf<T>(IEnumerable<T> values, string separator, Func<IEnumerable<T>, bool>? condition = null)
136+
{
137+
var c = condition ?? (s => s.Any());
138+
139+
if (c(values))
140+
AppendJoin(values, separator);
141+
142+
return this;
143+
}
144+
145+
/// <summary>Appends the current indent and then the given strings to the string being built.</summary>
146+
/// <typeparam name="T">The type of the members of values.</typeparam>
147+
/// <param name="values">A collection that contains the objects to concatenate and append to the current instance of the string builder.</param>
148+
/// <param name="separator">The string to use as a separator. separator is included in the concatenated and appended strings only if values has more than one element.</param>
149+
/// <param name="condition"></param>
150+
/// <returns>This builder so that additional calls can be chained.</returns>
151+
public virtual IndentedStringBuilder AppendJoinIf<T>(IEnumerable<T> values, string separator, bool condition)
152+
{
153+
if (condition)
154+
AppendJoin(values, separator);
155+
156+
return this;
157+
}
158+
80159
/// <summary>
81160
/// Appends a new line to the string being built.
82161
/// </summary>
@@ -161,7 +240,7 @@ public IndentedStringBuilder AppendIf(string text, Func<string, bool>? condition
161240
/// </summary>
162241
/// <param name="text">The string to append.</param>
163242
/// <param name="condition">The condition delegate to evaluate. If condition is null, String.IsNullOrWhiteSpace method will be used.</param>
164-
public IndentedStringBuilder AppendIf(string text, bool condition)
243+
public IndentedStringBuilder AppendIf(string? text, bool condition)
165244
{
166245
if (condition)
167246
Append(text);
@@ -184,6 +263,31 @@ public IndentedStringBuilder AppendLineIf(string text, Func<string, bool>? condi
184263
return this;
185264
}
186265

266+
/// <summary>
267+
/// Appends a copy of the specified string followed by the default line terminator if <paramref name="condition"/> is met.
268+
/// </summary>
269+
/// <param name="text">The string to append.</param>
270+
/// <param name="condition">The condition delegate to evaluate. If condition is null, String.IsNullOrWhiteSpace method will be used.</param>
271+
public IndentedStringBuilder AppendLineIf(string text, bool condition)
272+
{
273+
if (condition)
274+
AppendLine(text);
275+
276+
return this;
277+
}
278+
279+
/// <summary>
280+
/// Appends a copy of the specified string followed by the default line terminator if <paramref name="condition"/> is met.
281+
/// </summary>
282+
/// <param name="condition">The condition delegate to evaluate. If condition is null, String.IsNullOrWhiteSpace method will be used.</param>
283+
public IndentedStringBuilder AppendLineIf(bool condition)
284+
{
285+
if (condition)
286+
AppendLine();
287+
288+
return this;
289+
}
290+
187291
/// <summary>
188292
/// Resets this builder ready to build a new string.
189293
/// </summary>

src/Arbiter.Mapping.Generators/Infrastructure/IsExternalInit.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#pragma warning disable IDE0130 // Namespace does not match folder structure
2+
13
using System.ComponentModel;
24

35
namespace System.Runtime.CompilerServices;

src/Arbiter.Mapping/Arbiter.Mapping.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
</ItemGroup>
1111

1212
<ItemGroup>
13-
<None Include="..\Arbiter.Mapping.Generators\bin\$(Configuration)\netstandard2.0\Arbiter.Mapping.Generators.dll" PackagePath="analyzers/dotnet/roslyn4.8/cs" Pack="true" Visible="false" />
13+
<None Include="..\Arbiter.Mapping.Generators\bin\$(Configuration)\netstandard2.0\Arbiter.Mapping.Generators.dll" PackagePath="analyzers/dotnet/cs" Pack="true" Visible="false" />
1414
</ItemGroup>
1515
</Project>

0 commit comments

Comments
 (0)