From e8c0b13c6a0d129c47fb07a374d639e0b69a873e Mon Sep 17 00:00:00 2001 From: Raman Maksimchuk Date: Tue, 26 Nov 2024 22:39:23 +0300 Subject: [PATCH] Review Dependabot alerts for `net6.0` and `net7.0` target frameworks and bump all packages (#2220) * Fix CS1574 warning * IDE0060: Remove unused parameter 'queryString' if it is not part of a shipped public API * Warning NETSDK1138: The target framework 'net7.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. Remove target framework 'net7.0' from testing projects. * IDE0079: Remove unnecessary suppression SA1649 * Bump all packages * Fix issues of code review by @ggnaegi --- .../Ocelot.Administration.csproj | 8 +-- .../Ocelot.Cache.CacheManager.csproj | 24 ++++---- .../Ocelot.Provider.Consul.csproj | 2 +- .../Ocelot.Provider.Polly.csproj | 2 +- src/Ocelot/Infrastructure/RegexGlobal.cs | 6 +- src/Ocelot/Ocelot.csproj | 12 ++-- src/Ocelot/Responses/ErrorResponse.cs | 17 ++++-- src/Ocelot/Responses/ErrorResponseGeneric.cs | 19 ------ src/Ocelot/Responses/OkResponse.cs | 9 ++- src/Ocelot/Responses/OkResponseGeneric.cs | 11 ---- src/Ocelot/Responses/Response.cs | 13 +++++ src/Ocelot/Responses/ResponseGeneric.cs | 20 ------- .../Ocelot.AcceptanceTests.csproj | 55 +++++++----------- .../Routing/RoutingTests.cs | 14 ++--- .../Ocelot.Benchmarks.csproj | 8 +-- .../Ocelot.IntegrationTests.csproj | 50 ++++++---------- .../Ocelot.ManualTest.csproj | 45 ++++++-------- test/Ocelot.Testing/Ocelot.Testing.csproj | 2 +- test/Ocelot.UnitTests/Ocelot.UnitTests.csproj | 58 ++++++++----------- 19 files changed, 151 insertions(+), 224 deletions(-) delete mode 100644 src/Ocelot/Responses/ErrorResponseGeneric.cs delete mode 100644 src/Ocelot/Responses/OkResponseGeneric.cs delete mode 100644 src/Ocelot/Responses/ResponseGeneric.cs diff --git a/src/Ocelot.Administration/Ocelot.Administration.csproj b/src/Ocelot.Administration/Ocelot.Administration.csproj index 7852a18ab..ebc924a0f 100644 --- a/src/Ocelot.Administration/Ocelot.Administration.csproj +++ b/src/Ocelot.Administration/Ocelot.Administration.csproj @@ -42,8 +42,8 @@ - - + + @@ -52,7 +52,7 @@ - - + + diff --git a/src/Ocelot.Cache.CacheManager/Ocelot.Cache.CacheManager.csproj b/src/Ocelot.Cache.CacheManager/Ocelot.Cache.CacheManager.csproj index 03580ae63..7ac170844 100644 --- a/src/Ocelot.Cache.CacheManager/Ocelot.Cache.CacheManager.csproj +++ b/src/Ocelot.Cache.CacheManager/Ocelot.Cache.CacheManager.csproj @@ -43,26 +43,26 @@ - - - - + + + + - - - - - - - - + + + + + + + + diff --git a/src/Ocelot.Provider.Consul/Ocelot.Provider.Consul.csproj b/src/Ocelot.Provider.Consul/Ocelot.Provider.Consul.csproj index 0d351c65c..b97fe54a9 100644 --- a/src/Ocelot.Provider.Consul/Ocelot.Provider.Consul.csproj +++ b/src/Ocelot.Provider.Consul/Ocelot.Provider.Consul.csproj @@ -30,7 +30,7 @@ - + all diff --git a/src/Ocelot.Provider.Polly/Ocelot.Provider.Polly.csproj b/src/Ocelot.Provider.Polly/Ocelot.Provider.Polly.csproj index fadfa376c..46df97c7f 100644 --- a/src/Ocelot.Provider.Polly/Ocelot.Provider.Polly.csproj +++ b/src/Ocelot.Provider.Polly/Ocelot.Provider.Polly.csproj @@ -34,7 +34,7 @@ all - + diff --git a/src/Ocelot/Infrastructure/RegexGlobal.cs b/src/Ocelot/Infrastructure/RegexGlobal.cs index a9847040e..d949756bf 100644 --- a/src/Ocelot/Infrastructure/RegexGlobal.cs +++ b/src/Ocelot/Infrastructure/RegexGlobal.cs @@ -22,7 +22,11 @@ static RegexGlobal() /// An value. public static int RegexCacheSize { get; set; } - /// Default value for the attribute and the constructors. +#pragma warning disable IDE0079 // Remove unnecessary suppression +#pragma warning disable CS1574 // File name must match first type name + /// Default value for the and the constructors. +#pragma warning restore CS1574 // File name must match first type name +#pragma warning restore IDE0079 // Remove unnecessary suppression public const int DefaultMatchTimeoutMilliseconds = 100; /// Default match timeout for the constructors. diff --git a/src/Ocelot/Ocelot.csproj b/src/Ocelot/Ocelot.csproj index 61857af82..a22a44ffe 100644 --- a/src/Ocelot/Ocelot.csproj +++ b/src/Ocelot/Ocelot.csproj @@ -29,8 +29,8 @@ - - + + NU1701 @@ -43,8 +43,8 @@ - - + + @@ -53,8 +53,8 @@ - - + + diff --git a/src/Ocelot/Responses/ErrorResponse.cs b/src/Ocelot/Responses/ErrorResponse.cs index 254122133..497b2a1c9 100644 --- a/src/Ocelot/Responses/ErrorResponse.cs +++ b/src/Ocelot/Responses/ErrorResponse.cs @@ -3,14 +3,23 @@ namespace Ocelot.Responses; public class ErrorResponse : Response +{ + public ErrorResponse(Error error) + : base(new() { error }) + { } + + public ErrorResponse(List errors) + : base(errors) + { } +} + +public class ErrorResponse : Response { public ErrorResponse(Error error) : base(new List { error }) - { - } + { } public ErrorResponse(List errors) : base(errors) - { - } + { } } diff --git a/src/Ocelot/Responses/ErrorResponseGeneric.cs b/src/Ocelot/Responses/ErrorResponseGeneric.cs deleted file mode 100644 index 8174f3cbb..000000000 --- a/src/Ocelot/Responses/ErrorResponseGeneric.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Ocelot.Errors; - -namespace Ocelot.Responses; - -#pragma warning disable SA1649 // File name must match first type name - -public class ErrorResponse : Response -#pragma warning restore SA1649 // File name must match first type name -{ - public ErrorResponse(Error error) - : base(new List { error }) - { - } - - public ErrorResponse(List errors) - : base(errors) - { - } -} diff --git a/src/Ocelot/Responses/OkResponse.cs b/src/Ocelot/Responses/OkResponse.cs index 31e3ac63e..73c1fb00f 100644 --- a/src/Ocelot/Responses/OkResponse.cs +++ b/src/Ocelot/Responses/OkResponse.cs @@ -2,7 +2,10 @@ namespace Ocelot.Responses; public class OkResponse : Response { - public OkResponse() - { - } + public OkResponse() { } +} + +public class OkResponse : Response +{ + public OkResponse(T data) : base(data) { } } diff --git a/src/Ocelot/Responses/OkResponseGeneric.cs b/src/Ocelot/Responses/OkResponseGeneric.cs deleted file mode 100644 index e9f2f66f3..000000000 --- a/src/Ocelot/Responses/OkResponseGeneric.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Ocelot.Responses; - -#pragma warning disable SA1649 // File name must match first type name - -public class OkResponse : Response -#pragma warning restore SA1649 // File name must match first type name -{ - public OkResponse(T data) : base(data) - { - } -} diff --git a/src/Ocelot/Responses/Response.cs b/src/Ocelot/Responses/Response.cs index 6d9797570..2d6c86f8e 100644 --- a/src/Ocelot/Responses/Response.cs +++ b/src/Ocelot/Responses/Response.cs @@ -18,3 +18,16 @@ protected Response(List errors) public bool IsError => Errors.Count > 0; } + +public abstract class Response : Response +{ + protected Response(T data) + { + Data = data; + } + + protected Response(List errors) : base(errors) + { } + + public T Data { get; } +} diff --git a/src/Ocelot/Responses/ResponseGeneric.cs b/src/Ocelot/Responses/ResponseGeneric.cs deleted file mode 100644 index b7fb3402b..000000000 --- a/src/Ocelot/Responses/ResponseGeneric.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Ocelot.Errors; - -namespace Ocelot.Responses; - -#pragma warning disable SA1649 // File name must match first type name - -public abstract class Response : Response -#pragma warning restore SA1649 // File name must match first type name -{ - protected Response(T data) - { - Data = data; - } - - protected Response(List errors) : base(errors) - { - } - - public T Data { get; } -} diff --git a/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj b/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj index 4a2955773..70a29bfed 100644 --- a/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj +++ b/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj @@ -1,7 +1,7 @@  0.0.0-dev - net6.0;net7.0;net8.0 + net6.0;net8.0 disable disable false @@ -63,7 +63,7 @@ - + @@ -74,42 +74,29 @@ - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + diff --git a/test/Ocelot.AcceptanceTests/Routing/RoutingTests.cs b/test/Ocelot.AcceptanceTests/Routing/RoutingTests.cs index b8669f8e6..bd83462dd 100644 --- a/test/Ocelot.AcceptanceTests/Routing/RoutingTests.cs +++ b/test/Ocelot.AcceptanceTests/Routing/RoutingTests.cs @@ -476,18 +476,18 @@ public void ShouldMatchComplexQueriesCaseInsensitive(string downstream, string u [Theory] [Trait("Bug", "2209")] [InlineData("/api/invoices/{url0}-{url1}-{url2}", "/api/invoices_{url0}/{url1}-{url2}_abcd/{url3}?urlId={url4}", - "/api/InvoIces_abc/def-ghi_abcd/xyz?urlId=bla", "/api/invoices/abc-def-ghi", "?urlId=bla")] + "/api/InvoIces_abc/def-ghi_abcd/xyz?urlId=bla", "/api/invoices/abc-def-ghi")] [InlineData("/api/products/{category}-{subcategory}/{filter}", "/api/products_{category}/{subcategory}_details/{itemId}?filter={filter}", - "/API/PRODUCTS_electronics/computers_details/123?filter=active", "/api/products/electronics-computers/active", "")] + "/API/PRODUCTS_electronics/computers_details/123?filter=active", "/api/products/electronics-computers/active")] [InlineData("/api/users/{userId}/posts/{postId}/{lang}", "/api/users/{userId}/{postId}_content/{timestamp}?lang={lang}", - "/api/UsErS/101/2022_content/2024?lang=en", "/api/users/101/posts/2022/en", "")] + "/api/UsErS/101/2022_content/2024?lang=en", "/api/users/101/posts/2022/en")] [InlineData("/api/categories/{cat}-{subcat}?sort={sort}", "/api/categories_{cat}/{subcat}_items/{itemId}?sort={sort}", - "/api/CATEGORIES_home/furniture_items/789?sort=asc", "/api/categories/home-furniture", "?sort=asc")] + "/api/CATEGORIES_home/furniture_items/789?sort=asc", "/api/categories/home-furniture")] [InlineData("/api/orders/{order}-{detail}?status={status}", "/api/orders_{order}/{detail}_invoice/{ref}?status={status}", - "/API/ORDERS_987/abc_invOiCE/123?status=shipped", "/api/orders/987-abc", "?status=shipped")] + "/API/ORDERS_987/abc_invOiCE/123?status=shipped", "/api/orders/987-abc")] [InlineData("/api/transactions/{type}-{region}", "/api/transactions_{type}/{region}_summary/{year}?q={query}", - "/api/TRanSacTIONS_sales/NA_summary/2024?q=forecast", "/api/transactions/sales-NA", "?q=forecast")] - public void ShouldNotMatchComplexQueriesCaseSensitive(string downstream, string upstream, string requestUrl, string downstreamPath, string queryString) + "/api/TRanSacTIONS_sales/NA_summary/2024?q=forecast", "/api/transactions/sales-NA")] + public void ShouldNotMatchComplexQueriesCaseSensitive(string downstream, string upstream, string requestUrl, string downstreamPath) { var port = PortFinder.GetRandomPort(); var route = GivenRoute(port, upstream, downstream); diff --git a/test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj b/test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj index e2ed9a99f..a9eee073f 100644 --- a/test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj +++ b/test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj @@ -1,7 +1,7 @@  0.0.0-dev - net6.0;net7.0;net8.0 + net6.0;net8.0 disable disable false @@ -31,13 +31,9 @@ - - - - - + diff --git a/test/Ocelot.IntegrationTests/Ocelot.IntegrationTests.csproj b/test/Ocelot.IntegrationTests/Ocelot.IntegrationTests.csproj index e09b6ac15..d4b9e96f8 100644 --- a/test/Ocelot.IntegrationTests/Ocelot.IntegrationTests.csproj +++ b/test/Ocelot.IntegrationTests/Ocelot.IntegrationTests.csproj @@ -1,7 +1,7 @@  0.0.0-dev - net6.0;net7.0;net8.0 + net6.0;net8.0 disable disable false @@ -56,39 +56,27 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + + + + diff --git a/test/Ocelot.ManualTest/Ocelot.ManualTest.csproj b/test/Ocelot.ManualTest/Ocelot.ManualTest.csproj index a6bbc0a08..bd45991e1 100644 --- a/test/Ocelot.ManualTest/Ocelot.ManualTest.csproj +++ b/test/Ocelot.ManualTest/Ocelot.ManualTest.csproj @@ -1,7 +1,7 @@  0.0.0-dev - net6.0;net7.0;net8.0 + net6.0;net8.0 disable disable true @@ -39,36 +39,25 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + diff --git a/test/Ocelot.Testing/Ocelot.Testing.csproj b/test/Ocelot.Testing/Ocelot.Testing.csproj index b7a4f4253..378b9e8b1 100644 --- a/test/Ocelot.Testing/Ocelot.Testing.csproj +++ b/test/Ocelot.Testing/Ocelot.Testing.csproj @@ -2,7 +2,7 @@ 0.0.0-dev - net6.0;net7.0;net8.0 + net6.0;net8.0 enable enable diff --git a/test/Ocelot.UnitTests/Ocelot.UnitTests.csproj b/test/Ocelot.UnitTests/Ocelot.UnitTests.csproj index 909c6081b..137f5b474 100644 --- a/test/Ocelot.UnitTests/Ocelot.UnitTests.csproj +++ b/test/Ocelot.UnitTests/Ocelot.UnitTests.csproj @@ -1,7 +1,7 @@  0.0.0-dev - net6.0;net7.0;net8.0 + net6.0;net8.0 disable disable false @@ -49,7 +49,7 @@ - + @@ -71,48 +71,36 @@ - + - - + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + + + +