Add code analyzers to Jellyfin.Naming.Tests and fix resulting warnings

This commit is contained in:
aled 2020-05-14 18:59:10 +01:00
parent 2849d2b134
commit 3ff6e3ff65
8 changed files with 18 additions and 46 deletions

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<!-- ProjectGuid is only included as a requirement for SonarQube analysis -->
<PropertyGroup>
@ -21,5 +21,15 @@
<ItemGroup>
<ProjectReference Include="..\..\Emby.Naming\Emby.Naming.csproj" />
</ItemGroup>
<!-- Code Analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<CodeAnalysisRuleSet>../jellyfin-tests.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
</Project>

View File

@ -6,8 +6,6 @@ namespace Jellyfin.Naming.Tests.TV
{
public class DailyEpisodeTests
{
[Theory]
[InlineData(@"/server/anything_1996.11.14.mp4", "anything", 1996, 11, 14)]
[InlineData(@"/server/anything_1996-11-14.mp4", "anything", 1996, 11, 14)]

View File

@ -6,7 +6,6 @@ namespace Jellyfin.Naming.Tests.TV
{
public class EpisodeNumberWithoutSeasonTests
{
[Theory]
[InlineData(8, @"The Simpsons/The Simpsons.S25E08.Steal this episode.mp4")]
[InlineData(2, @"The Simpsons/The Simpsons - 02 - Ep Name.avi")]

View File

@ -1,4 +1,4 @@
using Emby.Naming.Common;
using Emby.Naming.Common;
using Emby.Naming.TV;
using Xunit;
@ -35,7 +35,6 @@ namespace Jellyfin.Naming.Tests.TV
// TODO: [InlineData("Watchmen (2019)/Watchmen 1x03 [WEBDL-720p][EAC3 5.1][h264][-TBS] - She Was Killed by Space Junk.mkv", "Watchmen (2019)", 1, 3)]
// TODO: [InlineData("/The.Legend.of.Condor.Heroes.2017.V2.web-dl.1080p.h264.aac-hdctv/The.Legend.of.Condor.Heroes.2017.E07.V2.web-dl.1080p.h264.aac-hdctv.mkv", "The Legend of Condor Heroes 2017", 1, 7)]
public void ParseEpisodesCorrectly(string path, string name, int season, int episode)
{
NamingOptions o = new NamingOptions();
EpisodePathParser p = new EpisodePathParser(o);

View File

@ -28,7 +28,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Single(result);
@ -53,7 +52,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Single(result);
@ -76,7 +74,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Single(result);
@ -104,7 +101,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Equal(7, result.Count);
@ -134,7 +130,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Single(result);
@ -165,7 +160,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Equal(9, result.Count);
@ -192,7 +186,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Equal(5, result.Count);
@ -221,7 +214,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Equal(5, result.Count);
@ -251,7 +243,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Single(result);
@ -284,7 +275,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Single(result);
@ -311,7 +301,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Equal(2, result.Count);
@ -340,7 +329,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Single(result);
@ -372,7 +360,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Equal(5, result.Count);
@ -396,7 +383,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Single(result);
@ -422,7 +408,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Single(result);

View File

@ -368,11 +368,11 @@ namespace Jellyfin.Naming.Tests.Video
{
var files = new[]
{
new FileSystemMetadata{FullName = "Bad Boys (2006) part1.mkv", IsDirectory = false},
new FileSystemMetadata{FullName = "Bad Boys (2006) part2.mkv", IsDirectory = false},
new FileSystemMetadata{FullName = "300 (2006) part2", IsDirectory = true},
new FileSystemMetadata{FullName = "300 (2006) part3", IsDirectory = true},
new FileSystemMetadata{FullName = "300 (2006) part1", IsDirectory = true}
new FileSystemMetadata { FullName = "Bad Boys (2006) part1.mkv", IsDirectory = false },
new FileSystemMetadata { FullName = "Bad Boys (2006) part2.mkv", IsDirectory = false },
new FileSystemMetadata { FullName = "300 (2006) part2", IsDirectory = true },
new FileSystemMetadata { FullName = "300 (2006) part3", IsDirectory = true },
new FileSystemMetadata { FullName = "300 (2006) part1", IsDirectory = true }
};
var resolver = GetResolver();

View File

@ -9,6 +9,7 @@ namespace Jellyfin.Naming.Tests.Video
public class VideoListResolverTests
{
private readonly NamingOptions _namingOptions = new NamingOptions();
// FIXME
// [Fact]
private void TestStackAndExtras()
@ -45,7 +46,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Equal(5, result.Count);
@ -74,7 +74,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Single(result);
@ -95,7 +94,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Single(result);
@ -116,7 +114,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Single(result);
@ -138,7 +135,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Single(result);
@ -159,7 +155,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Single(result);
@ -184,7 +179,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Equal(5, result.Count);
@ -205,7 +199,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = true,
FullName = i
}).ToList()).ToList();
Assert.Single(result);
@ -227,7 +220,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = true,
FullName = i
}).ToList()).ToList();
Assert.Equal(2, result.Count);
@ -249,7 +241,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Single(result);
@ -271,7 +262,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Single(result);
@ -294,7 +284,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Single(result);
@ -317,7 +306,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Equal(2, result.Count);
@ -337,7 +325,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Single(result);
@ -357,7 +344,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Single(result);
@ -378,7 +364,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Single(result);
@ -399,7 +384,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Single(result);
@ -422,7 +406,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Equal(4, result.Count);
@ -443,7 +426,6 @@ namespace Jellyfin.Naming.Tests.Video
{
IsDirectory = false,
FullName = i
}).ToList()).ToList();
Assert.Single(result);

View File

@ -176,7 +176,6 @@ namespace Jellyfin.Naming.Tests.Video
};
}
[Theory]
[MemberData(nameof(GetResolveFileTestData))]
public void ResolveFile_ValidFileName_Success(VideoFileInfo expectedResult)