diff --git a/.editorconfig b/.editorconfig index 7ae9f7a07..9bec013f1 100644 --- a/.editorconfig +++ b/.editorconfig @@ -190,8 +190,6 @@ dotnet_diagnostic.CA1821.severity = suggestion dotnet_diagnostic.CA1822.severity = suggestion dotnet_diagnostic.CA1823.severity = suggestion dotnet_diagnostic.CA1824.severity = suggestion -dotnet_diagnostic.CA1825.severity = suggestion -dotnet_diagnostic.CA1826.severity = suggestion dotnet_diagnostic.CA2000.severity = suggestion dotnet_diagnostic.CA2002.severity = suggestion dotnet_diagnostic.CA2007.severity = suggestion diff --git a/src/NzbDrone.Api/FileSystem/FileSystemModule.cs b/src/NzbDrone.Api/FileSystem/FileSystemModule.cs index 5b2e854d5..28c3e7e29 100644 --- a/src/NzbDrone.Api/FileSystem/FileSystemModule.cs +++ b/src/NzbDrone.Api/FileSystem/FileSystemModule.cs @@ -1,3 +1,4 @@ +using System; using System.IO; using System.Linq; using Nancy; @@ -57,7 +58,7 @@ namespace NzbDrone.Api.FileSystem if (!_diskProvider.FolderExists(path)) { - return new string[0]; + return Array.Empty(); } return _diskScanService.GetVideoFiles(path).Select(f => new diff --git a/src/NzbDrone.Common.Test/EnvironmentTests/StartupArgumentsFixture.cs b/src/NzbDrone.Common.Test/EnvironmentTests/StartupArgumentsFixture.cs index 07df9c79e..f53dfee9a 100644 --- a/src/NzbDrone.Common.Test/EnvironmentTests/StartupArgumentsFixture.cs +++ b/src/NzbDrone.Common.Test/EnvironmentTests/StartupArgumentsFixture.cs @@ -1,3 +1,4 @@ +using System; using FluentAssertions; using NUnit.Framework; using NzbDrone.Common.EnvironmentInfo; @@ -11,7 +12,7 @@ namespace NzbDrone.Common.Test.EnvironmentTests [Test] public void empty_array_should_return_empty_flags() { - var args = new StartupContext(new string[0]); + var args = new StartupContext(Array.Empty()); args.Flags.Should().BeEmpty(); } diff --git a/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs b/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs index dc3457521..fc73ef90a 100644 --- a/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs +++ b/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs @@ -100,7 +100,7 @@ namespace NzbDrone.Common.Test.Http Mocker.SetConstant(Mocker.Resolve()); Mocker.SetConstant(Mocker.Resolve()); Mocker.SetConstant(Mocker.Resolve()); - Mocker.SetConstant>(new IHttpRequestInterceptor[0]); + Mocker.SetConstant>(Array.Empty()); Mocker.SetConstant(Mocker.Resolve()); // Used for manual testing of socks proxies. @@ -352,7 +352,7 @@ namespace NzbDrone.Common.Test.Http var oldRequest = new HttpRequest($"https://{_httpBinHost2}/get"); oldRequest.Cookies["my"] = "cookie"; - var oldClient = new HttpClient(new IHttpRequestInterceptor[0], Mocker.Resolve(), Mocker.Resolve(), Mocker.Resolve(), Mocker.Resolve()); + var oldClient = new HttpClient(Array.Empty(), Mocker.Resolve(), Mocker.Resolve(), Mocker.Resolve(), Mocker.Resolve()); oldClient.Should().NotBeSameAs(Subject); diff --git a/src/NzbDrone.Common/Http/HttpResponse.cs b/src/NzbDrone.Common/Http/HttpResponse.cs index eab34c6a0..a5e68de4a 100644 --- a/src/NzbDrone.Common/Http/HttpResponse.cs +++ b/src/NzbDrone.Common/Http/HttpResponse.cs @@ -56,7 +56,7 @@ namespace NzbDrone.Common.Http public string[] GetCookieHeaders() { - return Headers.GetValues("Set-Cookie") ?? new string[0]; + return Headers.GetValues("Set-Cookie") ?? Array.Empty(); } public Dictionary GetCookies() diff --git a/src/NzbDrone.Common/Http/Proxy/HttpProxySettings.cs b/src/NzbDrone.Common/Http/Proxy/HttpProxySettings.cs index 58a7541da..ef59c9c0f 100644 --- a/src/NzbDrone.Common/Http/Proxy/HttpProxySettings.cs +++ b/src/NzbDrone.Common/Http/Proxy/HttpProxySettings.cs @@ -1,4 +1,5 @@ -using NzbDrone.Common.Extensions; +using System; +using NzbDrone.Common.Extensions; namespace NzbDrone.Common.Http.Proxy { @@ -41,7 +42,7 @@ namespace NzbDrone.Common.Http.Proxy return hostlist; } - return new string[] { }; + return Array.Empty(); } } diff --git a/src/NzbDrone.Common/TinyIoC.cs b/src/NzbDrone.Common/TinyIoC.cs index ec4bfd198..b61d91cde 100644 --- a/src/NzbDrone.Common/TinyIoC.cs +++ b/src/NzbDrone.Common/TinyIoC.cs @@ -298,11 +298,11 @@ namespace TinyIoC } catch (System.IO.FileNotFoundException) { - assemblies = new Type[] { }; + assemblies = Array.Empty(); } catch (NotSupportedException) { - assemblies = new Type[] { }; + assemblies = Array.Empty(); } #if !NETFX_CORE catch (ReflectionTypeLoadException e) @@ -3355,7 +3355,7 @@ namespace TinyIoC //#if NETFX_CORE // MethodInfo resolveMethod = typeof(TinyIoCContainer).GetTypeInfo().GetDeclaredMethods("Resolve").First(mi => !mi.GetParameters().Any()); //#else - MethodInfo resolveMethod = typeof(TinyIoCContainer).GetMethod("Resolve", new Type[] { }); + MethodInfo resolveMethod = typeof(TinyIoCContainer).GetMethod("Resolve", Array.Empty()); //#endif resolveMethod = resolveMethod.MakeGenericMethod(returnType); @@ -3648,7 +3648,7 @@ namespace TinyIoC private IEnumerable GetParentRegistrationsForType(Type resolveType) { if (_Parent == null) - return new TypeRegistration[] { }; + return Array.Empty(); var registrations = _Parent._RegisteredTypes.Keys.Where(tr => tr.Type == resolveType); diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DelugeTests/DelugeFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DelugeTests/DelugeFixture.cs index e4d86a18b..b971db30e 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DelugeTests/DelugeFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DelugeTests/DelugeFixture.cs @@ -89,7 +89,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DelugeTests Mocker.GetMock() .Setup(s => s.Get(It.IsAny())) - .Returns(r => new HttpResponse(r, new HttpHeader(), new byte[0])); + .Returns(r => new HttpResponse(r, new HttpHeader(), Array.Empty())); } protected void GivenFailedDownload() diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadClientFixtureBase.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadClientFixtureBase.cs index 2a1e1fd5b..ffd188208 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadClientFixtureBase.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadClientFixtureBase.cs @@ -34,7 +34,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests Mocker.GetMock() .Setup(s => s.Get(It.IsAny())) - .Returns(r => new HttpResponse(r, new HttpHeader(), new byte[0])); + .Returns(r => new HttpResponse(r, new HttpHeader(), Array.Empty())); Mocker.GetMock() .Setup(v => v.RemapRemoteToLocal(It.IsAny(), It.IsAny())) diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/TorrentDownloadStationFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/TorrentDownloadStationFixture.cs index 3d071c8bc..3aaafd8f2 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/TorrentDownloadStationFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/TorrentDownloadStationFixture.cs @@ -278,7 +278,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests Mocker.GetMock() .Setup(s => s.Get(It.IsAny())) - .Returns(r => new HttpResponse(r, new HttpHeader(), new byte[0])); + .Returns(r => new HttpResponse(r, new HttpHeader(), Array.Empty())); _downloadStationConfigItems = new Dictionary { diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs index 1bea62b49..6cd5e512c 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs @@ -170,7 +170,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests Mocker.GetMock() .Setup(s => s.Get(It.IsAny())) - .Returns(r => new HttpResponse(r, new HttpHeader(), new byte[0])); + .Returns(r => new HttpResponse(r, new HttpHeader(), Array.Empty())); _downloadStationConfigItems = new Dictionary { diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/HadoukenTests/HadoukenFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/HadoukenTests/HadoukenFixture.cs index daaf8aed8..aecc604e3 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/HadoukenTests/HadoukenFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/HadoukenTests/HadoukenFixture.cs @@ -86,7 +86,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.HadoukenTests Mocker.GetMock() .Setup(s => s.Get(It.IsAny())) - .Returns(r => new HttpResponse(r, new HttpHeader(), new byte[0])); + .Returns(r => new HttpResponse(r, new HttpHeader(), Array.Empty())); } protected void GivenFailedDownload() diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs index 31f9859ba..aa835d775 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs @@ -35,7 +35,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests Mocker.GetMock() .Setup(s => s.Get(It.IsAny())) - .Returns(r => new HttpResponse(r, new HttpHeader(), new byte[0])); + .Returns(r => new HttpResponse(r, new HttpHeader(), Array.Empty())); Mocker.GetMock() .Setup(s => s.GetConfig(It.IsAny())) @@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests Mocker.GetMock() .Setup(s => s.Get(It.IsAny())) - .Returns(r => new HttpResponse(r, httpHeader, new byte[0], System.Net.HttpStatusCode.SeeOther)); + .Returns(r => new HttpResponse(r, httpHeader, Array.Empty(), System.Net.HttpStatusCode.SeeOther)); } protected void GivenRedirectToTorrent() @@ -63,7 +63,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests Mocker.GetMock() .Setup(s => s.Get(It.Is(h => h.Url.FullUri == _downloadUrl))) - .Returns(r => new HttpResponse(r, httpHeader, new byte[0], System.Net.HttpStatusCode.Found)); + .Returns(r => new HttpResponse(r, httpHeader, Array.Empty(), System.Net.HttpStatusCode.Found)); } protected void GivenFailedDownload() @@ -355,7 +355,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests Mocker.GetMock() .Setup(v => v.MoveTorrentToTopInQueue(It.IsAny(), It.IsAny())) - .Throws(new HttpException(new HttpResponse(new HttpRequest("http://me.local/"), new HttpHeader(), new byte[0], System.Net.HttpStatusCode.Forbidden))); + .Throws(new HttpException(new HttpResponse(new HttpRequest("http://me.local/"), new HttpHeader(), Array.Empty(), System.Net.HttpStatusCode.Forbidden))); var remoteMovie = CreateRemoteMovie(); diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/SabnzbdTests/SabnzbdFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/SabnzbdTests/SabnzbdFixture.cs index 120c2a217..a9af73675 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/SabnzbdTests/SabnzbdFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/SabnzbdTests/SabnzbdFixture.cs @@ -537,7 +537,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests public void should_test_failed_if_tv_sorting_empty() { _config.Misc.enable_tv_sorting = true; - _config.Misc.tv_categories = new string[0]; + _config.Misc.tv_categories = Array.Empty(); var result = new NzbDroneValidationResult(Subject.Test()); diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/TransmissionTests/TransmissionFixtureBase.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/TransmissionTests/TransmissionFixtureBase.cs index e2c55423b..d6e2db822 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/TransmissionTests/TransmissionFixtureBase.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/TransmissionTests/TransmissionFixtureBase.cs @@ -99,7 +99,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests Mocker.GetMock() .Setup(s => s.Get(It.IsAny())) - .Returns(r => new HttpResponse(r, new HttpHeader(), new byte[0])); + .Returns(r => new HttpResponse(r, new HttpHeader(), Array.Empty())); _transmissionConfigItems = new Dictionary(); diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/UTorrentTests/UTorrentFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/UTorrentTests/UTorrentFixture.cs index d9b1ebfb3..762dddeaf 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/UTorrentTests/UTorrentFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/UTorrentTests/UTorrentFixture.cs @@ -91,7 +91,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.UTorrentTests Mocker.GetMock() .Setup(s => s.Get(It.IsAny())) - .Returns(r => new HttpResponse(r, new HttpHeader(), new byte[0])); + .Returns(r => new HttpResponse(r, new HttpHeader(), Array.Empty())); } protected void GivenRedirectToMagnet() @@ -101,7 +101,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.UTorrentTests Mocker.GetMock() .Setup(s => s.Get(It.IsAny())) - .Returns(r => new HttpResponse(r, httpHeader, new byte[0], System.Net.HttpStatusCode.SeeOther)); + .Returns(r => new HttpResponse(r, httpHeader, Array.Empty(), System.Net.HttpStatusCode.SeeOther)); } protected void GivenRedirectToTorrent() @@ -111,7 +111,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.UTorrentTests Mocker.GetMock() .Setup(s => s.Get(It.Is(h => h.Url.ToString() == _downloadUrl))) - .Returns(r => new HttpResponse(r, httpHeader, new byte[0], System.Net.HttpStatusCode.Found)); + .Returns(r => new HttpResponse(r, httpHeader, Array.Empty(), System.Net.HttpStatusCode.Found)); } protected void GivenFailedDownload() diff --git a/src/NzbDrone.Core.Test/Download/DownloadServiceFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadServiceFixture.cs index adab7b46a..6831f5701 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadServiceFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadServiceFixture.cs @@ -123,7 +123,7 @@ namespace NzbDrone.Core.Test.Download public void Download_report_should_trigger_indexer_backoff_on_http429_with_long_time() { var request = new HttpRequest("http://my.indexer.com"); - var response = new HttpResponse(request, new HttpHeader(), new byte[0], (HttpStatusCode)429); + var response = new HttpResponse(request, new HttpHeader(), Array.Empty(), (HttpStatusCode)429); response.Headers["Retry-After"] = "300"; var mock = WithUsenetClient(); @@ -143,7 +143,7 @@ namespace NzbDrone.Core.Test.Download public void Download_report_should_trigger_indexer_backoff_on_http429_based_on_date() { var request = new HttpRequest("http://my.indexer.com"); - var response = new HttpResponse(request, new HttpHeader(), new byte[0], (HttpStatusCode)429); + var response = new HttpResponse(request, new HttpHeader(), Array.Empty(), (HttpStatusCode)429); response.Headers["Retry-After"] = DateTime.UtcNow.AddSeconds(300).ToString("r"); var mock = WithUsenetClient(); diff --git a/src/NzbDrone.Core.Test/Framework/CoreTest.cs b/src/NzbDrone.Core.Test/Framework/CoreTest.cs index 48dc033d8..4c9682957 100644 --- a/src/NzbDrone.Core.Test/Framework/CoreTest.cs +++ b/src/NzbDrone.Core.Test/Framework/CoreTest.cs @@ -26,7 +26,7 @@ namespace NzbDrone.Core.Test.Framework Mocker.SetConstant(new HttpProxySettingsProvider(Mocker.Resolve())); Mocker.SetConstant(new ManagedWebProxyFactory(Mocker.Resolve())); Mocker.SetConstant(new ManagedHttpDispatcher(Mocker.Resolve(), Mocker.Resolve(), Mocker.Resolve(), Mocker.Resolve(), TestLogger)); - Mocker.SetConstant(new HttpClient(new IHttpRequestInterceptor[0], Mocker.Resolve(), Mocker.Resolve(), Mocker.Resolve(), TestLogger)); + Mocker.SetConstant(new HttpClient(Array.Empty(), Mocker.Resolve(), Mocker.Resolve(), Mocker.Resolve(), TestLogger)); Mocker.SetConstant(new RadarrCloudRequestBuilder()); } diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientCheckFixture.cs index c50f9416b..96da3ecac 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientCheckFixture.cs @@ -25,7 +25,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks { Mocker.GetMock() .Setup(s => s.GetDownloadClients()) - .Returns(new IDownloadClient[0]); + .Returns(Array.Empty()); Subject.Check().ShouldBeWarning(); } diff --git a/src/NzbDrone.Core.Test/MediaFiles/DownloadedMoviesImportServiceFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/DownloadedMoviesImportServiceFixture.cs index 2beca9d02..92bb398da 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/DownloadedMoviesImportServiceFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/DownloadedMoviesImportServiceFixture.cs @@ -93,7 +93,7 @@ namespace NzbDrone.Core.Test.MediaFiles private void WasImportedResponse() { Mocker.GetMock().Setup(c => c.GetVideoFiles(It.IsAny(), It.IsAny())) - .Returns(new string[0]); + .Returns(System.Array.Empty()); } [Test] @@ -142,7 +142,7 @@ namespace NzbDrone.Core.Test.MediaFiles Mocker.GetMock() .Setup(c => c.GetVideoFiles(It.IsAny(), It.IsAny())) - .Returns(new string[0]); + .Returns(System.Array.Empty()); Subject.ProcessRootFolder(new DirectoryInfo(_droneFactory)); diff --git a/src/NzbDrone.Core.Test/NotificationTests/EmailTests/EmailSettingsValidatorFixture.cs b/src/NzbDrone.Core.Test/NotificationTests/EmailTests/EmailSettingsValidatorFixture.cs index db729edb2..52aa77c01 100644 --- a/src/NzbDrone.Core.Test/NotificationTests/EmailTests/EmailSettingsValidatorFixture.cs +++ b/src/NzbDrone.Core.Test/NotificationTests/EmailTests/EmailSettingsValidatorFixture.cs @@ -1,3 +1,4 @@ +using System; using FizzWare.NBuilder; using FluentAssertions; using NUnit.Framework; @@ -103,9 +104,9 @@ namespace NzbDrone.Core.Test.NotificationTests.EmailTests [Test] public void should_not_be_valid_if_to_bcc_cc_are_all_empty() { - _emailSettings.To = new string[] { }; - _emailSettings.CC = new string[] { }; - _emailSettings.Bcc = new string[] { }; + _emailSettings.To = Array.Empty(); + _emailSettings.CC = Array.Empty(); + _emailSettings.Bcc = Array.Empty(); _validator.Validate(_emailSettings).IsValid.Should().BeFalse(); } diff --git a/src/NzbDrone.Core/Datastore/Migration/174_email_multiple_addresses.cs b/src/NzbDrone.Core/Datastore/Migration/174_email_multiple_addresses.cs index d01375b26..1593dbbd6 100644 --- a/src/NzbDrone.Core/Datastore/Migration/174_email_multiple_addresses.cs +++ b/src/NzbDrone.Core/Datastore/Migration/174_email_multiple_addresses.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Data; using System.Text.Json; @@ -49,8 +50,8 @@ namespace NzbDrone.Core.Datastore.Migration Password = settings.Password, From = settings.From, To = new string[] { settings.To }, - CC = new string[] { }, - Bcc = new string[] { } + CC = Array.Empty(), + Bcc = Array.Empty() }; corrected.Add(new ProviderDefinition166 diff --git a/src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs b/src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs index f8a331de9..c1ff35a82 100644 --- a/src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs +++ b/src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs @@ -349,7 +349,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge { if (result.Torrents == null) { - return new DelugeTorrent[0]; + return Array.Empty(); } return result.Torrents.Values.ToArray(); diff --git a/src/NzbDrone.Core/Download/Clients/Hadouken/HadoukenProxy.cs b/src/NzbDrone.Core/Download/Clients/Hadouken/HadoukenProxy.cs index 4ab8f67c1..ac44956cc 100644 --- a/src/NzbDrone.Core/Download/Clients/Hadouken/HadoukenProxy.cs +++ b/src/NzbDrone.Core/Download/Clients/Hadouken/HadoukenProxy.cs @@ -106,7 +106,7 @@ namespace NzbDrone.Core.Download.Clients.Hadouken { if (torrentsRaw == null) { - return new HadoukenTorrent[0]; + return Array.Empty(); } var torrents = new List(); diff --git a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs index 7cb021983..d10dd0256 100644 --- a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs +++ b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs @@ -17,7 +17,7 @@ namespace NzbDrone.Core.Download.TrackedDownloads public TrackedDownload() { - StatusMessages = new TrackedDownloadStatusMessage[] { }; + StatusMessages = System.Array.Empty(); } public void Warn(string message, params object[] args) diff --git a/src/NzbDrone.Core/ImportLists/Radarr/RadarrSettings.cs b/src/NzbDrone.Core/ImportLists/Radarr/RadarrSettings.cs index ee2778d20..6eed5c302 100644 --- a/src/NzbDrone.Core/ImportLists/Radarr/RadarrSettings.cs +++ b/src/NzbDrone.Core/ImportLists/Radarr/RadarrSettings.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using FluentValidation; using NzbDrone.Core.Annotations; @@ -23,8 +24,8 @@ namespace NzbDrone.Core.ImportLists.Radarr { BaseUrl = ""; ApiKey = ""; - ProfileIds = new int[] { }; - TagIds = new int[] { }; + ProfileIds = Array.Empty(); + TagIds = Array.Empty(); } [FieldDefinition(0, Label = "Full URL", HelpText = "URL, including port, of the Radarr V3 instance to import from")] diff --git a/src/NzbDrone.Core/Indexers/HDBits/HDBitsSettings.cs b/src/NzbDrone.Core/Indexers/HDBits/HDBitsSettings.cs index ca60aaaba..b7972e942 100644 --- a/src/NzbDrone.Core/Indexers/HDBits/HDBitsSettings.cs +++ b/src/NzbDrone.Core/Indexers/HDBits/HDBitsSettings.cs @@ -28,8 +28,8 @@ namespace NzbDrone.Core.Indexers.HDBits MinimumSeeders = IndexerDefaults.MINIMUM_SEEDERS; Categories = new int[] { (int)HdBitsCategory.Movie }; - Codecs = new int[0]; - Mediums = new int[0]; + Codecs = System.Array.Empty(); + Mediums = System.Array.Empty(); MultiLanguages = new List(); RequiredFlags = new List(); } diff --git a/src/NzbDrone.Core/Notifications/Email/EmailSettings.cs b/src/NzbDrone.Core/Notifications/Email/EmailSettings.cs index 750c9fca2..acb14287c 100644 --- a/src/NzbDrone.Core/Notifications/Email/EmailSettings.cs +++ b/src/NzbDrone.Core/Notifications/Email/EmailSettings.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Linq; using FluentValidation; @@ -35,9 +36,9 @@ namespace NzbDrone.Core.Notifications.Email Port = 587; Ssl = true; - To = new string[] { }; - CC = new string[] { }; - Bcc = new string[] { }; + To = Array.Empty(); + CC = Array.Empty(); + Bcc = Array.Empty(); } [FieldDefinition(0, Label = "Server", HelpText = "Hostname or IP of Email server")] diff --git a/src/NzbDrone.Core/Notifications/PushBullet/PushBulletSettings.cs b/src/NzbDrone.Core/Notifications/PushBullet/PushBulletSettings.cs index d9611467d..fb4acad1b 100644 --- a/src/NzbDrone.Core/Notifications/PushBullet/PushBulletSettings.cs +++ b/src/NzbDrone.Core/Notifications/PushBullet/PushBulletSettings.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using FluentValidation; using NzbDrone.Core.Annotations; @@ -20,8 +21,8 @@ namespace NzbDrone.Core.Notifications.PushBullet public PushBulletSettings() { - DeviceIds = new string[] { }; - ChannelTags = new string[] { }; + DeviceIds = Array.Empty(); + ChannelTags = Array.Empty(); } [FieldDefinition(0, Label = "Access Token", HelpLink = "https://www.pushbullet.com/#settings/account")] diff --git a/src/NzbDrone.Core/Notifications/Pushover/PushoverSettings.cs b/src/NzbDrone.Core/Notifications/Pushover/PushoverSettings.cs index 646538e38..4bf2098c0 100644 --- a/src/NzbDrone.Core/Notifications/Pushover/PushoverSettings.cs +++ b/src/NzbDrone.Core/Notifications/Pushover/PushoverSettings.cs @@ -23,7 +23,7 @@ namespace NzbDrone.Core.Notifications.Pushover public PushoverSettings() { Priority = 0; - Devices = new string[] { }; + Devices = System.Array.Empty(); } //TODO: Get Pushover to change our app name (or create a new app) when we have a new logo diff --git a/src/NzbDrone.Core/Notifications/SendGrid/SendGridSettings.cs b/src/NzbDrone.Core/Notifications/SendGrid/SendGridSettings.cs index 41e1ca525..b1d8631a2 100644 --- a/src/NzbDrone.Core/Notifications/SendGrid/SendGridSettings.cs +++ b/src/NzbDrone.Core/Notifications/SendGrid/SendGridSettings.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using FluentValidation; using NzbDrone.Core.Annotations; @@ -24,7 +25,7 @@ namespace NzbDrone.Core.Notifications.SendGrid public SendGridSettings() { BaseUrl = "https://api.sendgrid.com/v3/"; - Recipients = new string[] { }; + Recipients = Array.Empty(); } public string BaseUrl { get; set; } diff --git a/src/NzbDrone.Mono.Test/EnvironmentInfo/VersionAdapters/ReleaseFileVersionAdapterFixture.cs b/src/NzbDrone.Mono.Test/EnvironmentInfo/VersionAdapters/ReleaseFileVersionAdapterFixture.cs index 73726a18e..3a93a719b 100644 --- a/src/NzbDrone.Mono.Test/EnvironmentInfo/VersionAdapters/ReleaseFileVersionAdapterFixture.cs +++ b/src/NzbDrone.Mono.Test/EnvironmentInfo/VersionAdapters/ReleaseFileVersionAdapterFixture.cs @@ -1,3 +1,4 @@ +using System; using System.IO; using FluentAssertions; using Moq; @@ -44,7 +45,7 @@ namespace NzbDrone.Mono.Test.EnvironmentInfo.VersionAdapters Subject.Read().Should().BeNull(); Mocker.GetMock() - .Setup(c => c.GetFiles(It.IsAny(), SearchOption.TopDirectoryOnly)).Returns(new string[0]); + .Setup(c => c.GetFiles(It.IsAny(), SearchOption.TopDirectoryOnly)).Returns(Array.Empty()); Subject.Read().Should().BeNull(); } diff --git a/src/NzbDrone.Test.Common/TestBase.cs b/src/NzbDrone.Test.Common/TestBase.cs index 03876da68..5e92e0717 100644 --- a/src/NzbDrone.Test.Common/TestBase.cs +++ b/src/NzbDrone.Test.Common/TestBase.cs @@ -53,7 +53,7 @@ namespace NzbDrone.Test.Common { _mocker = new AutoMoqer(); _mocker.SetConstant(new CacheManager()); - _mocker.SetConstant(new StartupContext(new string[0])); + _mocker.SetConstant(new StartupContext(Array.Empty())); _mocker.SetConstant(TestLogger); } diff --git a/src/Radarr.Api.V3/FileSystem/FileSystemModule.cs b/src/Radarr.Api.V3/FileSystem/FileSystemModule.cs index 7331e0674..2d9c37054 100644 --- a/src/Radarr.Api.V3/FileSystem/FileSystemModule.cs +++ b/src/Radarr.Api.V3/FileSystem/FileSystemModule.cs @@ -1,3 +1,4 @@ +using System; using System.IO; using System.Linq; using Nancy; @@ -57,7 +58,7 @@ namespace Radarr.Api.V3.FileSystem if (!_diskProvider.FolderExists(path)) { - return new string[0]; + return Array.Empty(); } return _diskScanService.GetVideoFiles(path).Select(f => new