Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update packages and reformat code with newer CSharpier #644

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.26.1",
"version": "0.27.2",
"commands": [
"dotnet-csharpier"
]
Expand Down
30 changes: 15 additions & 15 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<IdentityServerVersion>4.1.2</IdentityServerVersion>
<MassTransitVersion>8.1.3</MassTransitVersion>
<SystemIdentityModelVersion>7.1.2</SystemIdentityModelVersion>
<SystemIdentityModelVersion>7.3.1</SystemIdentityModelVersion>

<!-- Do not bump these dependencies if you don't want to force users to use newer .NET Core SDK -->
<!-- Keep the major.minor values at exactly the one listed here: https://github.com/dotnet/roslyn/blob/main/docs/wiki/NuGet-packages.md -->
Expand All @@ -25,12 +25,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Update="Autofac" Version="7.1.0" />
<PackageReference Update="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Update="Autofac" Version="8.0.0" />
<PackageReference Update="Autofac.Extensions.DependencyInjection" Version="9.0.0" />

<PackageReference Update="Microsoft.Extensions.Azure" Version="1.7.1" />
<PackageReference Update="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.3.0" />
<PackageReference Update="Azure.Data.Tables" Version="12.8.2" />
<PackageReference Update="Azure.Data.Tables" Version="12.8.3" />
<PackageReference Update="Azure.Storage.Blobs" Version="12.19.1" />
<PackageReference Update="Azure.Identity" Version="1.10.4" />
<PackageReference Update="Azure.Security.KeyVault.Keys" Version="4.5.0" />
Expand All @@ -48,19 +48,19 @@
<PackageReference Update="System.IdentityModel.Tokens.Jwt" Version="$(SystemIdentityModelVersion)" />

<PackageReference Update="FirebaseAdmin" Version="2.4.0" />
<PackageReference Update="Google.Cloud.Firestore" Version="3.4.0" />
<PackageReference Update="Google.Cloud.Firestore" Version="3.5.0" />

<PackageReference Update="Microsoft.Data.SqlClient" Version="5.1.4" />
<PackageReference Update="Microsoft.Data.SqlClient" Version="5.1.5" />

<PackageReference Update="ConfigCat.Client" Version="9.0.1" />

<PackageReference Update="Ory.Kratos.Client" Version="1.0.0" />

<PackageReference Update="Cronos" Version="0.8.0" />
<PackageReference Update="Cronos" Version="0.8.3" />
<PackageReference Update="Dapper" Version="2.1.28" />
<PackageReference Update="FluentValidation" Version="11.9.0" />
<PackageReference Update="Polly" Version="8.2.1" />
<PackageReference Update="Sendgrid" Version="9.28.1" />
<PackageReference Update="Polly" Version="8.3.0" />
<PackageReference Update="Sendgrid" Version="9.29.1" />
</ItemGroup>

<ItemGroup>
Expand All @@ -85,7 +85,7 @@

<PackageReference Update="Microsoft.Extensions.Caching.Memory" Version="$(ExtensionsVersion)" />
<PackageReference Update="Microsoft.Extensions.Configuration" Version="$(ExtensionsVersion)" />
<PackageReference Update="Microsoft.Extensions.Configuration.Binder" Version="$(ExtensionsVersion)" />
<PackageReference Update="Microsoft.Extensions.Configuration.Binder" Version="8.0.1" />
<PackageReference Update="Microsoft.Extensions.Configuration.CommandLine" Version="$(ExtensionsVersion)" />
<PackageReference Update="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="$(ExtensionsVersion)" />
<PackageReference Update="Microsoft.Extensions.Configuration.Json" Version="$(ExtensionsVersion)" />
Expand All @@ -99,7 +99,7 @@
<PackageReference Update="Microsoft.Extensions.Logging.Configuration" Version="$(ExtensionsVersion)" />
<PackageReference Update="Microsoft.Extensions.Logging.Console" Version="$(ExtensionsVersion)" />
<PackageReference Update="Microsoft.Extensions.Logging.Debug" Version="$(ExtensionsVersion)" />
<PackageReference Update="Microsoft.Extensions.Options" Version="$(ExtensionsVersion)" />
<PackageReference Update="Microsoft.Extensions.Options" Version="8.0.1" />
<PackageReference Update="Microsoft.Extensions.Options.ConfigurationExtensions" Version="$(ExtensionsVersion)" />

<PackageReference Update="Microsoft.Extensions.Telemetry.Testing" Version="8.0.0-rc.2.23510.2" />
Expand All @@ -109,7 +109,7 @@

<PackageReference Update="Npgsql" Version="8.0.1" />
<PackageReference Update="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0" />
<PackageReference Update="Google.Apis.Auth" Version="1.65.0" />
<PackageReference Update="Google.Apis.Auth" Version="1.66.0" />

<PackageReference Update="IdentityServer4" Version="$(IdentityServerVersion)" />
<PackageReference Update="IdentityServer4.AspNetIdentity" Version="$(IdentityServerVersion)" />
Expand All @@ -132,8 +132,8 @@
<PackageReference Update="FluentAssertions" Version="6.12.0" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Update="NSubstitute" Version="5.1.0" />
<PackageReference Update="xunit" Version="2.6.5" />
<PackageReference Update="xunit.analyzers" Version="1.9.0" />
<PackageReference Update="xunit" Version="2.6.6" />
<PackageReference Update="xunit.analyzers" Version="1.10.0" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.5.6" />
<PackageReference Update="coverlet.collector" Version="6.0.0" />
</ItemGroup>
Expand All @@ -142,4 +142,4 @@
<CodeAnalysisSettingsLocation>$(MSBuildThisFileDirectory)</CodeAnalysisSettingsLocation>
<CodeAnalysisRuleSet>$(CodeAnalysisSettingsLocation)LeanCode.CodeAnalysis.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public long? ContentLength
set { }
}

public ICollection<string> Keys { get; } = new ReadOnlyCollection<string>([ ]);
public ICollection<string> Keys { get; } = new ReadOnlyCollection<string>([]);

public ICollection<StringValues> Values { get; } = new ReadOnlyCollection<StringValues>([ ]);
public ICollection<StringValues> Values { get; } = new ReadOnlyCollection<StringValues>([]);

public int Count => 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

public int Count => 0;

public ICollection<string> Keys => [ ];
public ICollection<string> Keys => [];

Check warning on line 15 in src/CQRS/LeanCode.CQRS.AspNetCore/Local/Context/NullRequestCookieCollection.cs

View check run for this annotation

Codecov / codecov/patch

src/CQRS/LeanCode.CQRS.AspNetCore/Local/Context/NullRequestCookieCollection.cs#L15

Added line #L15 was not covered by tests

private NullRequestCookieCollection() { }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ internal class NullSession : ISession

public string Id => "";

public IEnumerable<string> Keys => [ ];
public IEnumerable<string> Keys => [];

private NullSession() { }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ internal class NullWebSocketManager : WebSocketManager

public override bool IsWebSocketRequest => false;

public override IList<string> WebSocketRequestedProtocols { get; } = new ReadOnlyCollection<string>([ ]);
public override IList<string> WebSocketRequestedProtocols { get; } = new ReadOnlyCollection<string>([]);

private NullWebSocketManager() { }

Expand Down
3 changes: 1 addition & 2 deletions src/CQRS/LeanCode.CQRS.AspNetCore/ObjectExecutorFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ Type GetResultType(Type interfaceType) =>
objectType
.GetInterfaces()
.Single(i => i.IsConstructedGenericType && i.GetGenericTypeDefinition() == interfaceType)
.GenericTypeArguments
.First();
.GenericTypeArguments.First();
}

private static async Task<object?> ExecuteOperationAsync<TOperation, TResult, THandler>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,134 +91,114 @@ private static string BuildPath(RoutePattern pattern)

private static void DefineCommand(CQRSObjectMetadata metadata, ApiDescription apiDescription)
{
apiDescription
.ParameterDescriptions
.Add(
new()
{
IsRequired = true,
Source = BindingSource.Body,
Type = metadata.ObjectType,
ModelMetadata = CreateModelMetadata(metadata.ObjectType),
}
);
apiDescription.ParameterDescriptions.Add(
new()
{
IsRequired = true,
Source = BindingSource.Body,
Type = metadata.ObjectType,
ModelMetadata = CreateModelMetadata(metadata.ObjectType),
}
);

apiDescription
.SupportedResponseTypes
.Add(
new()
{
ModelMetadata = CreateModelMetadata(typeof(CommandResult)),
ApiResponseFormats = [ new() { MediaType = ApplicationJson } ],
StatusCode = 200,
Type = typeof(CommandResult),
}
);
apiDescription.SupportedResponseTypes.Add(
new()
{
ModelMetadata = CreateModelMetadata(typeof(CommandResult)),
ApiResponseFormats = [new() { MediaType = ApplicationJson }],
StatusCode = 200,
Type = typeof(CommandResult),
}
);

apiDescription
.SupportedResponseTypes
.Add(
new()
{
ModelMetadata = CreateModelMetadata(typeof(CommandResult)),
ApiResponseFormats = [ new() { MediaType = ApplicationJson } ],
StatusCode = 422,
Type = typeof(CommandResult),
}
);
apiDescription.SupportedResponseTypes.Add(
new()
{
ModelMetadata = CreateModelMetadata(typeof(CommandResult)),
ApiResponseFormats = [new() { MediaType = ApplicationJson }],
StatusCode = 422,
Type = typeof(CommandResult),
}
);
}

private static void DefineQuery(CQRSObjectMetadata metadata, ApiDescription apiDescription)
{
apiDescription
.ParameterDescriptions
.Add(
new()
{
IsRequired = true,
Source = BindingSource.Body,
Type = metadata.ObjectType,
ModelMetadata = CreateModelMetadata(metadata.ObjectType),
}
);
apiDescription.ParameterDescriptions.Add(
new()
{
IsRequired = true,
Source = BindingSource.Body,
Type = metadata.ObjectType,
ModelMetadata = CreateModelMetadata(metadata.ObjectType),
}
);

apiDescription
.SupportedResponseTypes
.Add(
new()
{
ModelMetadata = CreateModelMetadata(metadata.ResultType),
ApiResponseFormats = [ new() { MediaType = ApplicationJson } ],
StatusCode = 200,
Type = metadata.ResultType,
}
);
apiDescription.SupportedResponseTypes.Add(
new()
{
ModelMetadata = CreateModelMetadata(metadata.ResultType),
ApiResponseFormats = [new() { MediaType = ApplicationJson }],
StatusCode = 200,
Type = metadata.ResultType,
}
);
}

private static void DefineOperation(CQRSObjectMetadata metadata, ApiDescription apiDescription)
{
apiDescription
.ParameterDescriptions
.Add(
new()
{
IsRequired = true,
Source = BindingSource.Body,
Type = metadata.ObjectType,
ModelMetadata = CreateModelMetadata(metadata.ObjectType),
}
);
apiDescription.ParameterDescriptions.Add(
new()
{
IsRequired = true,
Source = BindingSource.Body,
Type = metadata.ObjectType,
ModelMetadata = CreateModelMetadata(metadata.ObjectType),
}
);

apiDescription
.SupportedResponseTypes
.Add(
new()
{
ModelMetadata = CreateModelMetadata(metadata.ResultType),
ApiResponseFormats = [ new() { MediaType = ApplicationJson } ],
StatusCode = 200,
Type = metadata.ResultType,
}
);
apiDescription.SupportedResponseTypes.Add(
new()
{
ModelMetadata = CreateModelMetadata(metadata.ResultType),
ApiResponseFormats = [new() { MediaType = ApplicationJson }],
StatusCode = 200,
Type = metadata.ResultType,
}
);
}

private static void AddCommonResponses(ApiDescription apiDescription)
{
apiDescription
.SupportedResponseTypes
.Add(
new()
{
ModelMetadata = CreateModelMetadata(typeof(void)),
ApiResponseFormats = [ new() { MediaType = ApplicationJson } ],
StatusCode = 400,
Type = typeof(void),
}
);
apiDescription.SupportedResponseTypes.Add(
new()
{
ModelMetadata = CreateModelMetadata(typeof(void)),
ApiResponseFormats = [new() { MediaType = ApplicationJson }],
StatusCode = 400,
Type = typeof(void),
}
);

apiDescription
.SupportedResponseTypes
.Add(
new()
{
ModelMetadata = CreateModelMetadata(typeof(void)),
ApiResponseFormats = [ new() { MediaType = ApplicationJson } ],
StatusCode = 401,
Type = typeof(void),
}
);
apiDescription.SupportedResponseTypes.Add(
new()
{
ModelMetadata = CreateModelMetadata(typeof(void)),
ApiResponseFormats = [new() { MediaType = ApplicationJson }],
StatusCode = 401,
Type = typeof(void),
}
);

apiDescription
.SupportedResponseTypes
.Add(
new()
{
ModelMetadata = CreateModelMetadata(typeof(void)),
ApiResponseFormats = [ new() { MediaType = ApplicationJson } ],
StatusCode = 403,
Type = typeof(void),
}
);
apiDescription.SupportedResponseTypes.Add(
new()
{
ModelMetadata = CreateModelMetadata(typeof(void)),
ApiResponseFormats = [new() { MediaType = ApplicationJson }],
StatusCode = 403,
Type = typeof(void),
}
);
}

private static CQRSBodyModelMetadata CreateModelMetadata(Type type) => new(ModelMetadataIdentity.ForType(type));
Expand Down
Loading
Loading