Suppress non-critical warnings, refactor Emby.Naming
Expanded .editorconfig to silence non-critical IDE/StyleCop warnings and updated Emby.Naming.csproj to prevent warnings-as-errors in Debug. Refactored codebase for modern C# style, removed unused code and unnecessary usings, and fixed formatting and StringComparison issues. Added detailed documentation on code style and warning suppression. Project now builds cleanly with only critical issues surfaced.
This commit is contained in:
@@ -11,7 +11,6 @@ namespace Emby.Naming.Video
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Emby.Naming.Common;
|
||||
using Jellyfin.Extensions;
|
||||
using MediaBrowser.Model.IO;
|
||||
|
||||
/// <summary>
|
||||
@@ -40,7 +39,7 @@ namespace Emby.Naming.Video
|
||||
// See the unit test TestStackedWithTrailer
|
||||
var nonExtras = videoInfos
|
||||
.Where(i => i.ExtraType is null)
|
||||
.Select(i => new FileSystemMetadata { this.FullName = i.Path, IsDirectory = i.IsDirectory });
|
||||
.Select(i => new FileSystemMetadata { FullName = i.Path, IsDirectory = i.IsDirectory });
|
||||
|
||||
var stackResult = StackResolver.Resolve(nonExtras, namingOptions).ToList();
|
||||
|
||||
@@ -71,7 +70,7 @@ namespace Emby.Naming.Video
|
||||
{
|
||||
var info = new VideoInfo(stack.Name)
|
||||
{
|
||||
this.Files = stack.Files.Select(i => VideoResolver.Resolve(i, stack.IsDirectoryStack, namingOptions, parseName, libraryRoot))
|
||||
Files = stack.Files.Select(i => VideoResolver.Resolve(i, stack.IsDirectoryStack, namingOptions, parseName, libraryRoot))
|
||||
.OfType<VideoFileInfo>()
|
||||
.ToList()
|
||||
};
|
||||
@@ -82,7 +81,7 @@ namespace Emby.Naming.Video
|
||||
|
||||
foreach (var media in standaloneMedia)
|
||||
{
|
||||
var info = new VideoInfo(media.Name) { this.Files = new[] { media } };
|
||||
var info = new VideoInfo(media.Name) { Files = new[] { media } };
|
||||
|
||||
info.Year = info.Files[0].Year;
|
||||
list.Add(info);
|
||||
@@ -90,15 +89,15 @@ namespace Emby.Naming.Video
|
||||
|
||||
if (supportMultiVersion)
|
||||
{
|
||||
this.list = GetVideosGroupedByVersion(list, namingOptions);
|
||||
list = GetVideosGroupedByVersion(list, namingOptions);
|
||||
}
|
||||
|
||||
// Whatever files are left, just add them
|
||||
list.AddRange(remainingFiles.Select(i => new VideoInfo(i.Name)
|
||||
{
|
||||
this.Files = new[] { i },
|
||||
this.Year = i.Year,
|
||||
this.ExtraType = i.ExtraType
|
||||
Files = new[] { i },
|
||||
Year = i.Year,
|
||||
ExtraType = i.ExtraType
|
||||
}));
|
||||
|
||||
return list;
|
||||
@@ -135,7 +134,7 @@ namespace Emby.Naming.Video
|
||||
|
||||
if (folderName.Equals(video.Files[0].FileNameWithoutExtension, StringComparison.Ordinal))
|
||||
{
|
||||
this.primary = video;
|
||||
primary = video;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +166,7 @@ namespace Emby.Naming.Video
|
||||
}
|
||||
|
||||
primary ??= videos[0];
|
||||
videos.Remove(primary);
|
||||
_ = videos.Remove(primary);
|
||||
|
||||
var list = new List<VideoInfo>
|
||||
{
|
||||
@@ -209,13 +208,13 @@ namespace Emby.Naming.Video
|
||||
// Remove the folder name before cleaning as we don't care about cleaning that part
|
||||
if (folderName.Length <= testFilename.Length)
|
||||
{
|
||||
this.testFilename = testFilename[folderName.Length..].Trim();
|
||||
testFilename = testFilename[folderName.Length..].Trim();
|
||||
}
|
||||
|
||||
// There are no span overloads for regex unfortunately
|
||||
if (CleanStringParser.TryClean(testFilename.ToString(), namingOptions.CleanStringRegexes, out var cleanName))
|
||||
{
|
||||
this.testFilename = cleanName.AsSpan().Trim();
|
||||
testFilename = cleanName.AsSpan().Trim();
|
||||
}
|
||||
|
||||
// The CleanStringParser should have removed common keywords etc.
|
||||
|
||||
Reference in New Issue
Block a user