From 9659015d025fb0d4276106e8bcc8333942c094fd Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 6 Jan 2024 17:19:31 -0600 Subject: resolve more warnings --- src/slskd/Core/Options.cs | 2 ++ src/slskd/Relay/RelayClient.cs | 4 ++++ src/slskd/Relay/RelayService.cs | 2 +- src/slskd/Shares/Types/Share.cs | 2 ++ src/slskd/Users/UserService.cs | 2 +- src/slskd/slskd.csproj | 4 ++-- 6 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index a3437bf4..e34a86b0 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -682,7 +682,9 @@ namespace slskd return (share, matches[0].Groups[2].Value, matches[0].Groups[3].Value); } +#pragma warning disable S3878 // Arrays should not be created for params parameters return (share, share.Split(new[] { '/', '\\' }).Last(), share); +#pragma warning restore S3878 // Arrays should not be created for params parameters } var digestedShared = directories diff --git a/src/slskd/Relay/RelayClient.cs b/src/slskd/Relay/RelayClient.cs index f3880c97..b54a04f3 100644 --- a/src/slskd/Relay/RelayClient.cs +++ b/src/slskd/Relay/RelayClient.cs @@ -259,7 +259,9 @@ namespace slskd.Relay { if (message is HttpClientHandler clientHandler && options.Relay.Controller.IgnoreCertificateErrors) { +#pragma warning disable S4830 // Enable server certificate validation on this SSL/TLS connection clientHandler.ServerCertificateCustomValidationCallback += (_, _, _, _) => true; +#pragma warning restore S4830 // Enable server certificate validation on this SSL/TLS connection } return message; @@ -304,7 +306,9 @@ namespace slskd.Relay client = new HttpClient(new HttpClientHandler() { ClientCertificateOptions = ClientCertificateOption.Manual, +#pragma warning disable S4830 // Enable server certificate validation on this SSL/TLS connection ServerCertificateCustomValidationCallback = (_, _, _, _) => true, +#pragma warning restore S4830 // Enable server certificate validation on this SSL/TLS connection }); } else diff --git a/src/slskd/Relay/RelayService.cs b/src/slskd/Relay/RelayService.cs index 6cbbb0a2..d3f35693 100644 --- a/src/slskd/Relay/RelayService.cs +++ b/src/slskd/Relay/RelayService.cs @@ -624,7 +624,7 @@ namespace slskd.Relay // ensure filename is relative to the local download directory and make sure it doesn't start with a slash filename = filename .ReplaceFirst(OptionsMonitor.CurrentValue.Directories.Downloads, string.Empty) - .TrimStart(new[] { '/', '\\' }); + .TrimStart('/', '\\'); async Task Notify((string ConnectionId, Agent Agent) record) { diff --git a/src/slskd/Shares/Types/Share.cs b/src/slskd/Shares/Types/Share.cs index d60998f6..2911cf83 100644 --- a/src/slskd/Shares/Types/Share.cs +++ b/src/slskd/Shares/Types/Share.cs @@ -76,7 +76,9 @@ namespace slskd.Shares } else { +#pragma warning disable S3878 // Arrays should not be created for params parameters Alias = share.Split(new[] { '/', '\\' }).Last(); +#pragma warning restore S3878 // Arrays should not be created for params parameters LocalPath = share; } diff --git a/src/slskd/Users/UserService.cs b/src/slskd/Users/UserService.cs index 434d357c..5b15b671 100644 --- a/src/slskd/Users/UserService.cs +++ b/src/slskd/Users/UserService.cs @@ -49,7 +49,7 @@ namespace slskd.Users /// The data in the can continue to grow until -- unlikely -- it contains a record for every /// user on or that was on the network at any point since the last client connect. This is a calculated risk, roughly /// knowing the size of the network, the size of the data being stored, and balanced against the consequences of not having - /// a user's data when it is needed (for queue positioning, speed limits, etc) + /// a user's data when it is needed (for queue positioning, speed limits, etc). /// /// /// The method acts on cached data _only_. This method should be called within hot paths, diff --git a/src/slskd/slskd.csproj b/src/slskd/slskd.csproj index 82108d47..9ca072a0 100644 --- a/src/slskd/slskd.csproj +++ b/src/slskd/slskd.csproj @@ -17,11 +17,11 @@ - 1701;1702;1591 + 1701;1702;1591;S1133;S2094;S1135 - 1591 + 1591;S1133;S2094;S1135 -- cgit v1.2.3