diff --git a/.editorconfig b/.editorconfig index 2da731f20..249ae51f6 100644 --- a/.editorconfig +++ b/.editorconfig @@ -194,7 +194,6 @@ dotnet_diagnostic.CA1825.severity = suggestion dotnet_diagnostic.CA1826.severity = suggestion dotnet_diagnostic.CA1827.severity = suggestion dotnet_diagnostic.CA1828.severity = suggestion -dotnet_diagnostic.CA1829.severity = suggestion dotnet_diagnostic.CA2000.severity = suggestion dotnet_diagnostic.CA2002.severity = suggestion dotnet_diagnostic.CA2007.severity = suggestion diff --git a/src/NzbDrone.Api/ProviderModuleBase.cs b/src/NzbDrone.Api/ProviderModuleBase.cs index b842d832e..4af04ccf4 100644 --- a/src/NzbDrone.Api/ProviderModuleBase.cs +++ b/src/NzbDrone.Api/ProviderModuleBase.cs @@ -147,7 +147,7 @@ namespace NzbDrone.Api { var defaultDefinitions = _providerFactory.GetDefaultDefinitions().OrderBy(p => p.ImplementationName).ToList(); - var result = new List(defaultDefinitions.Count()); + var result = new List(defaultDefinitions.Count); foreach (var providerDefinition in defaultDefinitions) { diff --git a/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs b/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs index 3e880616e..dc3457521 100644 --- a/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs +++ b/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs @@ -46,7 +46,7 @@ namespace NzbDrone.Common.Test.Http TestLogger.Info($"{candidates.Length} TestSites available."); - _httpBinSleep = _httpBinHosts.Count() < 2 ? 100 : 10; + _httpBinSleep = _httpBinHosts.Length < 2 ? 100 : 10; } private bool IsTestSiteAvailable(string site) diff --git a/src/NzbDrone.Common/TinyIoC.cs b/src/NzbDrone.Common/TinyIoC.cs index f3ac33d59..ec4bfd198 100644 --- a/src/NzbDrone.Common/TinyIoC.cs +++ b/src/NzbDrone.Common/TinyIoC.cs @@ -1,4 +1,4 @@ -//=============================================================================== +//=============================================================================== // TinyIoC // // An easy to use, hassle free, Inversion of Control Container for small projects @@ -3488,7 +3488,7 @@ namespace TinyIoC //#if NETFX_CORE // return type.GetTypeInfo().DeclaredConstructors.OrderByDescending(ctor => ctor.GetParameters().Count()); //#else - return type.GetConstructors().OrderByDescending(ctor => ctor.GetParameters().Count()); + return type.GetConstructors().OrderByDescending(ctor => ctor.GetParameters().Length); //#endif } @@ -3534,9 +3534,9 @@ namespace TinyIoC throw new TinyIoCResolutionException(typeToConstruct); var ctorParams = constructor.GetParameters(); - object[] args = new object[ctorParams.Count()]; + object[] args = new object[ctorParams.Length]; - for (int parameterIndex = 0; parameterIndex < ctorParams.Count(); parameterIndex++) + for (int parameterIndex = 0; parameterIndex < ctorParams.Length; parameterIndex++) { var currentParam = ctorParams[parameterIndex]; diff --git a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs index 3e0667a60..d7cf00372 100644 --- a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs @@ -170,7 +170,7 @@ namespace NzbDrone.Core.Test.ParserTests public void should_not_parse_wrong_language_in_title(string postTitle) { var parsed = Parser.Parser.ParseMovieTitle(postTitle, true); - parsed.Languages.Count().Should().Be(1); + parsed.Languages.Count.Should().Be(1); parsed.Languages.First().Should().Be(Language.Unknown); } @@ -178,7 +178,7 @@ namespace NzbDrone.Core.Test.ParserTests public void should_not_parse_multi_language_in_releasegroup(string postTitle) { var parsed = Parser.Parser.ParseMovieTitle(postTitle, true); - parsed.Languages.Count().Should().Be(1); + parsed.Languages.Count.Should().Be(1); parsed.Languages.First().Should().Be(Language.German); } @@ -186,7 +186,7 @@ namespace NzbDrone.Core.Test.ParserTests public void should_parse_multi_language(string postTitle) { var parsed = Parser.Parser.ParseMovieTitle(postTitle, true); - parsed.Languages.Count().Should().Be(2); + parsed.Languages.Count.Should().Be(2); parsed.Languages.Should().Contain(Language.German); parsed.Languages.Should().Contain(Language.English, "Added by the multi tag in the release name"); } diff --git a/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs b/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs index 07624eb3d..3438a44bd 100644 --- a/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs +++ b/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs @@ -237,7 +237,7 @@ namespace NzbDrone.Core.Configuration var valueHolder = parentContainer.Descendants(key).ToList(); - if (valueHolder.Count() == 1) + if (valueHolder.Count == 1) { return valueHolder.First().Value.Trim(); } diff --git a/src/NzbDrone.Core/Download/Clients/Sabnzbd/JsonConverters/SabnzbdQueueTimeConverter.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/JsonConverters/SabnzbdQueueTimeConverter.cs index 10efa12b2..a94c7811a 100644 --- a/src/NzbDrone.Core/Download/Clients/Sabnzbd/JsonConverters/SabnzbdQueueTimeConverter.cs +++ b/src/NzbDrone.Core/Download/Clients/Sabnzbd/JsonConverters/SabnzbdQueueTimeConverter.cs @@ -16,7 +16,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd.JsonConverters { var split = reader.Value.ToString().Split(':').Select(int.Parse).ToArray(); - switch (split.Count()) + switch (split.Length) { case 4: return new TimeSpan((split[0] * 24) + split[1], split[2], split[3]); diff --git a/src/NzbDrone.Core/Download/Pending/PendingReleaseService.cs b/src/NzbDrone.Core/Download/Pending/PendingReleaseService.cs index cbecfdd7e..6336412da 100644 --- a/src/NzbDrone.Core/Download/Pending/PendingReleaseService.cs +++ b/src/NzbDrone.Core/Download/Pending/PendingReleaseService.cs @@ -107,9 +107,9 @@ namespace NzbDrone.Core.Download.Pending _logger.Debug("The release {0} is already pending with reason {1}, not adding again", decision.RemoteMovie, reason); } - if (matchingReports.Count() > 1) + if (matchingReports.Count > 1) { - _logger.Debug("The release {0} had {1} duplicate pending, removing duplicates.", decision.RemoteMovie, matchingReports.Count() - 1); + _logger.Debug("The release {0} had {1} duplicate pending, removing duplicates.", decision.RemoteMovie, matchingReports.Count - 1); foreach (var duplicate in matchingReports.Skip(1)) { diff --git a/src/NzbDrone.Core/Indexers/TorrentRss/TorrentRssSettingsDetector.cs b/src/NzbDrone.Core/Indexers/TorrentRss/TorrentRssSettingsDetector.cs index 35d2fd5f6..4947fabcc 100644 --- a/src/NzbDrone.Core/Indexers/TorrentRss/TorrentRssSettingsDetector.cs +++ b/src/NzbDrone.Core/Indexers/TorrentRss/TorrentRssSettingsDetector.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Linq; using System.Xml; @@ -168,7 +168,7 @@ namespace NzbDrone.Core.Indexers.TorrentRss releases = ParseResponse(parser, response); ValidateReleases(releases, indexerSettings); - if (releases.Count(r => r.Size >= ValidSizeThreshold) > releases.Count() / 2) + if (releases.Count(r => r.Size >= ValidSizeThreshold) > releases.Length / 2) { if (releases.Any(r => r.Size < ValidSizeThreshold)) { diff --git a/src/NzbDrone.Core/Jobs/TaskManager.cs b/src/NzbDrone.Core/Jobs/TaskManager.cs index 2f7d61bb6..fe2584850 100644 --- a/src/NzbDrone.Core/Jobs/TaskManager.cs +++ b/src/NzbDrone.Core/Jobs/TaskManager.cs @@ -106,7 +106,7 @@ namespace NzbDrone.Core.Jobs var currentTasks = _scheduledTaskRepository.All().ToList(); - _logger.Trace("Initializing jobs. Available: {0} Existing: {1}", defaultTasks.Count(), currentTasks.Count()); + _logger.Trace("Initializing jobs. Available: {0} Existing: {1}", defaultTasks.Length, currentTasks.Count); foreach (var job in currentTasks) { diff --git a/src/NzbDrone.Core/Languages/LanguagesComparer.cs b/src/NzbDrone.Core/Languages/LanguagesComparer.cs index 941f33e70..02a9dd3d6 100644 --- a/src/NzbDrone.Core/Languages/LanguagesComparer.cs +++ b/src/NzbDrone.Core/Languages/LanguagesComparer.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; namespace NzbDrone.Core.Languages @@ -22,27 +22,27 @@ namespace NzbDrone.Core.Languages return -1; } - if (x.Count() > 1 && y.Count() > 1 && x.Count() > y.Count()) + if (x.Count > 1 && y.Count > 1 && x.Count > y.Count) { return 1; } - if (x.Count() > 1 && y.Count() > 1 && x.Count() < y.Count()) + if (x.Count > 1 && y.Count > 1 && x.Count < y.Count) { return -1; } - if (x.Count() > 1 && y.Count() == 1) + if (x.Count > 1 && y.Count == 1) { return 1; } - if (x.Count() == 1 && y.Count() > 1) + if (x.Count == 1 && y.Count > 1) { return -1; } - if (x.Count() == 1 && y.Count() == 1) + if (x.Count == 1 && y.Count == 1) { return x.First().Name.CompareTo(y.First().Name); } diff --git a/src/NzbDrone.Core/MediaFiles/MediaInfo/MediaInfoFormatter.cs b/src/NzbDrone.Core/MediaFiles/MediaInfo/MediaInfoFormatter.cs index 8689532dc..04a0dc313 100644 --- a/src/NzbDrone.Core/MediaFiles/MediaInfo/MediaInfoFormatter.cs +++ b/src/NzbDrone.Core/MediaFiles/MediaInfo/MediaInfoFormatter.cs @@ -492,7 +492,7 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo { var channelSplit = channel.Split(new string[] { "." }, StringSplitOptions.None); - if (channelSplit.Count() == 3) + if (channelSplit.Length == 3) { positions += decimal.Parse(string.Format("{0}.{1}", channelSplit[1], channelSplit[2]), CultureInfo.InvariantCulture); } diff --git a/src/NzbDrone.Core/MediaFiles/MovieImport/ImportDecisionMaker.cs b/src/NzbDrone.Core/MediaFiles/MovieImport/ImportDecisionMaker.cs index bdfc2e48e..0b0ebab1a 100644 --- a/src/NzbDrone.Core/MediaFiles/MovieImport/ImportDecisionMaker.cs +++ b/src/NzbDrone.Core/MediaFiles/MovieImport/ImportDecisionMaker.cs @@ -61,7 +61,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport { var newFiles = filterExistingFiles ? _mediaFileService.FilterExistingFiles(videoFiles.ToList(), movie) : videoFiles.ToList(); - _logger.Debug("Analyzing {0}/{1} files.", newFiles.Count, videoFiles.Count()); + _logger.Debug("Analyzing {0}/{1} files.", newFiles.Count, videoFiles.Count); ParsedMovieInfo downloadClientItemInfo = null; diff --git a/src/NzbDrone.Update/UpdateApp.cs b/src/NzbDrone.Update/UpdateApp.cs index 0cc7ab8da..a119acd5c 100644 --- a/src/NzbDrone.Update/UpdateApp.cs +++ b/src/NzbDrone.Update/UpdateApp.cs @@ -68,7 +68,7 @@ namespace NzbDrone.Update if (OsInfo.IsNotWindows) { - switch (args.Count()) + switch (args.Length) { case 1: return startupContext; diff --git a/src/Radarr.Api.V3/ProviderModuleBase.cs b/src/Radarr.Api.V3/ProviderModuleBase.cs index f094e3495..a34fe2b43 100644 --- a/src/Radarr.Api.V3/ProviderModuleBase.cs +++ b/src/Radarr.Api.V3/ProviderModuleBase.cs @@ -116,7 +116,7 @@ namespace Radarr.Api.V3 { var defaultDefinitions = _providerFactory.GetDefaultDefinitions().OrderBy(p => p.ImplementationName).ToList(); - var result = new List(defaultDefinitions.Count()); + var result = new List(defaultDefinitions.Count); foreach (var providerDefinition in defaultDefinitions) {