Upgrade StyleCop.Analyzers to Unstable 1.2.0.556

This commit is contained in:
Mark McDowall 2025-02-27 20:20:15 -08:00
parent 6d8c3f15b3
commit 5d7c94f8e9
155 changed files with 399 additions and 227 deletions

View file

@ -5,6 +5,11 @@
<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1" />
<PackageReference Include="NBuilder" Version="6.1.0" />
<PackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.556">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Remove="StyleCop.Analyzers" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NzbDrone.Core\Sonarr.Core.csproj" />

View file

@ -8,7 +8,7 @@ namespace NzbDrone.Api.Test.v3.Qualities;
[Parallelizable(ParallelScope.All)]
public class QualityDefinitionResourceValidatorTests
{
private readonly QualityDefinitionResourceValidator _validator = new ();
private readonly QualityDefinitionResourceValidator _validator = new();
[Test]
public void Validate_fails_when_min_size_is_below_min_limit()

View file

@ -6,6 +6,11 @@
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1" />
<PackageReference Include="Selenium.Support" Version="3.141.0" />
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="111.0.5563.6400" />
<PackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.556">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Remove="StyleCop.Analyzers" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NzbDrone.Test.Common\Sonarr.Test.Common.csproj" />

View file

@ -36,7 +36,7 @@ namespace NzbDrone.Common.Test.Http
private string _httpBinHost;
private string _httpBinHost2;
private System.Net.Http.HttpClient _httpClient = new ();
private System.Net.Http.HttpClient _httpClient = new();
[OneTimeSetUp]
public void FixtureSetUp()

View file

@ -4,6 +4,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1" />
<PackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.556">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Remove="StyleCop.Analyzers" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NzbDrone.Host\Sonarr.Host.csproj" />

View file

@ -296,7 +296,7 @@ namespace NzbDrone.Common.Disk
return _path.Split(new char[] { '\\', '/' }, StringSplitOptions.RemoveEmptyEntries);
}
public static OsPath Null => new (null);
public static OsPath Null => new(null);
public override string ToString()
{

View file

@ -31,7 +31,7 @@ namespace NzbDrone.Common.Extensions
}
public static IDictionary<TNewKey, TNewValue> SelectDictionary<TKey, TValue, TNewKey, TNewValue>(this IDictionary<TKey, TValue> dictionary,
Func<KeyValuePair<TKey, TValue>, ValueTuple<TNewKey, TNewValue>> selection)
Func<KeyValuePair<TKey, TValue>, (TNewKey Item1, TNewValue Item2)> selection)
{
return dictionary.Select(selection).ToDictionary(t => t.Item1, t => t.Item2);
}

View file

@ -9,7 +9,7 @@ namespace NzbDrone.Common.Http
{
public class HttpResponse
{
private static readonly Regex RegexSetCookie = new ("^(.*?)=(.*?)(?:;|$)", RegexOptions.Compiled);
private static readonly Regex RegexSetCookie = new("^(.*?)=(.*?)(?:;|$)", RegexOptions.Compiled);
public HttpResponse(HttpRequest request, HttpHeader headers, byte[] binaryData, HttpStatusCode statusCode = HttpStatusCode.OK, Version version = null)
{

View file

@ -10,57 +10,57 @@ namespace NzbDrone.Common.Instrumentation
private static readonly Regex[] CleansingRules =
{
// Url
new (@"(?<=\?|&)(apikey|token|passkey|auth|authkey|user|uid|api|[a-z_]*apikey|account|passwd)=(?<secret>[^&=""]+?)(?=[ ""&=]|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new (@"(?<=\?|&)[^=]*?(username|password)=(?<secret>[^&=]+?)(?= |&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new (@"rss(24h)?\.torrentleech\.org/(?!rss)(?<secret>[0-9a-z]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new (@"torrentleech\.org/rss/download/[0-9]+/(?<secret>[0-9a-z]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new (@"iptorrents\.com/[/a-z0-9?&;]*?(?:[?&;](u|tp)=(?<secret>[^&=;]+?))+(?= |;|&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new (@"/fetch/[a-z0-9]{32}/(?<secret>[a-z0-9]{32})", RegexOptions.Compiled),
new (@"getnzb.*?(?<=\?|&)(r)=(?<secret>[^&=]+?)(?= |&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new (@"\b(\w*)?(_?(?<!use|get_)token|username|passwo?rd)=(?<secret>[^&=]+?)(?= |&|$|;)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new (@"-hd.me/torrent/[a-z0-9-]\.[0-9]+\.(?<secret>[0-9a-z]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new(@"(?<=\?|&)(apikey|token|passkey|auth|authkey|user|uid|api|[a-z_]*apikey|account|passwd)=(?<secret>[^&=""]+?)(?=[ ""&=]|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new(@"(?<=\?|&)[^=]*?(username|password)=(?<secret>[^&=]+?)(?= |&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new(@"rss(24h)?\.torrentleech\.org/(?!rss)(?<secret>[0-9a-z]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new(@"torrentleech\.org/rss/download/[0-9]+/(?<secret>[0-9a-z]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new(@"iptorrents\.com/[/a-z0-9?&;]*?(?:[?&;](u|tp)=(?<secret>[^&=;]+?))+(?= |;|&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new(@"/fetch/[a-z0-9]{32}/(?<secret>[a-z0-9]{32})", RegexOptions.Compiled),
new(@"getnzb.*?(?<=\?|&)(r)=(?<secret>[^&=]+?)(?= |&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new(@"\b(\w*)?(_?(?<!use|get_)token|username|passwo?rd)=(?<secret>[^&=]+?)(?= |&|$|;)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new(@"-hd.me/torrent/[a-z0-9-]\.[0-9]+\.(?<secret>[0-9a-z]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
// Trackers Announce Keys; Designed for Qbit Json; should work for all in theory
new (@"announce(\.php)?(/|%2f|%3fpasskey%3d)(?<secret>[a-z0-9]{16,})|(?<secret>[a-z0-9]{16,})(/|%2f)announce", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new(@"announce(\.php)?(/|%2f|%3fpasskey%3d)(?<secret>[a-z0-9]{16,})|(?<secret>[a-z0-9]{16,})(/|%2f)announce", RegexOptions.Compiled | RegexOptions.IgnoreCase),
// Path
new (@"C:\\Users\\(?<secret>[^\""]+?)(\\|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new (@"/(home|Users)/(?<secret>[^/""]+?)(/|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new(@"C:\\Users\\(?<secret>[^\""]+?)(\\|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new(@"/(home|Users)/(?<secret>[^/""]+?)(/|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
// NzbGet
new (@"""Name""\s*:\s*""[^""]*(username|password)""\s*,\s*""Value""\s*:\s*""(?<secret>[^""]+?)""", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new(@"""Name""\s*:\s*""[^""]*(username|password)""\s*,\s*""Value""\s*:\s*""(?<secret>[^""]+?)""", RegexOptions.Compiled | RegexOptions.IgnoreCase),
// Sabnzbd
new (@"""[^""]*(username|password|api_?key|nzb_key)""\s*:\s*""(?<secret>[^""]+?)""", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new (@"""email_(account|to|from|pwd)""\s*:\s*""(?<secret>[^""]+?)""", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new(@"""[^""]*(username|password|api_?key|nzb_key)""\s*:\s*""(?<secret>[^""]+?)""", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new(@"""email_(account|to|from|pwd)""\s*:\s*""(?<secret>[^""]+?)""", RegexOptions.Compiled | RegexOptions.IgnoreCase),
// uTorrent
new (@"\[""[a-z._]*(username|password)"",\d,""(?<secret>[^""]+?)""", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new (@"\[""(boss_key|boss_key_salt|proxy\.proxy)"",\d,""(?<secret>[^""]+?)""", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new(@"\[""[a-z._]*(username|password)"",\d,""(?<secret>[^""]+?)""", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new(@"\[""(boss_key|boss_key_salt|proxy\.proxy)"",\d,""(?<secret>[^""]+?)""", RegexOptions.Compiled | RegexOptions.IgnoreCase),
// Deluge
new (@"auth.login\(""(?<secret>[^""]+?)""", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new(@"auth.login\(""(?<secret>[^""]+?)""", RegexOptions.Compiled | RegexOptions.IgnoreCase),
// BroadcastheNet
new (@"""?method""?\s*:\s*""(getTorrents)"",\s*""?params""?\s*:\s*\[\s*""(?<secret>[^""]+?)""", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new (@"getTorrents\(""(?<secret>[^""]+?)""", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new (@"(?<=\?|&)(authkey|torrent_pass)=(?<secret>[^&=]+?)(?=""|&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new(@"""?method""?\s*:\s*""(getTorrents)"",\s*""?params""?\s*:\s*\[\s*""(?<secret>[^""]+?)""", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new(@"getTorrents\(""(?<secret>[^""]+?)""", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new(@"(?<=\?|&)(authkey|torrent_pass)=(?<secret>[^&=]+?)(?=""|&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
// Plex
new (@"(?<=\?|&)(X-Plex-Client-Identifier|X-Plex-Token)=(?<secret>[^&=]+?)(?= |&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new(@"(?<=\?|&)(X-Plex-Client-Identifier|X-Plex-Token)=(?<secret>[^&=]+?)(?= |&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
// Webhooks
// Notifiarr
new (@"api/v[0-9]/notification/sonarr/(?<secret>[\w-]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new(@"api/v[0-9]/notification/sonarr/(?<secret>[\w-]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
// Discord
new (@"discord.com/api/webhooks/((?<secret>[\w-]+)/)?(?<secret>[\w-]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new(@"discord.com/api/webhooks/((?<secret>[\w-]+)/)?(?<secret>[\w-]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
// Telegram
new (@"api.telegram.org/bot(?<id>[\d]+):(?<secret>[\w-]+)/", RegexOptions.Compiled | RegexOptions.IgnoreCase)
new(@"api.telegram.org/bot(?<id>[\d]+):(?<secret>[\w-]+)/", RegexOptions.Compiled | RegexOptions.IgnoreCase)
};
private static readonly Regex CleanseRemoteIPRegex = new (@"(?:Auth-\w+(?<!Failure|Unauthorized) ip|from) (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})", RegexOptions.Compiled);
private static readonly Regex CleanseRemoteIPRegex = new(@"(?:Auth-\w+(?<!Failure|Unauthorized) ip|from) (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})", RegexOptions.Compiled);
public static string Cleanse(string message)
{

View file

@ -15,8 +15,8 @@ namespace NzbDrone.Common.Instrumentation
private const string FileLogLayout = @"${date:format=yyyy-MM-dd HH\:mm\:ss.f}|${level}|${logger}|${message}${onexception:inner=${newline}${newline}[v${assembly-version}] ${exception:format=ToString}${newline}}";
private const string ConsoleFormat = "[${level}] ${logger}: ${message} ${onexception:inner=${newline}${newline}[v${assembly-version}] ${exception:format=ToString}${newline}}";
private static readonly CleansingConsoleLogLayout CleansingConsoleLayout = new (ConsoleFormat);
private static readonly CleansingClefLogLayout ClefLogLayout = new ();
private static readonly CleansingConsoleLogLayout CleansingConsoleLayout = new(ConsoleFormat);
private static readonly CleansingClefLogLayout ClefLogLayout = new();
private static bool _isConfigured;

View file

@ -15,6 +15,10 @@
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.15" />
<PackageReference Include="Sentry" Version="4.0.2" />
<PackageReference Include="SharpZipLib" Version="1.4.2" />
<PackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.556">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Text.Json" Version="8.0.5" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
<PackageReference Include="System.Data.SQLite.Core.Servarr" Version="1.0.115.5-18" />
@ -22,6 +26,7 @@
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="6.0.0-preview.5.21301.5" />
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="8.0.1" />
<PackageReference Remove="StyleCop.Analyzers" />
</ItemGroup>
<ItemGroup>
<Compile Update="EnsureThat\Resources\ExceptionMessages.Designer.cs">

View file

@ -94,7 +94,8 @@ namespace NzbDrone.Common.TPL
{
_currentThreadIsProcessingItems = false;
}
}, null);
},
null);
}
/// <summary>Attempts to execute the specified task on the current thread.</summary>

View file

@ -20,7 +20,8 @@ namespace NzbDrone.Common.TPL
Logger.Error(exception, "Task Error");
}
}
}, TaskContinuationOptions.OnlyOnFaulted);
},
TaskContinuationOptions.OnlyOnFaulted);
return task;
}

View file

@ -12,4 +12,11 @@
<ProjectReference Include="..\NzbDrone.Host\Sonarr.Host.csproj" />
<ProjectReference Include="..\Sonarr.RuntimePatches\Sonarr.RuntimePatches.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.556">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Remove="StyleCop.Analyzers" />
</ItemGroup>
</Project>

View file

@ -116,17 +116,21 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests
public void should_not_mark_as_imported_if_all_files_were_rejected()
{
Mocker.GetMock<IDownloadedEpisodesImportService>()
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Series>(), It.IsAny<DownloadClientItem>()))
.Returns(new List<ImportResult>
{
new ImportResult(
new ImportDecision(
new LocalEpisode { Path = @"C:\TestPath\Droned.S01E01.mkv", Episodes = { _episode1 } }, new ImportRejection(ImportRejectionReason.Unknown, "Rejected!")), "Test Failure"),
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Series>(), It.IsAny<DownloadClientItem>()))
.Returns(new List<ImportResult>
{
new ImportResult(
new ImportDecision(
new LocalEpisode { Path = @"C:\TestPath\Droned.S01E01.mkv", Episodes = { _episode1 } },
new ImportRejection(ImportRejectionReason.Unknown, "Rejected!")),
"Test Failure"),
new ImportResult(
new ImportDecision(
new LocalEpisode { Path = @"C:\TestPath\Droned.S01E02.mkv", Episodes = { _episode2 } }, new ImportRejection(ImportRejectionReason.Unknown, "Rejected!")), "Test Failure")
});
new ImportResult(
new ImportDecision(
new LocalEpisode { Path = @"C:\TestPath\Droned.S01E02.mkv", Episodes = { _episode2 } },
new ImportRejection(ImportRejectionReason.Unknown, "Rejected!")),
"Test Failure")
});
Subject.Import(_trackedDownload);
@ -145,11 +149,13 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests
{
new ImportResult(
new ImportDecision(
new LocalEpisode { Path = @"C:\TestPath\Droned.S01E01.mkv", Episodes = { _episode1 } }, new ImportRejection(ImportRejectionReason.Unknown, "Rejected!")), "Test Failure"),
new LocalEpisode { Path = @"C:\TestPath\Droned.S01E01.mkv", Episodes = { _episode1 } }, new ImportRejection(ImportRejectionReason.Unknown, "Rejected!")),
"Test Failure"),
new ImportResult(
new ImportDecision(
new LocalEpisode { Path = @"C:\TestPath\Droned.S01E02.mkv", Episodes = { _episode2 } }, new ImportRejection(ImportRejectionReason.Unknown, "Rejected!")), "Test Failure")
new LocalEpisode { Path = @"C:\TestPath\Droned.S01E02.mkv", Episodes = { _episode2 } }, new ImportRejection(ImportRejectionReason.Unknown, "Rejected!")),
"Test Failure")
});
_trackedDownload.RemoteEpisode.Episodes.Clear();
@ -272,16 +278,24 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests
Mocker.GetMock<IDownloadedEpisodesImportService>()
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Series>(), It.IsAny<DownloadClientItem>()))
.Returns(new List<ImportResult>
{
new ImportResult(
new ImportDecision(
new LocalEpisode { Path = @"C:\TestPath\Droned.S01E01.mkv", Episodes = new List<Episode> { episode1 } })),
.Returns(
new List<ImportResult>
{
new ImportResult(
new ImportDecision(
new LocalEpisode
{
Path = @"C:\TestPath\Droned.S01E01.mkv", Episodes = new List<Episode> { episode1 }
})),
new ImportResult(
new ImportDecision(
new LocalEpisode { Path = @"C:\TestPath\Droned.S01E02.mkv", Episodes = new List<Episode> { episode2 } }), "Test Failure")
});
new ImportResult(
new ImportDecision(
new LocalEpisode
{
Path = @"C:\TestPath\Droned.S01E02.mkv", Episodes = new List<Episode> { episode2 }
}),
"Test Failure")
});
var history = Builder<EpisodeHistory>.CreateListOfSize(2)
.BuildList();

View file

@ -166,7 +166,8 @@ namespace NzbDrone.Core.Test.Download
Mocker.GetMock<IIndexerStatusService>()
.Verify(v => v.RecordFailure(It.IsAny<int>(),
It.IsInRange<TimeSpan>(TimeSpan.FromMinutes(4.9), TimeSpan.FromMinutes(5.1), Moq.Range.Inclusive)), Times.Once());
It.IsInRange<TimeSpan>(TimeSpan.FromMinutes(4.9), TimeSpan.FromMinutes(5.1), Moq.Range.Inclusive)),
Times.Once());
}
[Test]

View file

@ -84,7 +84,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
GivenRootFolder(rootFolderPath);
_clientStatus.OutputRootFolders = new List<OsPath> { new (downloadRootPath) };
_clientStatus.OutputRootFolders = new List<OsPath> { new(downloadRootPath) };
Subject.Check().ShouldBeWarning();
}

View file

@ -97,7 +97,8 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeFileMovingServiceTests
Mocker.GetMock<IEventAggregator>()
.Verify(s => s.PublishEvent<EpisodeFolderCreatedEvent>(It.Is<EpisodeFolderCreatedEvent>(p =>
p.SeriesFolder.IsNotNullOrWhiteSpace())), Times.Once());
p.SeriesFolder.IsNotNullOrWhiteSpace())),
Times.Once());
}
[Test]
@ -107,7 +108,8 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeFileMovingServiceTests
Mocker.GetMock<IEventAggregator>()
.Verify(s => s.PublishEvent<EpisodeFolderCreatedEvent>(It.Is<EpisodeFolderCreatedEvent>(p =>
p.SeasonFolder.IsNotNullOrWhiteSpace())), Times.Once());
p.SeasonFolder.IsNotNullOrWhiteSpace())),
Times.Once());
}
[Test]
@ -121,7 +123,8 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeFileMovingServiceTests
Mocker.GetMock<IEventAggregator>()
.Verify(s => s.PublishEvent<EpisodeFolderCreatedEvent>(It.Is<EpisodeFolderCreatedEvent>(p =>
p.SeriesFolder.IsNotNullOrWhiteSpace())), Times.Never());
p.SeriesFolder.IsNotNullOrWhiteSpace())),
Times.Never());
}
}
}

View file

@ -38,11 +38,13 @@ namespace NzbDrone.Core.Test.NotificationTests
new DeletedEpisodeFile(new EpisodeFile
{
RelativePath = "file1.S01E01.mkv"
}, null),
},
null),
new DeletedEpisodeFile(new EpisodeFile
{
RelativePath = "file1.S01E02.mkv"
}, null)
},
null)
}
};

View file

@ -43,7 +43,8 @@ namespace NzbDrone.Core.Test.ParserTests.ParsingServiceTests
Mocker.GetMock<ISeriesService>()
.Verify(s => s.FindByTitle(parsedEpisodeInfo.SeriesTitleInfo.TitleWithoutYear,
parsedEpisodeInfo.SeriesTitleInfo.Year), Times.Once());
parsedEpisodeInfo.SeriesTitleInfo.Year),
Times.Once());
}
[Test]

View file

@ -6,7 +6,12 @@
<PackageReference Include="Dapper" Version="2.1.35" />
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1" />
<PackageReference Include="NBuilder" Version="6.1.0" />
<PackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.556">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Data.SQLite.Core.Servarr" Version="1.0.115.5-18" />
<PackageReference Remove="StyleCop.Analyzers" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NzbDrone.Test.Common\Sonarr.Test.Common.csproj" />

View file

@ -18,7 +18,7 @@ namespace NzbDrone.Core.AutoTagging.Specifications
public class GenreSpecification : AutoTaggingSpecificationBase
{
private static readonly GenreSpecificationValidator Validator = new ();
private static readonly GenreSpecificationValidator Validator = new();
public override int Order => 1;
public override string ImplementationName => "Genre";

View file

@ -10,7 +10,7 @@ namespace NzbDrone.Core.AutoTagging.Specifications
public class MonitoredSpecification : AutoTaggingSpecificationBase
{
private static readonly MonitoredSpecificationValidator Validator = new ();
private static readonly MonitoredSpecificationValidator Validator = new();
public override int Order => 1;
public override string ImplementationName => "Monitored";

View file

@ -16,7 +16,7 @@ namespace NzbDrone.Core.AutoTagging.Specifications
public class OriginalLanguageSpecification : AutoTaggingSpecificationBase
{
private static readonly OriginalLanguageSpecificationValidator Validator = new ();
private static readonly OriginalLanguageSpecificationValidator Validator = new();
public override int Order => 1;
public override string ImplementationName => "Original Language";

View file

@ -15,7 +15,7 @@ namespace NzbDrone.Core.AutoTagging.Specifications
public class QualityProfileSpecification : AutoTaggingSpecificationBase
{
private static readonly QualityProfileSpecificationValidator Validator = new ();
private static readonly QualityProfileSpecificationValidator Validator = new();
public override int Order => 1;
public override string ImplementationName => "Quality Profile";

View file

@ -11,7 +11,7 @@ namespace NzbDrone.Core.AutoTagging.Specifications
public class StatusSpecification : AutoTaggingSpecificationBase
{
private static readonly StatusSpecificationValidator Validator = new ();
private static readonly StatusSpecificationValidator Validator = new();
public override int Order => 1;
public override string ImplementationName => "Status";

View file

@ -15,7 +15,7 @@ namespace NzbDrone.Core.AutoTagging.Specifications
public class TagSpecification : AutoTaggingSpecificationBase
{
private static readonly TagSpecificationValidator Validator = new ();
private static readonly TagSpecificationValidator Validator = new();
public override int Order => 1;
public override string ImplementationName => "Tag";

View file

@ -18,7 +18,7 @@ namespace NzbDrone.Core.AutoTagging.Specifications
public class YearSpecification : AutoTaggingSpecificationBase
{
private static readonly YearSpecificationValidator Validator = new ();
private static readonly YearSpecificationValidator Validator = new();
public override int Order => 1;
public override string ImplementationName => "Year";

View file

@ -23,7 +23,7 @@ namespace NzbDrone.Core.CustomFormats
public class IndexerFlagSpecification : CustomFormatSpecificationBase
{
private static readonly IndexerFlagSpecificationValidator Validator = new ();
private static readonly IndexerFlagSpecificationValidator Validator = new();
public override int Order => 4;
public override string ImplementationName => "Indexer Flag";

View file

@ -22,7 +22,7 @@ namespace NzbDrone.Core.CustomFormats
public class ReleaseTypeSpecification : CustomFormatSpecificationBase
{
private static readonly SeasonPackSpecificationValidator Validator = new ();
private static readonly SeasonPackSpecificationValidator Validator = new();
public override int Order => 10;
public override string ImplementationName => "Release Type";

View file

@ -5,7 +5,7 @@ namespace NzbDrone.Core.Datastore;
public static class DatabaseVersionParser
{
private static readonly Regex VersionRegex = new (@"^[^ ]+", RegexOptions.Compiled);
private static readonly Regex VersionRegex = new(@"^[^ ]+", RegexOptions.Compiled);
public static Version ParseServerVersion(string serverVersion)
{

View file

@ -364,7 +364,7 @@ namespace NzbDrone.Core.Datastore.Migration
}
}
return VideoFileInfoReader.GetHdrFormat(mediaInfo.VideoBitDepth, mediaInfo.VideoColourPrimaries, mediaInfo.VideoTransferCharacteristics, new ());
return VideoFileInfoReader.GetHdrFormat(mediaInfo.VideoBitDepth, mediaInfo.VideoColourPrimaries, mediaInfo.VideoTransferCharacteristics, new());
}
private void MigrateAudioCodec(MediaInfo162 mediaInfo, MediaInfo163 m)

View file

@ -6,7 +6,7 @@
public DownloadRejectionReason Reason { get; set; }
public string Message { get; private set; }
private static readonly DownloadSpecDecision AcceptDownloadSpecDecision = new () { Accepted = true };
private static readonly DownloadSpecDecision AcceptDownloadSpecDecision = new() { Accepted = true };
private DownloadSpecDecision()
{
}

View file

@ -14,7 +14,7 @@ namespace NzbDrone.Core.Download.Clients.Aria2
public class Aria2Settings : DownloadClientSettingsBase<Aria2Settings>
{
private static readonly Aria2SettingsValidator Validator = new ();
private static readonly Aria2SettingsValidator Validator = new();
public Aria2Settings()
{

View file

@ -25,7 +25,7 @@ namespace NzbDrone.Core.Download.Clients.Blackhole
ReadOnly = true;
}
private static readonly TorrentBlackholeSettingsValidator Validator = new ();
private static readonly TorrentBlackholeSettingsValidator Validator = new();
[FieldDefinition(0, Label = "TorrentBlackholeTorrentFolder", Type = FieldType.Path, HelpText = "BlackholeFolderHelpText")]
[FieldToken(TokenField.HelpText, "TorrentBlackholeTorrentFolder", "extension", ".torrent")]

View file

@ -16,7 +16,7 @@ namespace NzbDrone.Core.Download.Clients.Blackhole
public class UsenetBlackholeSettings : DownloadClientSettingsBase<UsenetBlackholeSettings>
{
private static readonly UsenetBlackholeSettingsValidator Validator = new ();
private static readonly UsenetBlackholeSettingsValidator Validator = new();
[FieldDefinition(0, Label = "UsenetBlackholeNzbFolder", Type = FieldType.Path, HelpText = "BlackholeFolderHelpText")]
[FieldToken(TokenField.HelpText, "UsenetBlackholeNzbFolder", "extension", ".nzb")]

View file

@ -18,7 +18,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge
public class DelugeSettings : DownloadClientSettingsBase<DelugeSettings>
{
private static readonly DelugeSettingsValidator Validator = new ();
private static readonly DelugeSettingsValidator Validator = new();
public DelugeSettings()
{

View file

@ -27,7 +27,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
public class DownloadStationSettings : DownloadClientSettingsBase<DownloadStationSettings>
{
private static readonly DownloadStationSettingsValidator Validator = new ();
private static readonly DownloadStationSettingsValidator Validator = new();
[FieldDefinition(0, Label = "Host", Type = FieldType.Textbox)]
public string Host { get; set; }

View file

@ -18,7 +18,7 @@ namespace NzbDrone.Core.Download.Clients.Flood
public class FloodSettings : DownloadClientSettingsBase<FloodSettings>
{
private static readonly FloodSettingsValidator Validator = new ();
private static readonly FloodSettingsValidator Validator = new();
public FloodSettings()
{

View file

@ -35,7 +35,7 @@ namespace NzbDrone.Core.Download.Clients.FreeboxDownload
public class FreeboxDownloadSettings : DownloadClientSettingsBase<FreeboxDownloadSettings>
{
private static readonly FreeboxDownloadSettingsValidator Validator = new ();
private static readonly FreeboxDownloadSettingsValidator Validator = new();
public FreeboxDownloadSettings()
{

View file

@ -23,7 +23,7 @@ namespace NzbDrone.Core.Download.Clients.Hadouken
public class HadoukenSettings : DownloadClientSettingsBase<HadoukenSettings>
{
private static readonly HadoukenSettingsValidator Validator = new ();
private static readonly HadoukenSettingsValidator Validator = new();
public HadoukenSettings()
{

View file

@ -24,7 +24,7 @@ namespace NzbDrone.Core.Download.Clients.NzbVortex
public class NzbVortexSettings : DownloadClientSettingsBase<NzbVortexSettings>
{
private static readonly NzbVortexSettingsValidator Validator = new ();
private static readonly NzbVortexSettingsValidator Validator = new();
public NzbVortexSettings()
{

View file

@ -22,7 +22,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
public class NzbgetSettings : DownloadClientSettingsBase<NzbgetSettings>
{
private static readonly NzbgetSettingsValidator Validator = new ();
private static readonly NzbgetSettingsValidator Validator = new();
public NzbgetSettings()
{

View file

@ -16,7 +16,7 @@ namespace NzbDrone.Core.Download.Clients.Pneumatic
public class PneumaticSettings : DownloadClientSettingsBase<PneumaticSettings>
{
private static readonly PneumaticSettingsValidator Validator = new ();
private static readonly PneumaticSettingsValidator Validator = new();
[FieldDefinition(0, Label = "DownloadClientPneumaticSettingsNzbFolder", Type = FieldType.Path, HelpText = "DownloadClientPneumaticSettingsNzbFolderHelpText")]
public string NzbFolder { get; set; }

View file

@ -20,7 +20,7 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
public class QBittorrentSettings : DownloadClientSettingsBase<QBittorrentSettings>
{
private static readonly QBittorrentSettingsValidator Validator = new ();
private static readonly QBittorrentSettingsValidator Validator = new();
public QBittorrentSettings()
{

View file

@ -33,7 +33,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
public class SabnzbdSettings : DownloadClientSettingsBase<SabnzbdSettings>
{
private static readonly SabnzbdSettingsValidator Validator = new ();
private static readonly SabnzbdSettingsValidator Validator = new();
public SabnzbdSettings()
{

View file

@ -4,7 +4,7 @@ namespace NzbDrone.Core.Download.Clients
{
public class TorrentSeedConfiguration
{
public static TorrentSeedConfiguration DefaultConfiguration = new ();
public static TorrentSeedConfiguration DefaultConfiguration = new();
public double? Ratio { get; set; }
public TimeSpan? SeedTime { get; set; }

View file

@ -26,7 +26,7 @@ namespace NzbDrone.Core.Download.Clients.Transmission
public class TransmissionSettings : DownloadClientSettingsBase<TransmissionSettings>
{
private static readonly TransmissionSettingsValidator Validator = new ();
private static readonly TransmissionSettingsValidator Validator = new();
// This constructor is used when creating a new instance, such as the user adding a new Transmission client.
public TransmissionSettings()

View file

@ -18,7 +18,7 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
public class RTorrentSettings : DownloadClientSettingsBase<RTorrentSettings>
{
private static readonly RTorrentSettingsValidator Validator = new ();
private static readonly RTorrentSettingsValidator Validator = new();
public RTorrentSettings()
{

View file

@ -18,7 +18,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
public class UTorrentSettings : DownloadClientSettingsBase<UTorrentSettings>
{
private static readonly UTorrentSettingsValidator Validator = new ();
private static readonly UTorrentSettingsValidator Validator = new();
public UTorrentSettings()
{

View file

@ -332,7 +332,8 @@ namespace NzbDrone.Core.HealthCheck.Checks
{ "downloadClientName", client.Definition.Name },
{ "path", dlpath },
{ "osName", _osInfo.Name }
}), "#bad-remote-path-mapping");
}),
"#bad-remote-path-mapping");
}
// path mappings shouldn't be needed locally so probably a permissions issue

View file

@ -32,7 +32,7 @@ namespace NzbDrone.Core.ImportLists.AniList
public class AniListSettingsBase<TSettings> : ImportListSettingsBase<TSettings>
where TSettings : AniListSettingsBase<TSettings>
{
private static readonly AniListSettingsBaseValidator<TSettings> Validator = new ();
private static readonly AniListSettingsBaseValidator<TSettings> Validator = new();
public AniListSettingsBase()
{

View file

@ -20,7 +20,7 @@ namespace NzbDrone.Core.ImportLists.AniList.List
{
public const string SectionImport = "Import List Status";
private static readonly AniListSettingsValidator Validator = new ();
private static readonly AniListSettingsValidator Validator = new();
public AniListSettings()
{

View file

@ -15,7 +15,7 @@ namespace NzbDrone.Core.ImportLists.Custom
public class CustomSettings : ImportListSettingsBase<CustomSettings>
{
private static readonly CustomSettingsValidator Validator = new ();
private static readonly CustomSettingsValidator Validator = new();
[FieldDefinition(0, Label = "ImportListsCustomListSettingsUrl", HelpText = "ImportListsCustomListSettingsUrlHelpText")]
public override string BaseUrl { get; set; } = string.Empty;

View file

@ -26,7 +26,7 @@ namespace NzbDrone.Core.ImportLists.MyAnimeList
public class MyAnimeListSettings : ImportListSettingsBase<MyAnimeListSettings>
{
private static readonly MalSettingsValidator Validator = new ();
private static readonly MalSettingsValidator Validator = new();
public override string BaseUrl { get; set; } = "https://api.myanimelist.net/v2";

View file

@ -16,7 +16,7 @@ namespace NzbDrone.Core.ImportLists.Plex
public class PlexListSettings : ImportListSettingsBase<PlexListSettings>
{
private static readonly PlexListSettingsValidator Validator = new ();
private static readonly PlexListSettingsValidator Validator = new();
public PlexListSettings()
{

View file

@ -10,7 +10,7 @@ namespace NzbDrone.Core.ImportLists.Rss.Plex
public class PlexRssImportParser : RssImportBaseParser
{
private readonly Logger _logger;
private static readonly Regex ImdbIdRegex = new (@"(tt\d{7,8})", RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex ImdbIdRegex = new(@"(tt\d{7,8})", RegexOptions.IgnoreCase | RegexOptions.Compiled);
public PlexRssImportParser(Logger logger)
: base(logger)

View file

@ -14,7 +14,7 @@ namespace NzbDrone.Core.ImportLists.Rss.Plex
public class PlexRssImportSettings : RssImportBaseSettings<PlexRssImportSettings>
{
private static readonly PlexRssImportSettingsValidator Validator = new ();
private static readonly PlexRssImportSettingsValidator Validator = new();
[FieldDefinition(0, Label = "ImportListsSettingsRssUrl", Type = FieldType.Textbox, HelpLink = "https://app.plex.tv/desktop/#!/settings/watchlist")]
public override string Url { get; set; }

View file

@ -16,7 +16,7 @@ namespace NzbDrone.Core.ImportLists.Rss
public class RssImportBaseSettings<TSettings> : ImportListSettingsBase<TSettings>
where TSettings : RssImportBaseSettings<TSettings>
{
private static readonly RssImportSettingsValidator<TSettings> Validator = new ();
private static readonly RssImportSettingsValidator<TSettings> Validator = new();
public override string BaseUrl { get; set; }

View file

@ -27,7 +27,7 @@ namespace NzbDrone.Core.ImportLists.Simkl
public class SimklSettingsBase<TSettings> : ImportListSettingsBase<TSettings>
where TSettings : SimklSettingsBase<TSettings>
{
private static readonly SimklSettingsBaseValidator<TSettings> Validator = new ();
private static readonly SimklSettingsBaseValidator<TSettings> Validator = new();
public SimklSettingsBase()
{

View file

@ -14,7 +14,7 @@ namespace NzbDrone.Core.ImportLists.Simkl.User
public class SimklUserSettings : SimklSettingsBase<SimklUserSettings>
{
private static readonly SimklUserSettingsValidator Validator = new ();
private static readonly SimklUserSettingsValidator Validator = new();
public SimklUserSettings()
{

View file

@ -17,7 +17,7 @@ namespace NzbDrone.Core.ImportLists.Sonarr
public class SonarrSettings : ImportListSettingsBase<SonarrSettings>
{
private static readonly SonarrSettingsValidator Validator = new ();
private static readonly SonarrSettingsValidator Validator = new();
public SonarrSettings()
{

View file

@ -15,7 +15,7 @@ namespace NzbDrone.Core.ImportLists.Trakt.List
public class TraktListSettings : TraktSettingsBase<TraktListSettings>
{
private static readonly TraktListSettingsValidator Validator = new ();
private static readonly TraktListSettingsValidator Validator = new();
[FieldDefinition(1, Label = "Username", HelpText = "ImportListsTraktSettingsUsernameHelpText")]
public string Username { get; set; }

View file

@ -28,7 +28,7 @@ namespace NzbDrone.Core.ImportLists.Trakt.Popular
public class TraktPopularSettings : TraktSettingsBase<TraktPopularSettings>
{
private static readonly TraktPopularSettingsValidator Validator = new ();
private static readonly TraktPopularSettingsValidator Validator = new();
public TraktPopularSettings()
{

View file

@ -37,7 +37,7 @@ namespace NzbDrone.Core.ImportLists.Trakt
public class TraktSettingsBase<TSettings> : ImportListSettingsBase<TSettings>
where TSettings : TraktSettingsBase<TSettings>
{
private static readonly TraktSettingsBaseValidator<TSettings> Validator = new ();
private static readonly TraktSettingsBaseValidator<TSettings> Validator = new();
public TraktSettingsBase()
{

View file

@ -16,7 +16,7 @@ namespace NzbDrone.Core.ImportLists.Trakt.User
public class TraktUserSettings : TraktSettingsBase<TraktUserSettings>
{
private static readonly TraktUserSettingsValidator Validator = new ();
private static readonly TraktUserSettingsValidator Validator = new();
public TraktUserSettings()
{

View file

@ -11,7 +11,7 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
{
public class BroadcastheNetParser : IParseIndexerResponse
{
private static readonly Regex RegexProtocol = new ("^https?:", RegexOptions.Compiled);
private static readonly Regex RegexProtocol = new("^https?:", RegexOptions.Compiled);
public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
{

View file

@ -21,7 +21,7 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
public class BroadcastheNetSettings : PropertywiseEquatable<BroadcastheNetSettings>, ITorrentIndexerSettings
{
private static readonly BroadcastheNetSettingsValidator Validator = new ();
private static readonly BroadcastheNetSettingsValidator Validator = new();
public BroadcastheNetSettings()
{
@ -41,7 +41,7 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
public int MinimumSeeders { get; set; }
[FieldDefinition(3)]
public SeedCriteriaSettings SeedCriteria { get; set; } = new ();
public SeedCriteriaSettings SeedCriteria { get; set; } = new();
[FieldDefinition(4, Type = FieldType.Checkbox, Label = "IndexerSettingsRejectBlocklistedTorrentHashes", HelpText = "IndexerSettingsRejectBlocklistedTorrentHashesHelpText", Advanced = true)]
public bool RejectBlocklistedTorrentHashesWhileGrabbing { get; set; }

View file

@ -18,7 +18,7 @@ namespace NzbDrone.Core.Indexers.Fanzub
public class FanzubSettings : PropertywiseEquatable<FanzubSettings>, IIndexerSettings
{
private static readonly FanzubSettingsValidator Validator = new ();
private static readonly FanzubSettingsValidator Validator = new();
public FanzubSettings()
{

View file

@ -22,7 +22,7 @@ namespace NzbDrone.Core.Indexers.FileList
public class FileListSettings : PropertywiseEquatable<FileListSettings>, ITorrentIndexerSettings
{
private static readonly FileListSettingsValidator Validator = new ();
private static readonly FileListSettingsValidator Validator = new();
public FileListSettings()
{
@ -63,7 +63,7 @@ namespace NzbDrone.Core.Indexers.FileList
public int MinimumSeeders { get; set; }
[FieldDefinition(7)]
public SeedCriteriaSettings SeedCriteria { get; set; } = new ();
public SeedCriteriaSettings SeedCriteria { get; set; } = new();
[FieldDefinition(8, Type = FieldType.Checkbox, Label = "IndexerSettingsRejectBlocklistedTorrentHashes", HelpText = "IndexerSettingsRejectBlocklistedTorrentHashesHelpText", Advanced = true)]
public bool RejectBlocklistedTorrentHashesWhileGrabbing { get; set; }

View file

@ -21,7 +21,7 @@ namespace NzbDrone.Core.Indexers.HDBits
public class HDBitsSettings : PropertywiseEquatable<HDBitsSettings>, ITorrentIndexerSettings
{
private static readonly HDBitsSettingsValidator Validator = new ();
private static readonly HDBitsSettingsValidator Validator = new();
public HDBitsSettings()
{
@ -57,7 +57,7 @@ namespace NzbDrone.Core.Indexers.HDBits
public int MinimumSeeders { get; set; }
[FieldDefinition(7)]
public SeedCriteriaSettings SeedCriteria { get; set; } = new ();
public SeedCriteriaSettings SeedCriteria { get; set; } = new();
[FieldDefinition(8, Type = FieldType.Checkbox, Label = "IndexerSettingsRejectBlocklistedTorrentHashes", HelpText = "IndexerSettingsRejectBlocklistedTorrentHashesHelpText", Advanced = true)]
public bool RejectBlocklistedTorrentHashesWhileGrabbing { get; set; }

View file

@ -28,7 +28,7 @@ namespace NzbDrone.Core.Indexers.IPTorrents
public class IPTorrentsSettings : PropertywiseEquatable<IPTorrentsSettings>, ITorrentIndexerSettings
{
private static readonly IPTorrentsSettingsValidator Validator = new ();
private static readonly IPTorrentsSettingsValidator Validator = new();
public IPTorrentsSettings()
{
@ -44,7 +44,7 @@ namespace NzbDrone.Core.Indexers.IPTorrents
public int MinimumSeeders { get; set; }
[FieldDefinition(2)]
public SeedCriteriaSettings SeedCriteria { get; set; } = new ();
public SeedCriteriaSettings SeedCriteria { get; set; } = new();
[FieldDefinition(3, Type = FieldType.Checkbox, Label = "IndexerSettingsRejectBlocklistedTorrentHashes", HelpText = "IndexerSettingsRejectBlocklistedTorrentHashesHelpText", Advanced = true)]
public bool RejectBlocklistedTorrentHashesWhileGrabbing { get; set; }

View file

@ -29,7 +29,7 @@ namespace NzbDrone.Core.Indexers.Newznab
return settings.BaseUrl != null && ApiKeyWhiteList.Any(c => settings.BaseUrl.ToLowerInvariant().Contains(c));
}
private static readonly Regex AdditionalParametersRegex = new (@"(&.+?\=.+?)+", RegexOptions.Compiled);
private static readonly Regex AdditionalParametersRegex = new(@"(&.+?\=.+?)+", RegexOptions.Compiled);
public NewznabSettingsValidator()
{
@ -51,7 +51,7 @@ namespace NzbDrone.Core.Indexers.Newznab
public class NewznabSettings : PropertywiseEquatable<NewznabSettings>, IIndexerSettings
{
private static readonly NewznabSettingsValidator Validator = new ();
private static readonly NewznabSettingsValidator Validator = new();
public NewznabSettings()
{

View file

@ -22,7 +22,7 @@ namespace NzbDrone.Core.Indexers.Nyaa
public class NyaaSettings : PropertywiseEquatable<NyaaSettings>, ITorrentIndexerSettings
{
private static readonly NyaaSettingsValidator Validator = new ();
private static readonly NyaaSettingsValidator Validator = new();
public NyaaSettings()
{
@ -46,7 +46,7 @@ namespace NzbDrone.Core.Indexers.Nyaa
public int MinimumSeeders { get; set; }
[FieldDefinition(4)]
public SeedCriteriaSettings SeedCriteria { get; set; } = new ();
public SeedCriteriaSettings SeedCriteria { get; set; } = new();
[FieldDefinition(5, Type = FieldType.Checkbox, Label = "IndexerSettingsRejectBlocklistedTorrentHashes", HelpText = "IndexerSettingsRejectBlocklistedTorrentHashesHelpText", Advanced = true)]
public bool RejectBlocklistedTorrentHashesWhileGrabbing { get; set; }

View file

@ -20,7 +20,7 @@ namespace NzbDrone.Core.Indexers.TorrentRss
public class TorrentRssIndexerSettings : PropertywiseEquatable<TorrentRssIndexerSettings>, ITorrentIndexerSettings
{
private static readonly TorrentRssIndexerSettingsValidator Validator = new ();
private static readonly TorrentRssIndexerSettingsValidator Validator = new();
public TorrentRssIndexerSettings()
{
@ -44,7 +44,7 @@ namespace NzbDrone.Core.Indexers.TorrentRss
public int MinimumSeeders { get; set; }
[FieldDefinition(4)]
public SeedCriteriaSettings SeedCriteria { get; set; } = new ();
public SeedCriteriaSettings SeedCriteria { get; set; } = new();
[FieldDefinition(5, Type = FieldType.Checkbox, Label = "IndexerSettingsRejectBlocklistedTorrentHashes", HelpText = "IndexerSettingsRejectBlocklistedTorrentHashesHelpText", Advanced = true)]
public bool RejectBlocklistedTorrentHashesWhileGrabbing { get; set; }

View file

@ -21,7 +21,7 @@ namespace NzbDrone.Core.Indexers.Torrentleech
public class TorrentleechSettings : PropertywiseEquatable<TorrentleechSettings>, ITorrentIndexerSettings
{
private static readonly TorrentleechSettingsValidator Validator = new ();
private static readonly TorrentleechSettingsValidator Validator = new();
public TorrentleechSettings()
{
@ -41,7 +41,7 @@ namespace NzbDrone.Core.Indexers.Torrentleech
public int MinimumSeeders { get; set; }
[FieldDefinition(3)]
public SeedCriteriaSettings SeedCriteria { get; set; } = new ();
public SeedCriteriaSettings SeedCriteria { get; set; } = new();
[FieldDefinition(4, Type = FieldType.Checkbox, Label = "IndexerSettingsRejectBlocklistedTorrentHashes", HelpText = "IndexerSettingsRejectBlocklistedTorrentHashesHelpText", Advanced = true)]
public bool RejectBlocklistedTorrentHashesWhileGrabbing { get; set; }

View file

@ -19,7 +19,7 @@ namespace NzbDrone.Core.Indexers.Torznab
return settings.BaseUrl != null && ApiKeyWhiteList.Any(c => settings.BaseUrl.ToLowerInvariant().Contains(c));
}
private static readonly Regex AdditionalParametersRegex = new (@"(&.+?\=.+?)+", RegexOptions.Compiled);
private static readonly Regex AdditionalParametersRegex = new(@"(&.+?\=.+?)+", RegexOptions.Compiled);
public TorznabSettingsValidator()
{
@ -43,7 +43,7 @@ namespace NzbDrone.Core.Indexers.Torznab
public class TorznabSettings : NewznabSettings, ITorrentIndexerSettings, IEquatable<TorznabSettings>
{
private static readonly TorznabSettingsValidator Validator = new ();
private static readonly TorznabSettingsValidator Validator = new();
private static readonly MemberwiseEqualityComparer<TorznabSettings> Comparer = MemberwiseEqualityComparer<TorznabSettings>.ByProperties;
@ -56,7 +56,7 @@ namespace NzbDrone.Core.Indexers.Torznab
public int MinimumSeeders { get; set; }
[FieldDefinition(10)]
public SeedCriteriaSettings SeedCriteria { get; set; } = new ();
public SeedCriteriaSettings SeedCriteria { get; set; } = new();
[FieldDefinition(11, Type = FieldType.Checkbox, Label = "IndexerSettingsRejectBlocklistedTorrentHashes", HelpText = "IndexerSettingsRejectBlocklistedTorrentHashesHelpText", Advanced = true)]
public bool RejectBlocklistedTorrentHashesWhileGrabbing { get; set; }

View file

@ -6,7 +6,7 @@
public ImportRejectionReason Reason { get; set; }
public string Message { get; private set; }
private static readonly ImportSpecDecision AcceptDecision = new () { Accepted = true };
private static readonly ImportSpecDecision AcceptDecision = new() { Accepted = true };
private ImportSpecDecision()
{
}

View file

@ -117,14 +117,14 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo
// if it looks like PQ10 or similar HDR, do a frame analysis to figure out which type it is
if (PqTransferFunctions.Contains(mediaInfoModel.VideoTransferCharacteristics))
{
var frameOutput = FFProbe.GetFrameJson(filename, ffOptions: new () { ExtraArguments = $"-read_intervals \"%+#1\" -select_streams v:{primaryVideoStream?.Index ?? 0}" });
var frameOutput = FFProbe.GetFrameJson(filename, ffOptions: new() { ExtraArguments = $"-read_intervals \"%+#1\" -select_streams v:{primaryVideoStream?.Index ?? 0}" });
mediaInfoModel.RawFrameData = frameOutput;
frames = FFProbe.AnalyseFrameJson(frameOutput);
}
var streamSideData = primaryVideoStream?.SideDataList ?? new ();
var framesSideData = frames?.Frames?.Count > 0 ? frames?.Frames[0]?.SideDataList ?? new () : new ();
var streamSideData = primaryVideoStream?.SideDataList ?? new();
var framesSideData = frames?.Frames?.Count > 0 ? frames?.Frames[0]?.SideDataList ?? new() : new();
var sideData = streamSideData.Concat(framesSideData).ToList();
mediaInfoModel.VideoHdrFormat = GetHdrFormat(mediaInfoModel.VideoBitDepth, mediaInfoModel.VideoColourPrimaries, mediaInfoModel.VideoTransferCharacteristics, sideData);

View file

@ -106,7 +106,8 @@ namespace NzbDrone.Core.Messaging.Events
_taskFactory.StartNew(() =>
{
handlerLocal.HandleAsync(@event);
}, TaskCreationOptions.PreferFairness)
},
TaskCreationOptions.PreferFairness)
.LogExceptions();
}
@ -119,7 +120,8 @@ namespace NzbDrone.Core.Messaging.Events
_logger.Trace("{0} ~> {1}", eventName, handlerLocal.GetType().Name);
handlerLocal.HandleAsync(@event);
_logger.Trace("{0} <~ {1}", eventName, handlerLocal.GetType().Name);
}, TaskCreationOptions.PreferFairness)
},
TaskCreationOptions.PreferFairness)
.LogExceptions();
}
}

View file

@ -36,7 +36,7 @@ namespace NzbDrone.Core.Notifications.Apprise
public class AppriseSettings : NotificationSettingsBase<AppriseSettings>
{
private static readonly AppriseSettingsValidator Validator = new ();
private static readonly AppriseSettingsValidator Validator = new();
public AppriseSettings()
{

View file

@ -17,7 +17,7 @@ namespace NzbDrone.Core.Notifications.CustomScript
public class CustomScriptSettings : NotificationSettingsBase<CustomScriptSettings>
{
private static readonly CustomScriptSettingsValidator Validator = new ();
private static readonly CustomScriptSettingsValidator Validator = new();
[FieldDefinition(0, Label = "Path", Type = FieldType.FilePath)]
public string Path { get; set; }

View file

@ -342,7 +342,7 @@ namespace NzbDrone.Core.Notifications.Discord
{
var attachments = new List<Embed>
{
new ()
new()
{
Title = series.Title,
}
@ -373,8 +373,8 @@ namespace NzbDrone.Core.Notifications.Discord
Color = (int)DiscordColors.Danger,
Fields = new List<DiscordField>
{
new () { Name = "Reason", Value = reason.ToString() },
new () { Name = "File name", Value = string.Format("```{0}```", deletedFile) }
new() { Name = "Reason", Value = reason.ToString() },
new() { Name = "File name", Value = string.Format("```{0}```", deletedFile) }
},
Timestamp = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.fffZ"),
};
@ -398,7 +398,7 @@ namespace NzbDrone.Core.Notifications.Discord
Title = series.Title,
Description = "Series Added",
Color = (int)DiscordColors.Success,
Fields = new List<DiscordField> { new () { Name = "Links", Value = GetLinksString(series) } }
Fields = new List<DiscordField> { new() { Name = "Links", Value = GetLinksString(series) } }
};
if (Settings.ImportFields.Contains((int)DiscordImportFieldType.Poster))
@ -437,7 +437,7 @@ namespace NzbDrone.Core.Notifications.Discord
Title = series.Title,
Description = deleteMessage.DeletedFilesMessage,
Color = (int)DiscordColors.Danger,
Fields = new List<DiscordField> { new () { Name = "Links", Value = GetLinksString(series) } }
Fields = new List<DiscordField> { new() { Name = "Links", Value = GetLinksString(series) } }
};
if (Settings.ImportFields.Contains((int)DiscordImportFieldType.Poster))
@ -515,12 +515,12 @@ namespace NzbDrone.Core.Notifications.Discord
Color = (int)DiscordColors.Standard,
Fields = new List<DiscordField>()
{
new ()
new()
{
Name = "Previous Version",
Value = updateMessage.PreviousVersion.ToString()
},
new ()
new()
{
Name = "New Version",
Value = updateMessage.NewVersion.ToString()

View file

@ -65,7 +65,7 @@ namespace NzbDrone.Core.Notifications.Discord
};
}
private static readonly DiscordSettingsValidator Validator = new ();
private static readonly DiscordSettingsValidator Validator = new();
[FieldDefinition(0, Label = "NotificationsSettingsWebhookUrl", HelpText = "NotificationsDiscordSettingsWebhookUrlHelpText")]
public string WebHookUrl { get; set; }

View file

@ -27,7 +27,7 @@ namespace NzbDrone.Core.Notifications.Email
public class EmailSettings : NotificationSettingsBase<EmailSettings>
{
private static readonly EmailSettingsValidator Validator = new ();
private static readonly EmailSettingsValidator Validator = new();
public EmailSettings()
{

View file

@ -43,7 +43,7 @@ namespace NzbDrone.Core.Notifications.Gotify
public class GotifySettings : NotificationSettingsBase<GotifySettings>
{
private static readonly GotifySettingsValidator Validator = new ();
private static readonly GotifySettingsValidator Validator = new();
public GotifySettings()
{

View file

@ -15,7 +15,7 @@ namespace NzbDrone.Core.Notifications.Join
public class JoinSettings : NotificationSettingsBase<JoinSettings>
{
private static readonly JoinSettingsValidator Validator = new ();
private static readonly JoinSettingsValidator Validator = new();
public JoinSettings()
{

View file

@ -18,7 +18,7 @@ namespace NzbDrone.Core.Notifications.Mailgun
public class MailgunSettings : NotificationSettingsBase<MailgunSettings>
{
private static readonly MailGunSettingsValidator Validator = new ();
private static readonly MailGunSettingsValidator Validator = new();
public MailgunSettings()
{

View file

@ -100,7 +100,8 @@ namespace NzbDrone.Core.Notifications.Emby
}
return MediaBrowserMatchQuality.None;
}, item => item.Path).OrderBy(group => (int)group.Key).First();
},
item => item.Path).OrderBy(group => (int)group.Key).First();
if (paths.Key == MediaBrowserMatchQuality.None)
{

View file

@ -20,7 +20,7 @@ namespace NzbDrone.Core.Notifications.Emby
public class MediaBrowserSettings : NotificationSettingsBase<MediaBrowserSettings>
{
private static readonly MediaBrowserSettingsValidator Validator = new ();
private static readonly MediaBrowserSettingsValidator Validator = new();
public MediaBrowserSettings()
{

View file

@ -14,7 +14,7 @@ namespace NzbDrone.Core.Notifications.Notifiarr
public class NotifiarrSettings : NotificationSettingsBase<NotifiarrSettings>
{
private static readonly NotifiarrSettingsValidator Validator = new ();
private static readonly NotifiarrSettingsValidator Validator = new();
[FieldDefinition(0, Label = "ApiKey", Privacy = PrivacyLevel.ApiKey, HelpText = "NotificationsNotifiarrSettingsApiKeyHelpText", HelpLink = "https://notifiarr.com")]
public string ApiKey { get; set; }

View file

@ -20,12 +20,12 @@ namespace NzbDrone.Core.Notifications.Ntfy
RuleForEach(c => c.Topics).NotEmpty().Matches("[a-zA-Z0-9_-]+").Must(c => !InvalidTopics.Contains(c)).WithMessage("Invalid topic");
}
private static List<string> InvalidTopics => new () { "announcements", "app", "docs", "settings", "stats", "mytopic-rw", "mytopic-ro", "mytopic-wo" };
private static List<string> InvalidTopics => new() { "announcements", "app", "docs", "settings", "stats", "mytopic-rw", "mytopic-ro", "mytopic-wo" };
}
public class NtfySettings : NotificationSettingsBase<NtfySettings>
{
private static readonly NtfySettingsValidator Validator = new ();
private static readonly NtfySettingsValidator Validator = new();
public NtfySettings()
{

View file

@ -19,7 +19,7 @@ namespace NzbDrone.Core.Notifications.Plex.Server
public class PlexServerSettings : NotificationSettingsBase<PlexServerSettings>
{
private static readonly PlexServerSettingsValidator Validator = new ();
private static readonly PlexServerSettingsValidator Validator = new();
public PlexServerSettings()
{

View file

@ -14,7 +14,7 @@ namespace NzbDrone.Core.Notifications.Prowl
public class ProwlSettings : NotificationSettingsBase<ProwlSettings>
{
private static readonly ProwlSettingsValidator Validator = new ();
private static readonly ProwlSettingsValidator Validator = new();
[FieldDefinition(0, Label = "ApiKey", Privacy = PrivacyLevel.ApiKey, HelpLink = "https://www.prowlapp.com/api_settings.php")]
public string ApiKey { get; set; }

View file

@ -16,7 +16,7 @@ namespace NzbDrone.Core.Notifications.PushBullet
public class PushBulletSettings : NotificationSettingsBase<PushBulletSettings>
{
private static readonly PushBulletSettingsValidator Validator = new ();
private static readonly PushBulletSettingsValidator Validator = new();
public PushBulletSettings()
{

View file

@ -15,7 +15,7 @@ namespace NzbDrone.Core.Notifications.Pushcut
public class PushcutSettings : NotificationSettingsBase<PushcutSettings>
{
private static readonly PushcutSettingsValidator Validator = new ();
private static readonly PushcutSettingsValidator Validator = new();
[FieldDefinition(0, Label = "NotificationsPushcutSettingsNotificationName", Type = FieldType.Textbox, HelpText = "NotificationsPushcutSettingsNotificationNameHelpText")]
public string NotificationName { get; set; }

View file

@ -18,7 +18,7 @@ namespace NzbDrone.Core.Notifications.Pushover
public class PushoverSettings : NotificationSettingsBase<PushoverSettings>
{
private static readonly PushoverSettingsValidator Validator = new ();
private static readonly PushoverSettingsValidator Validator = new();
public PushoverSettings()
{

View file

@ -19,7 +19,7 @@ namespace NzbDrone.Core.Notifications.SendGrid
public class SendGridSettings : NotificationSettingsBase<SendGridSettings>
{
private static readonly SendGridSettingsValidator Validator = new ();
private static readonly SendGridSettingsValidator Validator = new();
public SendGridSettings()
{

View file

@ -17,7 +17,7 @@ namespace NzbDrone.Core.Notifications.Signal
public class SignalSettings : NotificationSettingsBase<SignalSettings>
{
private static readonly SignalSettingsValidator Validator = new ();
private static readonly SignalSettingsValidator Validator = new();
[FieldDefinition(0, Label = "Host", Type = FieldType.Textbox, Placeholder = "localhost")]
public string Host { get; set; }

View file

@ -14,7 +14,7 @@ namespace NzbDrone.Core.Notifications.Simplepush
public class SimplepushSettings : NotificationSettingsBase<SimplepushSettings>
{
private static readonly SimplepushSettingsValidator Validator = new ();
private static readonly SimplepushSettingsValidator Validator = new();
[FieldDefinition(0, Label = "NotificationsSimplepushSettingsKey", Privacy = PrivacyLevel.ApiKey, HelpLink = "https://simplepush.io/features")]
public string Key { get; set; }

Some files were not shown because too many files have changed in this diff Show more