update analyzers

This commit is contained in:
h1dden-da3m0n 2021-04-06 21:44:20 +02:00
parent 1050ca9fc8
commit fc26bcc17d
6 changed files with 59 additions and 46 deletions

View File

@ -20,7 +20,7 @@ max_line_length = 9999
indent_size = 2
# XML indentation
[*.{csproj,xml}]
[*.{csproj,xml,ruleset}]
indent_size = 2
###############################

View File

@ -1,38 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<FileVersion>4.0.0.0</FileVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<FileVersion>4.0.0.0</FileVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Nullable>enable</Nullable>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
<CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<None Remove="Configuration\config.html" />
<EmbeddedResource Include="Configuration\config.html" />
</ItemGroup>
<ItemGroup>
<None Remove="Configuration\config.html"/>
<EmbeddedResource Include="Configuration\config.html"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Jellyfin.Data" Version="10.*-*" />
<PackageReference Include="Jellyfin.Controller" Version="10.*-*" />
<PackageReference Include="Jellyfin.Common" Version="10.*-*" />
<PackageReference Include="Jellyfin.Model" Version="10.*-*" />
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
<PackageReference Include="TvDbSharper" Version="3.2.2" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Jellyfin.Data" Version="10.*-*"/>
<PackageReference Include="Jellyfin.Controller" Version="10.*-*"/>
<PackageReference Include="Jellyfin.Common" Version="10.*-*"/>
<PackageReference Include="Jellyfin.Model" Version="10.*-*"/>
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0"/>
<PackageReference Include="TvDbSharper" Version="3.2.2"/>
</ItemGroup>
<!-- Code Analyzers-->
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8" PrivateAssets="All" />
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup>
<PropertyGroup>
<CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<!-- Code Analyzers-->
<ItemGroup>
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All"/>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All"/>
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All"/>
</ItemGroup>
</Project>

View File

@ -78,21 +78,21 @@ namespace Jellyfin.Plugin.Tvdb.Providers
}
/// <inheritdoc />
public async Task<MetadataResult<Episode>> GetMetadata(EpisodeInfo searchInfo, CancellationToken cancellationToken)
public async Task<MetadataResult<Episode>> GetMetadata(EpisodeInfo info, CancellationToken cancellationToken)
{
var result = new MetadataResult<Episode>
{
QueriedById = true
};
if (TvdbSeriesProvider.IsValidSeries(searchInfo.SeriesProviderIds) &&
(searchInfo.IndexNumber.HasValue || searchInfo.PremiereDate.HasValue))
if (TvdbSeriesProvider.IsValidSeries(info.SeriesProviderIds) &&
(info.IndexNumber.HasValue || info.PremiereDate.HasValue))
{
result = await GetEpisode(searchInfo, cancellationToken).ConfigureAwait(false);
result = await GetEpisode(info, cancellationToken).ConfigureAwait(false);
}
else
{
_logger.LogDebug("No series identity found for {EpisodeName}", searchInfo.Name);
_logger.LogDebug("No series identity found for {EpisodeName}", info.Name);
}
return result;
@ -228,9 +228,9 @@ namespace Jellyfin.Plugin.Tvdb.Providers
for (var j = i + 1; j < episode.GuestStars.Length; ++j)
{
var currentRole = episode.GuestStars[j];
var roleEndIndex = currentRole.IndexOf(')', StringComparison.Ordinal);
var roleEndIndex = currentRole.Contains(')', StringComparison.Ordinal);
if (roleEndIndex == -1)
if (!roleEndIndex)
{
roles.Add(currentRole);
continue;

View File

@ -61,27 +61,27 @@ namespace Jellyfin.Plugin.Tvdb.Providers
}
/// <inheritdoc />
public async Task<MetadataResult<Series>> GetMetadata(SeriesInfo itemId, CancellationToken cancellationToken)
public async Task<MetadataResult<Series>> GetMetadata(SeriesInfo info, CancellationToken cancellationToken)
{
var result = new MetadataResult<Series>
{
QueriedById = true
};
if (!IsValidSeries(itemId.ProviderIds))
if (!IsValidSeries(info.ProviderIds))
{
result.QueriedById = false;
await Identify(itemId).ConfigureAwait(false);
await Identify(info).ConfigureAwait(false);
}
cancellationToken.ThrowIfCancellationRequested();
if (IsValidSeries(itemId.ProviderIds))
if (IsValidSeries(info.ProviderIds))
{
result.Item = new Series();
result.HasMetadata = true;
await FetchSeriesMetadata(result, itemId.MetadataLanguage, itemId.ProviderIds, cancellationToken)
await FetchSeriesMetadata(result, info.MetadataLanguage, info.ProviderIds, cancellationToken)
.ConfigureAwait(false);
}

View File

@ -1,6 +1,7 @@
---
name: "TheTVDB"
guid: "a677c0da-fac5-4cde-941a-7134223f14c8"
image: .media/jellyfin-plugin-tvdb.svg
version: "4.0.0.0"
targetAbi: "10.7.0.0"
framework: "net5.0"
@ -13,4 +14,4 @@ artifacts:
- "Jellyfin.Plugin.Tvdb.dll"
- "TvDbSharper.dll"
changelog: >
Fix getting metadata
Fix getting metadata

View File

@ -10,6 +10,8 @@
<!-- 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 -->
@ -30,11 +32,17 @@
<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.FxCopAnalyzers" RuleNamespace="Microsoft.Design">
<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 CA1031: Do not catch general exception types -->
<Rule Id="CA1031" Action="Info" />
<!-- disable warning CA1032: Implement standard exception constructors -->
@ -45,6 +53,8 @@
<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 -->
@ -53,7 +63,11 @@
<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 -->