Update ruleset and fix build

This commit is contained in:
Cody Robibero 2021-11-19 07:28:02 -07:00
parent 9954bfd131
commit ca052e9686
6 changed files with 130 additions and 94 deletions

View File

@ -55,7 +55,7 @@ namespace Jellyfin.Plugin.TvMaze.Providers
{
try
{
_logger.LogDebug("[GetImages] {name}", item.Name);
_logger.LogDebug("[GetImages] {Name}", item.Name);
var episode = (Episode)item;
var series = episode.Series;
if (series == null)
@ -96,7 +96,7 @@ namespace Jellyfin.Plugin.TvMaze.Providers
});
}
_logger.LogInformation("[GetImages] Images found for {name}: {@images}", item.Name, imageResults);
_logger.LogInformation("[GetImages] Images found for {Name}: {@Images}", item.Name, imageResults);
return imageResults;
}
catch (Exception e)

View File

@ -43,7 +43,7 @@ namespace Jellyfin.Plugin.TvMaze.Providers
{
try
{
_logger.LogDebug("[GetSearchResults] Starting for {name} {seasonNumber}x{episodeNumber}", searchInfo.Name, searchInfo.ParentIndexNumber, searchInfo.IndexNumber);
_logger.LogDebug("[GetSearchResults] Starting for {Name} {SeasonNumber}x{EpisodeNumber}", searchInfo.Name, searchInfo.ParentIndexNumber, searchInfo.IndexNumber);
var results = new List<RemoteSearchResult>();
var tvMazeId = TvHelpers.GetTvMazeId(searchInfo.SeriesProviderIds);
@ -69,7 +69,7 @@ namespace Jellyfin.Plugin.TvMaze.Providers
});
}
_logger.LogDebug("[GetSearchResults] Results for {name}: {@episode}", searchInfo.Name, results);
_logger.LogDebug("[GetSearchResults] Results for {Name}: {@Episode}", searchInfo.Name, results);
return results;
}
catch (Exception e)
@ -85,7 +85,7 @@ namespace Jellyfin.Plugin.TvMaze.Providers
var result = new MetadataResult<Episode>();
try
{
_logger.LogDebug("[GetMetadata] Starting for {name}", info.Name);
_logger.LogDebug("[GetMetadata] Starting for {Name}", info.Name);
var episode = await GetMetadataInternal(info).ConfigureAwait(false);
if (episode != null)
{

View File

@ -70,7 +70,7 @@ namespace Jellyfin.Plugin.TvMaze.Providers
}
var imageResults = await GetSeasonImagesInternal(series, season.IndexNumber.Value).ConfigureAwait(false);
_logger.LogInformation("[GetImages] Images found for {name}: {@images}", item.Name, imageResults);
_logger.LogInformation("[GetImages] Images found for {Name}: {@Images}", item.Name, imageResults);
return imageResults;
}
catch (Exception e)

View File

@ -58,7 +58,7 @@ namespace Jellyfin.Plugin.TvMaze.Providers
{
try
{
_logger.LogDebug("[GetImages] {name}", item.Name);
_logger.LogDebug("[GetImages] {Name}", item.Name);
var series = (Series)item;
var tvMazeId = TvHelpers.GetTvMazeId(series.ProviderIds);
if (tvMazeId == null)
@ -72,7 +72,7 @@ namespace Jellyfin.Plugin.TvMaze.Providers
var images = await tvMazeClient.Shows.GetShowImagesAsync(tvMazeId.Value).ConfigureAwait(false);
if (images == null)
{
_logger.LogDebug("[GetImages] No images found.");
_logger.LogDebug("[GetImages] No images found");
return Enumerable.Empty<RemoteImageInfo>();
}
@ -92,7 +92,7 @@ namespace Jellyfin.Plugin.TvMaze.Providers
}
}
_logger.LogInformation("[GetImages] Images found for {name}: {@images}", item.Name, imageResults);
_logger.LogInformation("[GetImages] Images found for {Name}: {@Images}", item.Name, imageResults);
return imageResults;
}
catch (Exception e)

View File

@ -52,14 +52,14 @@ namespace Jellyfin.Plugin.TvMaze.Providers
{
try
{
_logger.LogDebug("[GetSearchResults] Starting for {name}", searchInfo.Name);
_logger.LogDebug("[GetSearchResults] Starting for {Name}", searchInfo.Name);
var tvMazeClient = new TvMazeClient(_httpClientFactory.CreateClient(NamedClient.Default), new RetryRateLimitingStrategy());
var showSearchResults = (await tvMazeClient.Search.ShowSearchAsync(searchInfo.Name?.Trim()).ConfigureAwait(false)).ToList();
_logger.LogDebug("[GetSearchResults] Result count for {name}: {count}", searchInfo.Name, showSearchResults.Count);
_logger.LogDebug("[GetSearchResults] Result count for {Name}: {Count}", searchInfo.Name, showSearchResults.Count);
var searchResults = new List<RemoteSearchResult>();
foreach (var show in showSearchResults)
{
_logger.LogDebug("[GetSearchResults] Result for {name}: {@show}", searchInfo.Name, show);
_logger.LogDebug("[GetSearchResults] Result for {Name}: {@Show}", searchInfo.Name, show);
var searchResult = new RemoteSearchResult
{
Name = show.Show.Name,
@ -77,12 +77,12 @@ namespace Jellyfin.Plugin.TvMaze.Providers
searchResults.Add(searchResult);
}
_logger.LogDebug("[GetSearchResults] Result for {name}: {@series}", searchInfo.Name, searchResults);
_logger.LogDebug("[GetSearchResults] Result for {Name}: {@Series}", searchInfo.Name, searchResults);
return searchResults;
}
catch (Exception e)
{
_logger.LogWarning(e, "[GetSearchResults] Error searching for {name}", searchInfo.Name);
_logger.LogWarning(e, "[GetSearchResults] Error searching for {Name}", searchInfo.Name);
return Enumerable.Empty<RemoteSearchResult>();
}
}
@ -92,7 +92,7 @@ namespace Jellyfin.Plugin.TvMaze.Providers
{
try
{
_logger.LogDebug("[GetMetadata] Starting for {name}", info.Name);
_logger.LogDebug("[GetMetadata] Starting for {Name}", info.Name);
var tvMazeClient = new TvMazeClient(_httpClientFactory.CreateClient(NamedClient.Default), new RetryRateLimitingStrategy());
var result = new MetadataResult<Series>();
@ -133,14 +133,14 @@ namespace Jellyfin.Plugin.TvMaze.Providers
{
// Series still not found, search by name.
var parsedName = _libraryManager.ParseName(info.Name);
_logger.LogDebug("[GetMetadata] No TVMaze Id, searching by parsed name: {@name}", parsedName);
_logger.LogDebug("[GetMetadata] No TVMaze Id, searching by parsed name: {@Name}", parsedName);
tvMazeShow = await GetIdentifyShow(parsedName, tvMazeClient).ConfigureAwait(false);
}
if (tvMazeShow == null)
{
// Invalid TVMaze id.
_logger.LogDebug("[GetMetadata] No TVMaze result found for {name}", info.Name);
_logger.LogDebug("[GetMetadata] No TVMaze result found for {Name}", info.Name);
return result;
}

View File

@ -1,82 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Rules for Jellyfin" Description="Code analysis rules for Jellyfin" ToolsVersion="14.0">
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<!-- disable warning SA1202: 'public' members must come before 'private' members -->
<Rule Id="SA1202" Action="Info" />
<!-- disable warning SA1204: Static members must appear before non-static members -->
<Rule Id="SA1204" Action="Info" />
<!-- disable warning SA1404: Code analysis suppression should have justification -->
<Rule Id="SA1404" Action="Info" />
<RuleSet Name="Rules for Jellyfin.Server" Description="Code analysis rules for Jellyfin.Server.csproj" ToolsVersion="14.0">
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<!-- disable warning SA1009: Closing parenthesis should be followed by a space. -->
<Rule Id="SA1009" Action="None" />
<!-- disable warning SA1011: Closing square bracket should be followed by a space. -->
<Rule Id="SA1011" Action="None" />
<!-- disable warning SA1101: Prefix local calls with 'this.' -->
<Rule Id="SA1101" Action="None" />
<!-- disable warning SA1108: Block statements should not contain embedded comments -->
<Rule Id="SA1108" Action="None" />
<!-- disable warning SA1118: Parameter must not span multiple lines. -->
<Rule Id="SA1118" Action="None" />
<!-- disable warning SA1128:: Put constructor initializers on their own line -->
<Rule Id="SA1128" Action="None" />
<!-- disable warning SA1130: Use lambda syntax -->
<Rule Id="SA1130" Action="None" />
<!-- disable warning SA1200: 'using' directive must appear within a namespace declaration -->
<Rule Id="SA1200" Action="None" />
<!-- disable warning SA1202: 'public' members must come before 'private' members -->
<Rule Id="SA1202" Action="None" />
<!-- disable warning SA1204: Static members must appear before non-static members -->
<Rule Id="SA1204" Action="None" />
<!-- disable warning SA1309: Fields must not begin with an underscore -->
<Rule Id="SA1309" Action="None" />
<!-- disable warning SA1413: Use trailing comma in multi-line initializers -->
<Rule Id="SA1413" Action="None" />
<!-- disable warning SA1512: Single-line comments must not be followed by blank line -->
<Rule Id="SA1512" Action="None" />
<!-- disable warning SA1515: Single-line comment should be preceded by blank line -->
<Rule Id="SA1515" Action="None" />
<!-- disable warning SA1600: Elements should be documented -->
<Rule Id="SA1600" Action="None" />
<!-- disable warning SA1602: Enumeration items should be documented -->
<Rule Id="SA1602" Action="None" />
<!-- disable warning SA1633: The file header is missing or not located at the top of the file -->
<Rule Id="SA1633" Action="None" />
</Rules>
<!-- disable warning SA1009: Closing parenthesis should be followed by a space. -->
<Rule Id="SA1009" Action="None" />
<!-- disable warning SA1011: Closing square bracket should be followed by a space. -->
<Rule Id="SA1011" Action="None" />
<!-- disable warning SA1101: Prefix local calls with 'this.' -->
<Rule Id="SA1101" Action="None" />
<!-- disable warning SA1108: Block statements should not contain embedded comments -->
<Rule Id="SA1108" Action="None" />
<!-- disable warning SA1128:: Put constructor initializers on their own line -->
<Rule Id="SA1128" Action="None" />
<!-- disable warning SA1130: Use lambda syntax -->
<Rule Id="SA1130" Action="None" />
<!-- disable warning SA1200: 'using' directive must appear within a namespace declaration -->
<Rule Id="SA1200" Action="None" />
<!-- disable warning SA1309: Fields must not begin with an underscore -->
<Rule Id="SA1309" Action="None" />
<!-- disable warning SA1413: Use trailing comma in multi-line initializers -->
<Rule Id="SA1413" Action="None" />
<!-- disable warning SA1512: Single-line comments must not be followed by blank line -->
<Rule Id="SA1512" Action="None" />
<!-- disable warning SA1515: Single-line comment should be preceded by blank line -->
<Rule Id="SA1515" Action="None" />
<!-- disable warning SA1600: Elements should be documented -->
<Rule Id="SA1600" Action="None" />
<!-- disable warning SA1602: Enumeration items should be documented -->
<Rule Id="SA1602" Action="None" />
<!-- disable warning SA1633: The file header is missing or not located at the top of the file -->
<Rule Id="SA1633" Action="None" />
</Rules>
<Rules AnalyzerId="Microsoft.CodeAnalysis.NetAnalyzers" RuleNamespace="Microsoft.Design">
<!-- error on CA1063: Implement IDisposable correctly -->
<Rule Id="CA1063" Action="Error" />
<!-- error on CA1305: Specify IFormatProvider -->
<Rule Id="CA1305" Action="Error" />
<!-- error on CA1307: Specify StringComparison for clarity -->
<Rule Id="CA1307" Action="Error" />
<!-- error on CA1309: Use ordinal StringComparison -->
<Rule Id="CA1309" Action="Error" />
<!-- error on CA1725: Parameter names should match base declaration -->
<Rule Id="CA1725" Action="Error" />
<!-- error on CA1725: Call async methods when in an async method -->
<Rule Id="CA1727" Action="Error" />
<!-- error on CA1813: Avoid unsealed attributes -->
<Rule Id="CA1813" Action="Error" />
<!-- error on CA1843: Do not use 'WaitAll' with a single task -->
<Rule Id="CA1843" Action="Error" />
<!-- error on CA1845: Use span-based 'string.Concat' -->
<Rule Id="CA1845" Action="Error" />
<!-- error on CA2016: Forward the CancellationToken parameter to methods that take one
or pass in 'CancellationToken.None' explicitly to indicate intentionally not propagating the token -->
<Rule Id="CA2016" Action="Error" />
<!-- error on CA2254: Template should be a static expression -->
<Rule Id="CA2254" Action="Error" />
<Rules AnalyzerId="Microsoft.CodeAnalysis.NetAnalyzers" RuleNamespace="Microsoft.Design">
<!-- error on CA2016: Forward the CancellationToken parameter to methods that take one
or pass in 'CancellationToken.None' explicitly to indicate intentionally not propagating the token -->
<Rule Id="CA2016" Action="Error" />
<!-- disable warning CA1014: Mark assemblies with CLSCompliantAttribute -->
<Rule Id="CA1014" Action="Info" />
<!-- disable warning CA1024: Use properties where appropriate -->
<Rule Id="CA1024" Action="Info" />
<!-- disable warning CA1031: Do not catch general exception types -->
<Rule Id="CA1031" Action="Info" />
<!-- disable warning CA1032: Implement standard exception constructors -->
<Rule Id="CA1032" Action="Info" />
<!-- disable warning CA1040: Avoid empty interfaces -->
<Rule Id="CA1040" Action="Info" />
<!-- disable warning CA1062: Validate arguments of public methods -->
<Rule Id="CA1062" Action="Info" />
<!-- TODO: enable when false positives are fixed -->
<!-- disable warning CA1508: Avoid dead conditional code -->
<Rule Id="CA1508" Action="Info" />
<!-- disable warning CA1716: Identifiers should not match keywords -->
<Rule Id="CA1716" Action="Info" />
<!-- disable warning CA1720: Identifiers should not contain type names -->
<Rule Id="CA1720" Action="Info" />
<!-- disable warning CA1724: Type names should not match namespaces -->
<Rule Id="CA1724" Action="Info" />
<!-- disable warning CA1805: Do not initialize unnecessarily -->
<Rule Id="CA1805" Action="Info" />
<!-- disable warning CA1812: internal class that is apparently never instantiated.
If so, remove the code from the assembly.
If this class is intended to contain only static members, make it static -->
<Rule Id="CA1812" Action="Info" />
<!-- disable warning CA1822: Member does not access instance data and can be marked as static -->
<Rule Id="CA1822" Action="Info" />
<!-- disable warning CA2000: Dispose objects before losing scope -->
<Rule Id="CA2000" Action="Info" />
<!-- disable warning CA2253: Named placeholders should not be numeric values -->
<Rule Id="CA2253" Action="Info" />
<!-- disable warning CA5394: Do not use insecure randomness -->
<Rule Id="CA5394" Action="Info" />
<!-- disable warning CA1031: Do not catch general exception types -->
<Rule Id="CA1031" Action="Info" />
<!-- disable warning CA1032: Implement standard exception constructors -->
<Rule Id="CA1032" Action="Info" />
<!-- disable warning CA1062: Validate arguments of public methods -->
<Rule Id="CA1062" Action="Info" />
<!-- disable warning CA1716: Identifiers should not match keywords -->
<Rule Id="CA1716" Action="Info" />
<!-- disable warning CA1720: Identifiers should not contain type names -->
<Rule Id="CA1720" Action="Info" />
<!-- disable warning CA1805: Do not initialize unnecessarily -->
<Rule Id="CA1805" Action="Info" />
<!-- disable warning CA1812: internal class that is apparently never instantiated.
If so, remove the code from the assembly.
If this class is intended to contain only static members, make it static -->
<Rule Id="CA1812" Action="Info" />
<!-- disable warning CA1822: Member does not access instance data and can be marked as static -->
<Rule Id="CA1822" Action="Info" />
<!-- disable warning CA2000: Dispose objects before losing scope -->
<Rule Id="CA2000" Action="Info" />
<!-- disable warning CA5394: Do not use insecure randomness -->
<Rule Id="CA5394" Action="Info" />
<!-- disable warning CA1014: Mark assemblies with CLSCompliantAttribute -->
<Rule Id="CA1014" Action="Info" />
<!-- disable warning CA1054: Change the type of parameter url from string to System.Uri -->
<Rule Id="CA1054" Action="None" />
<!-- disable warning CA1055: URI return values should not be strings -->
<Rule Id="CA1055" Action="None" />
<!-- disable warning CA1056: URI properties should not be strings -->
<Rule Id="CA1056" Action="None" />
<!-- disable warning CA1303: Do not pass literals as localized parameters -->
<Rule Id="CA1303" Action="None" />
<!-- disable warning CA1308: Normalize strings to uppercase -->
<Rule Id="CA1308" Action="None" />
</Rules>
<!-- disable warning CA1054: Change the type of parameter url from string to System.Uri -->
<Rule Id="CA1054" Action="None" />
<!-- disable warning CA1055: URI return values should not be strings -->
<Rule Id="CA1055" Action="None" />
<!-- disable warning CA1056: URI properties should not be strings -->
<Rule Id="CA1056" Action="None" />
<!-- disable warning CA1303: Do not pass literals as localized parameters -->
<Rule Id="CA1303" Action="None" />
<!-- disable warning CA1308: Normalize strings to uppercase -->
<Rule Id="CA1308" Action="None" />
<!-- disable warning CA1848: Use the LoggerMessage delegates -->
<Rule Id="CA1848" Action="None" />
<!-- disable warning CA2101: Specify marshaling for P/Invoke string arguments -->
<Rule Id="CA2101" Action="None" />
<!-- disable warning CA2234: Pass System.Uri objects instead of strings -->
<Rule Id="CA2234" Action="None" />
</Rules>
</RuleSet>