diff --git a/.editorconfig b/.editorconfig index 7ae9f7a071..9bec013f1d 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 5b2e854d5d..28c3e7e291 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 @@ private object GetMediaFiles() 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 07df9c79e6..f53dfee9a2 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 @@ public class StartupArgumentsFixture : TestBase [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 dc34575216..fc73ef90a8 100644 --- a/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs +++ b/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs @@ -100,7 +100,7 @@ public void SetUp() 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 @@ public void GivenOldCookie() 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 eab34c6a0c..a5e68de4a8 100644 --- a/src/NzbDrone.Common/Http/HttpResponse.cs +++ b/src/NzbDrone.Common/Http/HttpResponse.cs @@ -56,7 +56,7 @@ public string Content 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 58a7541dab..ef59c9c0f2 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 @@ public string[] BypassListAsArray return hostlist; } - return new string[] { }; + return Array.Empty(); } } diff --git a/src/NzbDrone.Common/TinyIoC.cs b/src/NzbDrone.Common/TinyIoC.cs index ec4bfd1982..b61d91cdec 100644 --- a/src/NzbDrone.Common/TinyIoC.cs +++ b/src/NzbDrone.Common/TinyIoC.cs @@ -298,11 +298,11 @@ public static Type[] SafeGetTypes(this Assembly assembly) } 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 @@ private object GetLazyAutomaticFactoryRequest(Type type) //#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 @@ private void BuildUpInternal(object input, ResolveOptions resolveOptions) 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 e4d86a18b8..b971db30e0 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 @@ public void Setup() 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 2a1e1fd5b6..ffd1882085 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadClientFixtureBase.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadClientFixtureBase.cs @@ -34,7 +34,7 @@ public void SetupBase() 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 3d071c8bce..3aaafd8f22 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 @@ public void Setup() 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 1bea62b494..6cd5e512cf 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 @@ public void Setup() 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 daaf8aed84..aecc604e38 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 @@ public void Setup() 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 31f9859baf..aa835d775c 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 @@ public void Setup() 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 @@ protected void GivenRedirectToMagnet() 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 @@ protected void GivenRedirectToTorrent() 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 @@ public void Download_should_not_fail_if_top_priority_not_available() 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 120c2a217c..a9af73675e 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 @@ public void should_test_failed_if_tv_sorting_null() 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 e2c55423b6..d6e2db822a 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 @@ public void Setup() 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 d9b1ebfb38..762dddeafc 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 @@ public void Setup() 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 @@ protected void GivenRedirectToMagnet() 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 @@ protected void GivenRedirectToTorrent() 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 adab7b46ad..6831f5701a 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadServiceFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadServiceFixture.cs @@ -123,7 +123,7 @@ public void Download_report_should_trigger_indexer_backoff_on_indexer_error() 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 @@ public void Download_report_should_trigger_indexer_backoff_on_http429_with_long_ 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 48dc033d8f..4c96829579 100644 --- a/src/NzbDrone.Core.Test/Framework/CoreTest.cs +++ b/src/NzbDrone.Core.Test/Framework/CoreTest.cs @@ -26,7 +26,7 @@ protected void UseRealHttp() 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 c50f9416b0..96da3ecac6 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientCheckFixture.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/DownloadClientCheckFixture.cs @@ -25,7 +25,7 @@ public void should_return_warning_when_download_client_has_not_been_configured() { 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 2beca9d02a..92bb398da7 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/DownloadedMoviesImportServiceFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/DownloadedMoviesImportServiceFixture.cs @@ -93,7 +93,7 @@ private void GivenSuccessfulImport() 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 @@ public void should_not_import_if_folder_is_a_series_path() 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 db729edb28..52aa77c01d 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 @@ public void should_not_be_valid_if_bcc_is_invalid(string email) [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 d01375b26a..1593dbbd6f 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 @@ private void ChangeEmailAddressType(IDbConnection conn, IDbTransaction tran) 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 f8a331de98..c1ff35a825 100644 --- a/src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs +++ b/src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs @@ -349,7 +349,7 @@ private DelugeTorrent[] GetTorrents(DelugeUpdateUIResult result) { 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 4ab8f67c12..ac44956cc2 100644 --- a/src/NzbDrone.Core/Download/Clients/Hadouken/HadoukenProxy.cs +++ b/src/NzbDrone.Core/Download/Clients/Hadouken/HadoukenProxy.cs @@ -106,7 +106,7 @@ private HadoukenTorrent[] GetTorrents(object[][] torrentsRaw) { 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 7cb0219839..d10dd02563 100644 --- a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs +++ b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs @@ -17,7 +17,7 @@ public class TrackedDownload 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 ee2778d208..6eed5c302b 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 @@ public RadarrSettings() { 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 ca60aaabae..b7972e9427 100644 --- a/src/NzbDrone.Core/Indexers/HDBits/HDBitsSettings.cs +++ b/src/NzbDrone.Core/Indexers/HDBits/HDBitsSettings.cs @@ -28,8 +28,8 @@ public HDBitsSettings() 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 750c9fca27..acb14287ca 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 @@ public EmailSettings() 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 d9611467d6..fb4acad1b3 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 @@ public class PushBulletSettings : IProviderConfig 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 646538e383..4bf2098c09 100644 --- a/src/NzbDrone.Core/Notifications/Pushover/PushoverSettings.cs +++ b/src/NzbDrone.Core/Notifications/Pushover/PushoverSettings.cs @@ -23,7 +23,7 @@ public class PushoverSettings : IProviderConfig 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 41e1ca5256..b1d8631a28 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 @@ public class SendGridSettings : IProviderConfig 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 73726a18e0..3a93a719bf 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 @@ public void should_return_null_if_release_file_doestn_exist() 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 03876da687..5e92e0717d 100644 --- a/src/NzbDrone.Test.Common/TestBase.cs +++ b/src/NzbDrone.Test.Common/TestBase.cs @@ -53,7 +53,7 @@ protected AutoMoqer Mocker { _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 7331e0674e..2d9c370544 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 @@ private object GetMediaFiles() if (!_diskProvider.FolderExists(path)) { - return new string[0]; + return Array.Empty(); } return _diskScanService.GetVideoFiles(path).Select(f => new