From 25c0423ef6241398615e3a85aeb463690d2a8fa1 Mon Sep 17 00:00:00 2001 From: Qstick Date: Sun, 22 Apr 2018 17:12:57 -0400 Subject: [PATCH] Fixed :Compile warning cleanup (#314) Fixed :Compile warning cleanup --- src/Lidarr.Api.V1/Restrictions/RestrictionModule.cs | 10 +++++----- src/Lidarr.Api.V1/Tags/TagDetailsModule.cs | 6 +++--- src/Lidarr.Api.V1/Tags/TagModule.cs | 10 +++++----- src/Lidarr.Http/TinyIoCNancyBootstrapper.cs | 4 +--- src/NzbDrone.Automation.Test/AutomationTest.cs | 6 +++--- .../Datastore/Converters/Int32ConverterFixture.cs | 2 -- .../DecisionEngine/DownloadDecisionMaker.cs | 2 +- .../Download/Clients/Hadouken/Hadouken.cs | 4 ++-- .../Download/Clients/Hadouken/HadoukenProxy.cs | 10 ++++++---- .../Download/Clients/QBittorrent/QBittorrentProxy.cs | 9 ++++++--- .../HeadphonesImport/HeadphonesImportParser.cs | 1 - .../ImportLists/LidarrLists/LidarrListsParser.cs | 1 - src/NzbDrone.Core/Indexers/Gazelle/Gazelle.cs | 4 ---- .../Indexers/Headphones/HeadphonesRssParser.cs | 1 - .../Messaging/Commands/CommandExecutor.cs | 2 +- src/NzbDrone.Host/Owin/MiddleWare/SignalRMiddleWare.cs | 2 +- src/NzbDrone.Host/Owin/OwinServiceProvider.cs | 8 ++++---- 17 files changed, 38 insertions(+), 44 deletions(-) diff --git a/src/Lidarr.Api.V1/Restrictions/RestrictionModule.cs b/src/Lidarr.Api.V1/Restrictions/RestrictionModule.cs index 5c21d13d8..da748ac65 100644 --- a/src/Lidarr.Api.V1/Restrictions/RestrictionModule.cs +++ b/src/Lidarr.Api.V1/Restrictions/RestrictionModule.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using FluentValidation.Results; using NzbDrone.Common.Extensions; using NzbDrone.Core.Restrictions; @@ -15,11 +15,11 @@ namespace Lidarr.Api.V1.Restrictions { _restrictionService = restrictionService; - GetResourceById = Get; + GetResourceById = GetRestriction; GetResourceAll = GetAll; CreateResource = Create; UpdateResource = Update; - DeleteResource = Delete; + DeleteResource = DeleteRestriction; SharedValidator.Custom(restriction => { @@ -32,7 +32,7 @@ namespace Lidarr.Api.V1.Restrictions }); } - private RestrictionResource Get(int id) + private RestrictionResource GetRestriction(int id) { return _restrictionService.Get(id).ToResource(); } @@ -52,7 +52,7 @@ namespace Lidarr.Api.V1.Restrictions _restrictionService.Update(resource.ToModel()); } - private void Delete(int id) + private void DeleteRestriction(int id) { _restrictionService.Delete(id); } diff --git a/src/Lidarr.Api.V1/Tags/TagDetailsModule.cs b/src/Lidarr.Api.V1/Tags/TagDetailsModule.cs index f97bd0e1c..22efa40b6 100644 --- a/src/Lidarr.Api.V1/Tags/TagDetailsModule.cs +++ b/src/Lidarr.Api.V1/Tags/TagDetailsModule.cs @@ -1,4 +1,4 @@ -using NzbDrone.Core.Tags; +using NzbDrone.Core.Tags; using Lidarr.Http; namespace Lidarr.Api.V1.Tags @@ -12,10 +12,10 @@ namespace Lidarr.Api.V1.Tags { _tagService = tagService; - GetResourceById = Get; + GetResourceById = GetTagDetails; } - private TagDetailsResource Get(int id) + private TagDetailsResource GetTagDetails(int id) { return _tagService.Details(id).ToResource(); } diff --git a/src/Lidarr.Api.V1/Tags/TagModule.cs b/src/Lidarr.Api.V1/Tags/TagModule.cs index d188d9387..43ab04b64 100644 --- a/src/Lidarr.Api.V1/Tags/TagModule.cs +++ b/src/Lidarr.Api.V1/Tags/TagModule.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using NzbDrone.Core.Datastore.Events; using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Tags; @@ -17,14 +17,14 @@ namespace Lidarr.Api.V1.Tags { _tagService = tagService; - GetResourceById = Get; + GetResourceById = GetTag; GetResourceAll = GetAll; CreateResource = Create; UpdateResource = Update; - DeleteResource = Delete; + DeleteResource = DeleteTag; } - private TagResource Get(int id) + private TagResource GetTag(int id) { return _tagService.GetTag(id).ToResource(); } @@ -44,7 +44,7 @@ namespace Lidarr.Api.V1.Tags _tagService.Update(resource.ToModel()); } - private void Delete(int id) + private void DeleteTag(int id) { _tagService.Delete(id); } diff --git a/src/Lidarr.Http/TinyIoCNancyBootstrapper.cs b/src/Lidarr.Http/TinyIoCNancyBootstrapper.cs index c4b3f5339..eb4566b06 100644 --- a/src/Lidarr.Http/TinyIoCNancyBootstrapper.cs +++ b/src/Lidarr.Http/TinyIoCNancyBootstrapper.cs @@ -1,4 +1,4 @@ -using TinyIoC; +using TinyIoC; using System; using System.Collections.Generic; using System.Linq; @@ -91,7 +91,6 @@ namespace Lidarr.Http break; case Lifetime.PerRequest: throw new InvalidOperationException("Unable to directly register a per request lifetime."); - break; default: throw new ArgumentOutOfRangeException(); } @@ -118,7 +117,6 @@ namespace Lidarr.Http break; case Lifetime.PerRequest: throw new InvalidOperationException("Unable to directly register a per request lifetime."); - break; default: throw new ArgumentOutOfRangeException(); } diff --git a/src/NzbDrone.Automation.Test/AutomationTest.cs b/src/NzbDrone.Automation.Test/AutomationTest.cs index 89fea6e5f..2a855b06c 100644 --- a/src/NzbDrone.Automation.Test/AutomationTest.cs +++ b/src/NzbDrone.Automation.Test/AutomationTest.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using FluentAssertions; using NLog; @@ -31,7 +31,7 @@ namespace NzbDrone.Automation.Test LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", NLog.LogLevel.Trace, consoleTarget)); } - [TestFixtureSetUp] + [OneTimeSetUp] public void SmokeTestSetup() { driver = new FirefoxDriver(); @@ -56,7 +56,7 @@ namespace NzbDrone.Automation.Test .Select(e => e.Text); } - [TestFixtureTearDown] + [OneTimeTearDown] public void SmokeTestTearDown() { _runner.KillAll(); diff --git a/src/NzbDrone.Core.Test/Datastore/Converters/Int32ConverterFixture.cs b/src/NzbDrone.Core.Test/Datastore/Converters/Int32ConverterFixture.cs index 2c10a0aaf..058436b38 100644 --- a/src/NzbDrone.Core.Test/Datastore/Converters/Int32ConverterFixture.cs +++ b/src/NzbDrone.Core.Test/Datastore/Converters/Int32ConverterFixture.cs @@ -13,8 +13,6 @@ namespace NzbDrone.Core.Test.Datastore.Converters [Test] public void should_return_int_when_saving_int_to_db() { - var i = 5; - Subject.ToDB(5).Should().Be(5); } diff --git a/src/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs b/src/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs index d4b87698e..f353f5fd2 100644 --- a/src/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs +++ b/src/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs @@ -160,7 +160,7 @@ namespace NzbDrone.Core.DecisionEngine return new Rejection(result.Reason, spec.Type); } } - catch (NotImplementedException e) + catch (NotImplementedException) { _logger.Trace("Spec " + spec.GetType().Name + " not implemented."); } diff --git a/src/NzbDrone.Core/Download/Clients/Hadouken/Hadouken.cs b/src/NzbDrone.Core/Download/Clients/Hadouken/Hadouken.cs index 4d0ee1049..43836b7e3 100644 --- a/src/NzbDrone.Core/Download/Clients/Hadouken/Hadouken.cs +++ b/src/NzbDrone.Core/Download/Clients/Hadouken/Hadouken.cs @@ -158,7 +158,7 @@ namespace NzbDrone.Core.Download.Clients.Hadouken } catch (DownloadClientAuthenticationException ex) { - _logger.ErrorException(ex.Message, ex); + _logger.Error(ex.Message, ex); return new NzbDroneValidationFailure("Password", "Authentication failed"); } @@ -174,7 +174,7 @@ namespace NzbDrone.Core.Download.Clients.Hadouken } catch (Exception ex) { - _logger.ErrorException(ex.Message, ex); + _logger.Error(ex, ex.Message); return new NzbDroneValidationFailure(String.Empty, "Failed to get the list of torrents: " + ex.Message); } diff --git a/src/NzbDrone.Core/Download/Clients/Hadouken/HadoukenProxy.cs b/src/NzbDrone.Core/Download/Clients/Hadouken/HadoukenProxy.cs index 9eee399a3..8a99728d4 100644 --- a/src/NzbDrone.Core/Download/Clients/Hadouken/HadoukenProxy.cs +++ b/src/NzbDrone.Core/Download/Clients/Hadouken/HadoukenProxy.cs @@ -71,9 +71,11 @@ namespace NzbDrone.Core.Download.Clients.Hadouken private T ProcessRequest(HadoukenSettings settings, string method, params object[] parameters) { var baseUrl = HttpRequestBuilder.BuildBaseUrl(settings.UseSsl, settings.Host, settings.Port, "api"); - var requestBuilder = new JsonRpcRequestBuilder(baseUrl, method, parameters); - requestBuilder.LogResponseContent = true; - requestBuilder.NetworkCredential = new NetworkCredential(settings.Username, settings.Password); + var requestBuilder = new JsonRpcRequestBuilder(baseUrl, method, parameters) + { + LogResponseContent = true, + NetworkCredential = new NetworkCredential(settings.Username, settings.Password) + }; requestBuilder.Headers.Add("Accept-Encoding", "gzip,deflate"); var httpRequest = requestBuilder.Build(); @@ -146,7 +148,7 @@ namespace NzbDrone.Core.Download.Clients.Hadouken } catch(Exception ex) { - _logger.ErrorException("Failed to map Hadouken torrent data.", ex); + _logger.Error(ex, "Failed to map Hadouken torrent data."); } return torrent; diff --git a/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrentProxy.cs b/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrentProxy.cs index 789b1a420..aff318203 100644 --- a/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrentProxy.cs +++ b/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrentProxy.cs @@ -197,9 +197,12 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent private HttpRequestBuilder BuildRequest(QBittorrentSettings settings) { - var requestBuilder = new HttpRequestBuilder(settings.UseSsl, settings.Host, settings.Port); - requestBuilder.LogResponseContent = true; - requestBuilder.NetworkCredential = new NetworkCredential(settings.Username, settings.Password); + var requestBuilder = + new HttpRequestBuilder(settings.UseSsl, settings.Host, settings.Port) + { + LogResponseContent = true, + NetworkCredential = new NetworkCredential(settings.Username, settings.Password) + }; return requestBuilder; } diff --git a/src/NzbDrone.Core/ImportLists/HeadphonesImport/HeadphonesImportParser.cs b/src/NzbDrone.Core/ImportLists/HeadphonesImport/HeadphonesImportParser.cs index b83ccb030..b490a6cbd 100644 --- a/src/NzbDrone.Core/ImportLists/HeadphonesImport/HeadphonesImportParser.cs +++ b/src/NzbDrone.Core/ImportLists/HeadphonesImport/HeadphonesImportParser.cs @@ -11,7 +11,6 @@ namespace NzbDrone.Core.ImportLists.HeadphonesImport public class HeadphonesImportParser : IParseImportListResponse { private ImportListResponse _importListResponse; - private readonly Logger _logger; public IList ParseResponse(ImportListResponse importListResponse) { diff --git a/src/NzbDrone.Core/ImportLists/LidarrLists/LidarrListsParser.cs b/src/NzbDrone.Core/ImportLists/LidarrLists/LidarrListsParser.cs index 5e3e363c2..42a1b48ae 100644 --- a/src/NzbDrone.Core/ImportLists/LidarrLists/LidarrListsParser.cs +++ b/src/NzbDrone.Core/ImportLists/LidarrLists/LidarrListsParser.cs @@ -12,7 +12,6 @@ namespace NzbDrone.Core.ImportLists.LidarrLists { private readonly LidarrListsSettings _settings; private ImportListResponse _importListResponse; - private readonly Logger _logger; public LidarrListsParser(LidarrListsSettings settings) { diff --git a/src/NzbDrone.Core/Indexers/Gazelle/Gazelle.cs b/src/NzbDrone.Core/Indexers/Gazelle/Gazelle.cs index 84aa25202..df85020b4 100644 --- a/src/NzbDrone.Core/Indexers/Gazelle/Gazelle.cs +++ b/src/NzbDrone.Core/Indexers/Gazelle/Gazelle.cs @@ -17,15 +17,11 @@ namespace NzbDrone.Core.Indexers.Gazelle public override int PageSize => 50; private readonly ICached> _authCookieCache; - private readonly IHttpClient _httpClient; - private readonly Logger _logger; public Gazelle(IHttpClient httpClient, ICacheManager cacheManager, IIndexerStatusService indexerStatusService, IConfigService configService, IParsingService parsingService, Logger logger) : base(httpClient, indexerStatusService, configService, parsingService, logger) { - _httpClient = httpClient; - _logger = logger; _authCookieCache = cacheManager.GetCache>(GetType(), "authCookies"); } diff --git a/src/NzbDrone.Core/Indexers/Headphones/HeadphonesRssParser.cs b/src/NzbDrone.Core/Indexers/Headphones/HeadphonesRssParser.cs index 5825d68a7..abdc9961b 100644 --- a/src/NzbDrone.Core/Indexers/Headphones/HeadphonesRssParser.cs +++ b/src/NzbDrone.Core/Indexers/Headphones/HeadphonesRssParser.cs @@ -6,7 +6,6 @@ namespace NzbDrone.Core.Indexers.Headphones { public class HeadphonesRssParser : NewznabRssParser { - public const string ns = "{http://www.newznab.com/DTD/2010/feeds/attributes/}"; public HeadphonesSettings Settings { get; set; } public HeadphonesRssParser() diff --git a/src/NzbDrone.Core/Messaging/Commands/CommandExecutor.cs b/src/NzbDrone.Core/Messaging/Commands/CommandExecutor.cs index f2f727180..53ed14a6c 100644 --- a/src/NzbDrone.Core/Messaging/Commands/CommandExecutor.cs +++ b/src/NzbDrone.Core/Messaging/Commands/CommandExecutor.cs @@ -51,7 +51,7 @@ namespace NzbDrone.Core.Messaging.Commands _logger.Error(ex, "Thread aborted"); Thread.ResetAbort(); } - catch (OperationCanceledException ex) + catch (OperationCanceledException) { _logger.Trace("Stopped one command execution pipeline"); } diff --git a/src/NzbDrone.Host/Owin/MiddleWare/SignalRMiddleWare.cs b/src/NzbDrone.Host/Owin/MiddleWare/SignalRMiddleWare.cs index 8134b6928..f2e881f5e 100644 --- a/src/NzbDrone.Host/Owin/MiddleWare/SignalRMiddleWare.cs +++ b/src/NzbDrone.Host/Owin/MiddleWare/SignalRMiddleWare.cs @@ -22,7 +22,7 @@ namespace NzbDrone.Host.Owin.MiddleWare public void Attach(IAppBuilder appBuilder) { - appBuilder.MapConnection("/signalr", typeof(NzbDronePersistentConnection), new ConnectionConfiguration ()); + appBuilder.MapSignalR("/signalr", typeof(NzbDronePersistentConnection), new ConnectionConfiguration ()); } } } diff --git a/src/NzbDrone.Host/Owin/OwinServiceProvider.cs b/src/NzbDrone.Host/Owin/OwinServiceProvider.cs index c0676cd24..2c12a8d0a 100644 --- a/src/NzbDrone.Host/Owin/OwinServiceProvider.cs +++ b/src/NzbDrone.Host/Owin/OwinServiceProvider.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Net; @@ -60,7 +60,7 @@ namespace NzbDrone.Host.Owin if (ex.InnerException is HttpListenerException) { - throw new PortInUseException("Port {0} is already in use, please ensure NzbDrone is not already running.", ex, _configFileProvider.Port); + throw new PortInUseException("Port {0} is already in use, please ensure Lidarr is not already running.", ex, _configFileProvider.Port); } throw ex.InnerException; @@ -70,7 +70,7 @@ namespace NzbDrone.Host.Owin private void BuildApp(IAppBuilder appBuilder) { - appBuilder.Properties["host.AppName"] = "NzbDrone"; + appBuilder.Properties["host.AppName"] = "Lidarr"; foreach (var middleWare in _owinMiddleWares.OrderBy(c => c.Order)) { @@ -88,4 +88,4 @@ namespace NzbDrone.Host.Owin return provider; } } -} \ No newline at end of file +}