From 9d4ce82ab9e85a89aa2463e051f805113d952ac5 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Wed, 9 Oct 2019 17:10:16 +0200 Subject: [PATCH] Enable `TreatWarningsAsErrors` for MediaBrowser.Common and Emby.Photos Adds `#pragma warning disable CS1591` to all files in MediaBrowser.Common containing undocumented members. --- Emby.Photos/Emby.Photos.csproj | 12 ++++++++ Emby.Photos/PhotoProvider.cs | 28 +++++++++++-------- .../AppBase/BaseApplicationPaths.cs | 5 +--- .../ApplicationHost.cs | 7 +++-- .../ConfigurationUpdateEventArgs.cs | 3 ++ .../Configuration/IApplicationPaths.cs | 5 +++- .../Configuration/IConfigurationFactory.cs | 2 ++ .../Configuration/IConfigurationManager.cs | 2 ++ .../Cryptography/PasswordHash.cs | 2 ++ MediaBrowser.Common/Events/EventHelper.cs | 2 ++ .../Extensions/CollectionExtensions.cs | 2 ++ .../Extensions/ResourceNotFoundException.cs | 2 ++ MediaBrowser.Common/HexHelper.cs | 2 ++ MediaBrowser.Common/IApplicationHost.cs | 13 +++++++-- .../MediaBrowser.Common.csproj | 1 + MediaBrowser.Common/Net/CustomHeaderNames.cs | 2 ++ MediaBrowser.Common/Net/HttpRequestOptions.cs | 2 ++ MediaBrowser.Common/Net/HttpResponseInfo.cs | 3 ++ MediaBrowser.Common/Net/IHttpClient.cs | 4 ++- MediaBrowser.Common/Net/INetworkManager.cs | 2 ++ MediaBrowser.Common/Plugins/BasePlugin.cs | 2 ++ MediaBrowser.Common/Plugins/IPlugin.cs | 2 ++ .../Progress/ActionableProgress.cs | 18 ++++-------- .../Providers/SubtitleConfigurationFactory.cs | 3 ++ MediaBrowser.Common/System/OperatingSystem.cs | 2 ++ .../Updates/IInstallationManager.cs | 2 ++ .../Updates/InstallationEventArgs.cs | 2 ++ .../Updates/InstallationFailedEventArgs.cs | 2 ++ 28 files changed, 98 insertions(+), 36 deletions(-) diff --git a/Emby.Photos/Emby.Photos.csproj b/Emby.Photos/Emby.Photos.csproj index db73cb5219..b57b93a8c5 100644 --- a/Emby.Photos/Emby.Photos.csproj +++ b/Emby.Photos/Emby.Photos.csproj @@ -17,6 +17,18 @@ netstandard2.0 false true + true + + + + + + + + + + + ../jellyfin.ruleset diff --git a/Emby.Photos/PhotoProvider.cs b/Emby.Photos/PhotoProvider.cs index 1591609ab0..63631e512b 100644 --- a/Emby.Photos/PhotoProvider.cs +++ b/Emby.Photos/PhotoProvider.cs @@ -17,39 +17,50 @@ using TagLib.IFD.Tags; namespace Emby.Photos { + /// + /// Metadata provider for photos. + /// public class PhotoProvider : ICustomMetadataProvider, IForcedProvider, IHasItemChangeMonitor { private readonly ILogger _logger; private readonly IImageProcessor _imageProcessor; // These are causing taglib to hang - private string[] _includextensions = new string[] { ".jpg", ".jpeg", ".png", ".tiff", ".cr2" }; + private readonly string[] _includeExtensions = new string[] { ".jpg", ".jpeg", ".png", ".tiff", ".cr2" }; - public PhotoProvider(ILogger logger, IImageProcessor imageProcessor) + /// + /// Initializes a new instance of the class. + /// + /// The logger. + /// The image processor. + public PhotoProvider(ILogger logger, IImageProcessor imageProcessor) { _logger = logger; _imageProcessor = imageProcessor; } + /// public string Name => "Embedded Information"; + /// public bool HasChanged(BaseItem item, IDirectoryService directoryService) { if (item.IsFileProtocol) { var file = directoryService.GetFile(item.Path); - return (file != null && file.LastWriteTimeUtc != item.DateModified); + return file != null && file.LastWriteTimeUtc != item.DateModified; } return false; } + /// public Task FetchAsync(Photo item, MetadataRefreshOptions options, CancellationToken cancellationToken) { item.SetImagePath(ImageType.Primary, item.Path); // Examples: https://github.com/mono/taglib-sharp/blob/a5f6949a53d09ce63ee7495580d6802921a21f14/tests/fixtures/TagLib.Tests.Images/NullOrientationTest.cs - if (_includextensions.Contains(Path.GetExtension(item.Path), StringComparer.OrdinalIgnoreCase)) + if (_includeExtensions.Contains(Path.GetExtension(item.Path), StringComparer.OrdinalIgnoreCase)) { try { @@ -88,14 +99,7 @@ namespace Emby.Photos item.Height = image.Properties.PhotoHeight; var rating = image.ImageTag.Rating; - if (rating.HasValue) - { - item.CommunityRating = rating; - } - else - { - item.CommunityRating = null; - } + item.CommunityRating = rating.HasValue ? rating : null; item.Overview = image.ImageTag.Comment; diff --git a/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs b/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs index f67a09daa3..c3cdcc2222 100644 --- a/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs +++ b/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs @@ -59,10 +59,7 @@ namespace Emby.Server.Implementations.AppBase private set => _dataPath = Directory.CreateDirectory(value).FullName; } - /// - /// Gets the magic string used for virtual path manipulation. - /// - /// The magic string used for virtual path manipulation. + /// public string VirtualDataPath { get; } = "%AppDataPath%"; /// diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index f36d465dd1..14315c6815 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -1,3 +1,5 @@ +#pragma warning disable CS1591 + using System; using System.Collections.Concurrent; using System.Collections.Generic; @@ -49,7 +51,6 @@ using MediaBrowser.Api; using MediaBrowser.Common; using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Events; -using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Net; using MediaBrowser.Common.Plugins; using MediaBrowser.Common.Updates; @@ -117,7 +118,7 @@ using OperatingSystem = MediaBrowser.Common.System.OperatingSystem; namespace Emby.Server.Implementations { /// - /// Class CompositionRoot + /// Class CompositionRoot. /// public abstract class ApplicationHost : IServerApplicationHost, IDisposable { @@ -166,6 +167,7 @@ namespace Emby.Server.Implementations /// true if this instance has pending application restart; otherwise, false. public bool HasPendingRestart { get; private set; } + /// public bool IsShuttingDown { get; private set; } /// @@ -217,6 +219,7 @@ namespace Emby.Server.Implementations public IFileSystem FileSystemManager { get; set; } + /// public PackageVersionClass SystemUpdateLevel { get diff --git a/MediaBrowser.Common/Configuration/ConfigurationUpdateEventArgs.cs b/MediaBrowser.Common/Configuration/ConfigurationUpdateEventArgs.cs index 0b59627cc8..344aecf530 100644 --- a/MediaBrowser.Common/Configuration/ConfigurationUpdateEventArgs.cs +++ b/MediaBrowser.Common/Configuration/ConfigurationUpdateEventArgs.cs @@ -1,3 +1,5 @@ +#pragma warning disable CS1591 + using System; namespace MediaBrowser.Common.Configuration @@ -9,6 +11,7 @@ namespace MediaBrowser.Common.Configuration /// /// The key. public string Key { get; set; } + /// /// Gets or sets the new configuration. /// diff --git a/MediaBrowser.Common/Configuration/IApplicationPaths.cs b/MediaBrowser.Common/Configuration/IApplicationPaths.cs index fd11bf904f..5bdea7d8b3 100644 --- a/MediaBrowser.Common/Configuration/IApplicationPaths.cs +++ b/MediaBrowser.Common/Configuration/IApplicationPaths.cs @@ -77,7 +77,10 @@ namespace MediaBrowser.Common.Configuration /// The temp directory. string TempDirectory { get; } + /// + /// Gets the magic string used for virtual path manipulation. + /// + /// The magic string used for virtual path manipulation. string VirtualDataPath { get; } } - } diff --git a/MediaBrowser.Common/Configuration/IConfigurationFactory.cs b/MediaBrowser.Common/Configuration/IConfigurationFactory.cs index 0fb2b83d1b..4c4060096d 100644 --- a/MediaBrowser.Common/Configuration/IConfigurationFactory.cs +++ b/MediaBrowser.Common/Configuration/IConfigurationFactory.cs @@ -1,3 +1,5 @@ +#pragma warning disable CS1591 + using System; using System.Collections.Generic; diff --git a/MediaBrowser.Common/Configuration/IConfigurationManager.cs b/MediaBrowser.Common/Configuration/IConfigurationManager.cs index 8fed2dcdf4..caf2edd836 100644 --- a/MediaBrowser.Common/Configuration/IConfigurationManager.cs +++ b/MediaBrowser.Common/Configuration/IConfigurationManager.cs @@ -1,3 +1,5 @@ +#pragma warning disable CS1591 + using System; using System.Collections.Generic; using MediaBrowser.Model.Configuration; diff --git a/MediaBrowser.Common/Cryptography/PasswordHash.cs b/MediaBrowser.Common/Cryptography/PasswordHash.cs index 5b28d344f6..7741571db9 100644 --- a/MediaBrowser.Common/Cryptography/PasswordHash.cs +++ b/MediaBrowser.Common/Cryptography/PasswordHash.cs @@ -1,3 +1,5 @@ +#pragma warning disable CS1591 + using System; using System.Collections.Generic; using System.IO; diff --git a/MediaBrowser.Common/Events/EventHelper.cs b/MediaBrowser.Common/Events/EventHelper.cs index 0ac7905a18..b67315df62 100644 --- a/MediaBrowser.Common/Events/EventHelper.cs +++ b/MediaBrowser.Common/Events/EventHelper.cs @@ -1,3 +1,5 @@ +#pragma warning disable CS1591 + using System; using System.Threading.Tasks; using Microsoft.Extensions.Logging; diff --git a/MediaBrowser.Common/Extensions/CollectionExtensions.cs b/MediaBrowser.Common/Extensions/CollectionExtensions.cs index 75b9f59f87..2152243985 100644 --- a/MediaBrowser.Common/Extensions/CollectionExtensions.cs +++ b/MediaBrowser.Common/Extensions/CollectionExtensions.cs @@ -1,3 +1,5 @@ +#pragma warning disable CS1591 + using System.Collections.Generic; namespace MediaBrowser.Common.Extensions diff --git a/MediaBrowser.Common/Extensions/ResourceNotFoundException.cs b/MediaBrowser.Common/Extensions/ResourceNotFoundException.cs index 9f70ae7d89..9b064a40df 100644 --- a/MediaBrowser.Common/Extensions/ResourceNotFoundException.cs +++ b/MediaBrowser.Common/Extensions/ResourceNotFoundException.cs @@ -1,3 +1,5 @@ +#pragma warning disable CS1591 + using System; namespace MediaBrowser.Common.Extensions diff --git a/MediaBrowser.Common/HexHelper.cs b/MediaBrowser.Common/HexHelper.cs index 5587c03fd3..61007b5b2e 100644 --- a/MediaBrowser.Common/HexHelper.cs +++ b/MediaBrowser.Common/HexHelper.cs @@ -1,3 +1,5 @@ +#pragma warning disable CS1591 + using System; using System.Globalization; diff --git a/MediaBrowser.Common/IApplicationHost.cs b/MediaBrowser.Common/IApplicationHost.cs index 2248e9c859..c8da100f64 100644 --- a/MediaBrowser.Common/IApplicationHost.cs +++ b/MediaBrowser.Common/IApplicationHost.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; using MediaBrowser.Common.Plugins; -using MediaBrowser.Model.Events; using MediaBrowser.Model.Updates; using Microsoft.Extensions.DependencyInjection; @@ -31,6 +30,10 @@ namespace MediaBrowser.Common /// true if this instance has pending kernel reload; otherwise, false. bool HasPendingRestart { get; } + /// + /// Gets or sets a value indicating whether this instance is currently shutting down. + /// + /// true if this instance is shutting down; otherwise, false. bool IsShuttingDown { get; } /// @@ -39,6 +42,12 @@ namespace MediaBrowser.Common /// true if this instance can self restart; otherwise, false. bool CanSelfRestart { get; } + /// + /// Get the version class of the system. + /// + /// or . + PackageVersionClass SystemUpdateLevel { get; } + /// /// Occurs when [has pending restart changed]. /// @@ -115,7 +124,5 @@ namespace MediaBrowser.Common /// The type. /// System.Object. object CreateInstance(Type type); - - PackageVersionClass SystemUpdateLevel { get; } } } diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj index 1a40f5ea2f..cf3f6c2a44 100644 --- a/MediaBrowser.Common/MediaBrowser.Common.csproj +++ b/MediaBrowser.Common/MediaBrowser.Common.csproj @@ -24,6 +24,7 @@ netstandard2.0 false true + true diff --git a/MediaBrowser.Common/Net/CustomHeaderNames.cs b/MediaBrowser.Common/Net/CustomHeaderNames.cs index bda897ed93..5ca9897eb4 100644 --- a/MediaBrowser.Common/Net/CustomHeaderNames.cs +++ b/MediaBrowser.Common/Net/CustomHeaderNames.cs @@ -1,3 +1,5 @@ +#pragma warning disable CS1591 + namespace MediaBrowser.Common.Net { public static class CustomHeaderNames diff --git a/MediaBrowser.Common/Net/HttpRequestOptions.cs b/MediaBrowser.Common/Net/HttpRequestOptions.cs index 94b972a026..18c4b181f5 100644 --- a/MediaBrowser.Common/Net/HttpRequestOptions.cs +++ b/MediaBrowser.Common/Net/HttpRequestOptions.cs @@ -1,3 +1,5 @@ +#pragma warning disable CS1591 + using System; using System.Collections.Generic; using System.Threading; diff --git a/MediaBrowser.Common/Net/HttpResponseInfo.cs b/MediaBrowser.Common/Net/HttpResponseInfo.cs index d65ce897ab..0de034b0ee 100644 --- a/MediaBrowser.Common/Net/HttpResponseInfo.cs +++ b/MediaBrowser.Common/Net/HttpResponseInfo.cs @@ -1,3 +1,5 @@ +#pragma warning disable CS1591 + using System; using System.IO; using System.Net; @@ -69,6 +71,7 @@ namespace MediaBrowser.Common.Net ContentHeaders = contentHeader; } + /// public void Dispose() { // Only IDisposable for backwards compatibility diff --git a/MediaBrowser.Common/Net/IHttpClient.cs b/MediaBrowser.Common/Net/IHttpClient.cs index d84a4d664c..23ba341738 100644 --- a/MediaBrowser.Common/Net/IHttpClient.cs +++ b/MediaBrowser.Common/Net/IHttpClient.cs @@ -1,3 +1,4 @@ +using System; using System.IO; using System.Threading.Tasks; using System.Net.Http; @@ -25,12 +26,13 @@ namespace MediaBrowser.Common.Net /// /// Warning: Deprecated function, - /// use 'Task SendAsync(HttpRequestOptions options, HttpMethod httpMethod);' instead + /// use 'Task{HttpResponseInfo} SendAsync(HttpRequestOptions options, HttpMethod httpMethod);' instead /// Sends the asynchronous. /// /// The options. /// The HTTP method. /// Task{HttpResponseInfo}. + [Obsolete("Use 'Task{HttpResponseInfo} SendAsync(HttpRequestOptions options, HttpMethod httpMethod);' instead")] Task SendAsync(HttpRequestOptions options, string httpMethod); /// diff --git a/MediaBrowser.Common/Net/INetworkManager.cs b/MediaBrowser.Common/Net/INetworkManager.cs index 1df74d9955..97504a471f 100644 --- a/MediaBrowser.Common/Net/INetworkManager.cs +++ b/MediaBrowser.Common/Net/INetworkManager.cs @@ -1,3 +1,5 @@ +#pragma warning disable CS1591 + using System; using System.Collections.Generic; using System.Net; diff --git a/MediaBrowser.Common/Plugins/BasePlugin.cs b/MediaBrowser.Common/Plugins/BasePlugin.cs index 1ff2e98ef7..6ef891d66e 100644 --- a/MediaBrowser.Common/Plugins/BasePlugin.cs +++ b/MediaBrowser.Common/Plugins/BasePlugin.cs @@ -1,3 +1,5 @@ +#pragma warning disable CS1591 + using System; using System.IO; using MediaBrowser.Common.Configuration; diff --git a/MediaBrowser.Common/Plugins/IPlugin.cs b/MediaBrowser.Common/Plugins/IPlugin.cs index 32527c2997..7bd90c964b 100644 --- a/MediaBrowser.Common/Plugins/IPlugin.cs +++ b/MediaBrowser.Common/Plugins/IPlugin.cs @@ -1,3 +1,5 @@ +#pragma warning disable CS1591 + using System; using MediaBrowser.Model.Plugins; diff --git a/MediaBrowser.Common/Progress/ActionableProgress.cs b/MediaBrowser.Common/Progress/ActionableProgress.cs index 9fe01931f5..af69055aa9 100644 --- a/MediaBrowser.Common/Progress/ActionableProgress.cs +++ b/MediaBrowser.Common/Progress/ActionableProgress.cs @@ -1,3 +1,5 @@ +#pragma warning disable CS1591 + using System; namespace MediaBrowser.Common.Progress @@ -25,16 +27,9 @@ namespace MediaBrowser.Common.Progress public void Report(T value) { - if (ProgressChanged != null) - { - ProgressChanged(this, value); - } + ProgressChanged?.Invoke(this, value); - var action = _action; - if (action != null) - { - action(value); - } + _action?.Invoke(value); } } @@ -44,10 +39,7 @@ namespace MediaBrowser.Common.Progress public void Report(T value) { - if (ProgressChanged != null) - { - ProgressChanged(this, value); - } + ProgressChanged?.Invoke(this, value); } } } diff --git a/MediaBrowser.Common/Providers/SubtitleConfigurationFactory.cs b/MediaBrowser.Common/Providers/SubtitleConfigurationFactory.cs index 09d974db6c..0445397ad8 100644 --- a/MediaBrowser.Common/Providers/SubtitleConfigurationFactory.cs +++ b/MediaBrowser.Common/Providers/SubtitleConfigurationFactory.cs @@ -1,3 +1,5 @@ +#pragma warning disable CS1591 + using System.Collections.Generic; using MediaBrowser.Common.Configuration; using MediaBrowser.Model.Providers; @@ -6,6 +8,7 @@ namespace MediaBrowser.Common.Providers { public class SubtitleConfigurationFactory : IConfigurationFactory { + /// public IEnumerable GetConfigurations() { yield return new ConfigurationStore() diff --git a/MediaBrowser.Common/System/OperatingSystem.cs b/MediaBrowser.Common/System/OperatingSystem.cs index 640821d4d7..7d38ddb6e5 100644 --- a/MediaBrowser.Common/System/OperatingSystem.cs +++ b/MediaBrowser.Common/System/OperatingSystem.cs @@ -1,3 +1,5 @@ +#pragma warning disable CS1591 + using System; using System.Runtime.InteropServices; using System.Threading; diff --git a/MediaBrowser.Common/Updates/IInstallationManager.cs b/MediaBrowser.Common/Updates/IInstallationManager.cs index 88ac7e473c..b3367f71d0 100644 --- a/MediaBrowser.Common/Updates/IInstallationManager.cs +++ b/MediaBrowser.Common/Updates/IInstallationManager.cs @@ -1,3 +1,5 @@ +#pragma warning disable CS1591 + using System; using System.Collections.Generic; using System.Threading; diff --git a/MediaBrowser.Common/Updates/InstallationEventArgs.cs b/MediaBrowser.Common/Updates/InstallationEventArgs.cs index 9f215e8890..36e124ddfc 100644 --- a/MediaBrowser.Common/Updates/InstallationEventArgs.cs +++ b/MediaBrowser.Common/Updates/InstallationEventArgs.cs @@ -1,3 +1,5 @@ +#pragma warning disable CS1591 + using MediaBrowser.Model.Updates; namespace MediaBrowser.Common.Updates diff --git a/MediaBrowser.Common/Updates/InstallationFailedEventArgs.cs b/MediaBrowser.Common/Updates/InstallationFailedEventArgs.cs index 43adfb02d9..46f10c84fd 100644 --- a/MediaBrowser.Common/Updates/InstallationFailedEventArgs.cs +++ b/MediaBrowser.Common/Updates/InstallationFailedEventArgs.cs @@ -1,3 +1,5 @@ +#pragma warning disable CS1591 + using System; namespace MediaBrowser.Common.Updates