Update StyleCop and address warnings

This commit is contained in:
TwistedUmbrellaX 2024-03-03 21:46:52 -05:00
parent 6365043ed8
commit 8e8a6207a5
6 changed files with 20 additions and 10 deletions

4
.gitignore vendored
View File

@ -5,3 +5,7 @@ BenchmarkDotNet.Artifacts/
# Ignore pre compiled web interface # Ignore pre compiled web interface
docker/dist docker/dist
# Visual Studio
.vs/
UpgradeLog*.htm

View File

@ -7,8 +7,8 @@ using System.Globalization;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading; using System.Threading;
using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using Microsoft.Extensions.Logging;
/// <summary> /// <summary>
/// Chapter name analyzer. /// Chapter name analyzer.

View File

@ -275,10 +275,10 @@ public class ChromaprintAnalyzer : IMediaFileAnalyzer
{ {
var modifiedPoint = (uint)(originalPoint + i); var modifiedPoint = (uint)(originalPoint + i);
if (rhsIndex.ContainsKey(modifiedPoint)) if (rhsIndex.TryGetValue(modifiedPoint, out var value))
{ {
var lhsFirst = (int)lhsIndex[originalPoint]; var lhsFirst = (int)lhsIndex[originalPoint];
var rhsFirst = (int)rhsIndex[modifiedPoint]; var rhsFirst = (int)value;
indexShifts.Add(rhsFirst - lhsFirst); indexShifts.Add(rhsFirst - lhsFirst);
} }
} }

View File

@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RootNamespace>ConfusedPolarBear.Plugin.IntroSkipper</RootNamespace> <RootNamespace>ConfusedPolarBear.Plugin.IntroSkipper</RootNamespace>
@ -11,15 +10,13 @@
<AnalysisMode>AllEnabledByDefault</AnalysisMode> <AnalysisMode>AllEnabledByDefault</AnalysisMode>
<CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Jellyfin.Controller" Version="10.8.*" /> <PackageReference Include="Jellyfin.Controller" Version="10.8.*" />
<PackageReference Include="Jellyfin.Model" Version="10.8.*" /> <PackageReference Include="Jellyfin.Model" Version="10.8.*" />
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.556" PrivateAssets="All" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Remove="Configuration\configPage.html" /> <None Remove="Configuration\configPage.html" />
<EmbeddedResource Include="Configuration\configPage.html" /> <EmbeddedResource Include="Configuration\configPage.html" />
@ -27,5 +24,4 @@
<EmbeddedResource Include="Configuration\inject.js" /> <EmbeddedResource Include="Configuration\inject.js" />
<EmbeddedResource Include="Configuration\version.txt" /> <EmbeddedResource Include="Configuration\version.txt" />
</ItemGroup> </ItemGroup>
</Project>
</Project>

View File

@ -0,0 +1,10 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649:File name should match first type name", Justification = "Legacy TODO", Scope = "type", Target = "~T:ConfusedPolarBear.Plugin.IntroSkipper.WarningManager")]
[assembly: SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "Legacy TODO", Scope = "type", Target = "~T:ConfusedPolarBear.Plugin.IntroSkipper.IntroWithMetadata")]
[assembly: SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "Legacy TODO", Scope = "type", Target = "~T:ConfusedPolarBear.Plugin.IntroSkipper.TimeRangeHelpers")]

View File

@ -331,7 +331,7 @@ public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
private void InjectSkipButton(string indexPath) private void InjectSkipButton(string indexPath)
{ {
// Parts of this code are based off of JellyScrub's script injection code. // Parts of this code are based off of JellyScrub's script injection code.
// https://github.com/nicknsy/jellyscrub/blob/4ce806f602988a662cfe3cdbaac35ee8046b7ec4/Nick.Plugin.Jellyscrub/JellyscrubPlugin.cs // https://github.com/nicknsy/jellyscrub/blob/main/Nick.Plugin.Jellyscrub/JellyscrubPlugin.cs#L38
_logger.LogDebug("Reading index.html from {Path}", indexPath); _logger.LogDebug("Reading index.html from {Path}", indexPath);
var contents = File.ReadAllText(indexPath); var contents = File.ReadAllText(indexPath);