Enable `TreatWarningsAsErrors` for MediaBrowser.Common and Emby.Photos

Adds `#pragma warning disable CS1591` to all files in
MediaBrowser.Common containing undocumented members.
pull/1871/head
Bond_009 5 years ago
parent d8d2e52e3f
commit 9d4ce82ab9

@ -17,6 +17,18 @@
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<!-- Code analysers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.4" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" />
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
</Project>

@ -17,39 +17,50 @@ using TagLib.IFD.Tags;
namespace Emby.Photos
{
/// <summary>
/// Metadata provider for photos.
/// </summary>
public class PhotoProvider : ICustomMetadataProvider<Photo>, 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" };
public PhotoProvider(ILogger logger, IImageProcessor imageProcessor)
private readonly string[] _includeExtensions = new string[] { ".jpg", ".jpeg", ".png", ".tiff", ".cr2" };
/// <summary>
/// Initializes a new instance of the <see cref="PhotoProvider" /> class.
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="imageProcessor">The image processor.</param>
public PhotoProvider(ILogger<PhotoProvider> logger, IImageProcessor imageProcessor)
{
_logger = logger;
_imageProcessor = imageProcessor;
}
/// <inheritdoc />
public string Name => "Embedded Information";
/// <inheritdoc />
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;
}
/// <inheritdoc />
public Task<ItemUpdateType> 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;

@ -59,10 +59,7 @@ namespace Emby.Server.Implementations.AppBase
private set => _dataPath = Directory.CreateDirectory(value).FullName;
}
/// <summary>
/// Gets the magic string used for virtual path manipulation.
/// </summary>
/// <value>The magic string used for virtual path manipulation.</value>
/// <inheritdoc />
public string VirtualDataPath { get; } = "%AppDataPath%";
/// <summary>

@ -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
{
/// <summary>
/// Class CompositionRoot
/// Class CompositionRoot.
/// </summary>
public abstract class ApplicationHost : IServerApplicationHost, IDisposable
{
@ -166,6 +167,7 @@ namespace Emby.Server.Implementations
/// <value><c>true</c> if this instance has pending application restart; otherwise, <c>false</c>.</value>
public bool HasPendingRestart { get; private set; }
/// <inheritdoc />
public bool IsShuttingDown { get; private set; }
/// <summary>
@ -217,6 +219,7 @@ namespace Emby.Server.Implementations
public IFileSystem FileSystemManager { get; set; }
/// <inheritdoc />
public PackageVersionClass SystemUpdateLevel
{
get

@ -1,3 +1,5 @@
#pragma warning disable CS1591
using System;
namespace MediaBrowser.Common.Configuration
@ -9,6 +11,7 @@ namespace MediaBrowser.Common.Configuration
/// </summary>
/// <value>The key.</value>
public string Key { get; set; }
/// <summary>
/// Gets or sets the new configuration.
/// </summary>

@ -77,7 +77,10 @@ namespace MediaBrowser.Common.Configuration
/// <value>The temp directory.</value>
string TempDirectory { get; }
/// <summary>
/// Gets the magic string used for virtual path manipulation.
/// </summary>
/// <value>The magic string used for virtual path manipulation.</value>
string VirtualDataPath { get; }
}
}

@ -1,3 +1,5 @@
#pragma warning disable CS1591
using System;
using System.Collections.Generic;

@ -1,3 +1,5 @@
#pragma warning disable CS1591
using System;
using System.Collections.Generic;
using MediaBrowser.Model.Configuration;

@ -1,3 +1,5 @@
#pragma warning disable CS1591
using System;
using System.Collections.Generic;
using System.IO;

@ -1,3 +1,5 @@
#pragma warning disable CS1591
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;

@ -1,3 +1,5 @@
#pragma warning disable CS1591
using System.Collections.Generic;
namespace MediaBrowser.Common.Extensions

@ -1,3 +1,5 @@
#pragma warning disable CS1591
using System;
namespace MediaBrowser.Common.Extensions

@ -1,3 +1,5 @@
#pragma warning disable CS1591
using System;
using System.Globalization;

@ -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
/// <value><c>true</c> if this instance has pending kernel reload; otherwise, <c>false</c>.</value>
bool HasPendingRestart { get; }
/// <summary>
/// Gets or sets a value indicating whether this instance is currently shutting down.
/// </summary>
/// <value><c>true</c> if this instance is shutting down; otherwise, <c>false</c>.</value>
bool IsShuttingDown { get; }
/// <summary>
@ -39,6 +42,12 @@ namespace MediaBrowser.Common
/// <value><c>true</c> if this instance can self restart; otherwise, <c>false</c>.</value>
bool CanSelfRestart { get; }
/// <summary>
/// Get the version class of the system.
/// </summary>
/// <value><see cref="PackageVersionClass.Release" /> or <see cref="PackageVersionClass.Beta" />.</value>
PackageVersionClass SystemUpdateLevel { get; }
/// <summary>
/// Occurs when [has pending restart changed].
/// </summary>
@ -115,7 +124,5 @@ namespace MediaBrowser.Common
/// <param name="type">The type.</param>
/// <returns>System.Object.</returns>
object CreateInstance(Type type);
PackageVersionClass SystemUpdateLevel { get; }
}
}

@ -24,6 +24,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup>

@ -1,3 +1,5 @@
#pragma warning disable CS1591
namespace MediaBrowser.Common.Net
{
public static class CustomHeaderNames

@ -1,3 +1,5 @@
#pragma warning disable CS1591
using System;
using System.Collections.Generic;
using System.Threading;

@ -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;
}
/// <inheritdoc />
public void Dispose()
{
// Only IDisposable for backwards compatibility

@ -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
/// <summary>
/// Warning: Deprecated function,
/// use 'Task<HttpResponseInfo> SendAsync(HttpRequestOptions options, HttpMethod httpMethod);' instead
/// use 'Task{HttpResponseInfo} SendAsync(HttpRequestOptions options, HttpMethod httpMethod);' instead
/// Sends the asynchronous.
/// </summary>
/// <param name="options">The options.</param>
/// <param name="httpMethod">The HTTP method.</param>
/// <returns>Task{HttpResponseInfo}.</returns>
[Obsolete("Use 'Task{HttpResponseInfo} SendAsync(HttpRequestOptions options, HttpMethod httpMethod);' instead")]
Task<HttpResponseInfo> SendAsync(HttpRequestOptions options, string httpMethod);
/// <summary>

@ -1,3 +1,5 @@
#pragma warning disable CS1591
using System;
using System.Collections.Generic;
using System.Net;

@ -1,3 +1,5 @@
#pragma warning disable CS1591
using System;
using System.IO;
using MediaBrowser.Common.Configuration;

@ -1,3 +1,5 @@
#pragma warning disable CS1591
using System;
using MediaBrowser.Model.Plugins;

@ -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);
}
}
}

@ -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
{
/// <inheritdoc />
public IEnumerable<ConfigurationStore> GetConfigurations()
{
yield return new ConfigurationStore()

@ -1,3 +1,5 @@
#pragma warning disable CS1591
using System;
using System.Runtime.InteropServices;
using System.Threading;

@ -1,3 +1,5 @@
#pragma warning disable CS1591
using System;
using System.Collections.Generic;
using System.Threading;

@ -1,3 +1,5 @@
#pragma warning disable CS1591
using MediaBrowser.Model.Updates;
namespace MediaBrowser.Common.Updates

@ -1,3 +1,5 @@
#pragma warning disable CS1591
using System;
namespace MediaBrowser.Common.Updates

Loading…
Cancel
Save