mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Enable all analyzers to default back to our rules
This commit is contained in:
@@ -163,6 +163,7 @@ dotnet_diagnostic.CA1309.severity = suggestion
|
|||||||
dotnet_diagnostic.CA1310.severity = suggestion
|
dotnet_diagnostic.CA1310.severity = suggestion
|
||||||
dotnet_diagnostic.CA1401.severity = suggestion
|
dotnet_diagnostic.CA1401.severity = suggestion
|
||||||
dotnet_diagnostic.CA1416.severity = suggestion
|
dotnet_diagnostic.CA1416.severity = suggestion
|
||||||
|
dotnet_diagnostic.CA1419.severity = suggestion
|
||||||
dotnet_diagnostic.CA1507.severity = suggestion
|
dotnet_diagnostic.CA1507.severity = suggestion
|
||||||
dotnet_diagnostic.CA1508.severity = suggestion
|
dotnet_diagnostic.CA1508.severity = suggestion
|
||||||
dotnet_diagnostic.CA1707.severity = suggestion
|
dotnet_diagnostic.CA1707.severity = suggestion
|
||||||
@@ -192,6 +193,10 @@ dotnet_diagnostic.CA1819.severity = suggestion
|
|||||||
dotnet_diagnostic.CA1822.severity = suggestion
|
dotnet_diagnostic.CA1822.severity = suggestion
|
||||||
dotnet_diagnostic.CA1823.severity = suggestion
|
dotnet_diagnostic.CA1823.severity = suggestion
|
||||||
dotnet_diagnostic.CA1824.severity = suggestion
|
dotnet_diagnostic.CA1824.severity = suggestion
|
||||||
|
dotnet_diagnostic.CA1835.severity = suggestion
|
||||||
|
dotnet_diagnostic.CA1845.severity = suggestion
|
||||||
|
dotnet_diagnostic.CA1848.severity = suggestion
|
||||||
|
dotnet_diagnostic.CA1849.severity = suggestion
|
||||||
dotnet_diagnostic.CA2000.severity = suggestion
|
dotnet_diagnostic.CA2000.severity = suggestion
|
||||||
dotnet_diagnostic.CA2002.severity = suggestion
|
dotnet_diagnostic.CA2002.severity = suggestion
|
||||||
dotnet_diagnostic.CA2007.severity = suggestion
|
dotnet_diagnostic.CA2007.severity = suggestion
|
||||||
@@ -229,6 +234,7 @@ dotnet_diagnostic.CA2243.severity = suggestion
|
|||||||
dotnet_diagnostic.CA2244.severity = suggestion
|
dotnet_diagnostic.CA2244.severity = suggestion
|
||||||
dotnet_diagnostic.CA2245.severity = suggestion
|
dotnet_diagnostic.CA2245.severity = suggestion
|
||||||
dotnet_diagnostic.CA2246.severity = suggestion
|
dotnet_diagnostic.CA2246.severity = suggestion
|
||||||
|
dotnet_diagnostic.CA2254.severity = suggestion
|
||||||
dotnet_diagnostic.CA3061.severity = suggestion
|
dotnet_diagnostic.CA3061.severity = suggestion
|
||||||
dotnet_diagnostic.CA3075.severity = suggestion
|
dotnet_diagnostic.CA3075.severity = suggestion
|
||||||
dotnet_diagnostic.CA3076.severity = suggestion
|
dotnet_diagnostic.CA3076.severity = suggestion
|
||||||
@@ -255,6 +261,7 @@ dotnet_diagnostic.CA5385.severity = suggestion
|
|||||||
dotnet_diagnostic.CA5392.severity = suggestion
|
dotnet_diagnostic.CA5392.severity = suggestion
|
||||||
dotnet_diagnostic.CA5394.severity = suggestion
|
dotnet_diagnostic.CA5394.severity = suggestion
|
||||||
dotnet_diagnostic.CA5397.severity = suggestion
|
dotnet_diagnostic.CA5397.severity = suggestion
|
||||||
|
dotnet_diagnostic.CA5401.severity = suggestion
|
||||||
|
|
||||||
dotnet_diagnostic.SYSLIB0014.severity = none
|
dotnet_diagnostic.SYSLIB0014.severity = none
|
||||||
|
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<!-- Common to all Prowlarr Projects -->
|
<!-- Common to all Prowlarr Projects -->
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
<AnalysisLevel>6.0-all</AnalysisLevel>
|
||||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
|
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
@@ -131,7 +131,7 @@ namespace NzbDrone.Common.Extensions
|
|||||||
|
|
||||||
public static string WrapInQuotes(this string text)
|
public static string WrapInQuotes(this string text)
|
||||||
{
|
{
|
||||||
if (!text.Contains(" "))
|
if (!text.Contains(' '))
|
||||||
{
|
{
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
@@ -255,7 +255,7 @@ namespace NzbDrone.Common.Extensions
|
|||||||
|
|
||||||
public static string ToUrlHost(this string input)
|
public static string ToUrlHost(this string input)
|
||||||
{
|
{
|
||||||
return input.Contains(":") ? $"[{input}]" : input;
|
return input.Contains(':') ? $"[{input}]" : input;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -226,7 +226,7 @@ namespace NzbDrone.Common.OAuth
|
|||||||
#if WINRT
|
#if WINRT
|
||||||
return CultureInfo.InvariantCulture.CompareInfo.Compare(left, right, CompareOptions.IgnoreCase) == 0;
|
return CultureInfo.InvariantCulture.CompareInfo.Compare(left, right, CompareOptions.IgnoreCase) == 0;
|
||||||
#else
|
#else
|
||||||
return string.Compare(left, right, StringComparison.InvariantCultureIgnoreCase) == 0;
|
return string.Equals(left, right, StringComparison.InvariantCultureIgnoreCase);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -64,7 +64,7 @@ namespace NzbDrone.Common
|
|||||||
|
|
||||||
var args = $"create {serviceName} " +
|
var args = $"create {serviceName} " +
|
||||||
$"DisplayName= \"{serviceName}\" " +
|
$"DisplayName= \"{serviceName}\" " +
|
||||||
$"binpath= \"{Process.GetCurrentProcess().MainModule.FileName}\" " +
|
$"binpath= \"{Environment.ProcessPath}\" " +
|
||||||
"start= auto " +
|
"start= auto " +
|
||||||
"depend= EventLog/Tcpip/http " +
|
"depend= EventLog/Tcpip/http " +
|
||||||
"obj= \"NT AUTHORITY\\LocalService\"";
|
"obj= \"NT AUTHORITY\\LocalService\"";
|
||||||
|
@@ -162,7 +162,7 @@ namespace NzbDrone.Core.Test.IndexerTests.TorznabTests
|
|||||||
releaseInfo.InfoHash.Should().Be("(removed)");
|
releaseInfo.InfoHash.Should().Be("(removed)");
|
||||||
releaseInfo.Seeders.Should().Be(3);
|
releaseInfo.Seeders.Should().Be(3);
|
||||||
releaseInfo.Peers.Should().Be(3);
|
releaseInfo.Peers.Should().Be(3);
|
||||||
releaseInfo.Categories.Count().Should().Be(4);
|
releaseInfo.Categories.Count.Should().Be(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -250,7 +250,7 @@ namespace NzbDrone.Core.Datastore.Migration.Framework
|
|||||||
}
|
}
|
||||||
|
|
||||||
Index = end + 1;
|
Index = end + 1;
|
||||||
identifier.Append(Buffer.Substring(start, end - start));
|
identifier.Append(Buffer.AsSpan(start, end - start));
|
||||||
|
|
||||||
if (Buffer[Index] != escape)
|
if (Buffer[Index] != escape)
|
||||||
{
|
{
|
||||||
|
@@ -173,7 +173,7 @@ namespace NzbDrone.Core.History
|
|||||||
history.Data.Add("Categories", string.Join(",", message.Query.Categories) ?? string.Empty);
|
history.Data.Add("Categories", string.Join(",", message.Query.Categories) ?? string.Empty);
|
||||||
history.Data.Add("Source", message.Query.Source ?? string.Empty);
|
history.Data.Add("Source", message.Query.Source ?? string.Empty);
|
||||||
history.Data.Add("Host", message.Query.Host ?? string.Empty);
|
history.Data.Add("Host", message.Query.Host ?? string.Empty);
|
||||||
history.Data.Add("QueryResults", message.QueryResult.Releases?.Count().ToString() ?? string.Empty);
|
history.Data.Add("QueryResults", message.QueryResult.Releases?.Count.ToString() ?? string.Empty);
|
||||||
history.Data.Add("Url", message.QueryResult.Response?.Request.Url.FullUri ?? string.Empty);
|
history.Data.Add("Url", message.QueryResult.Response?.Request.Url.FullUri ?? string.Empty);
|
||||||
|
|
||||||
_historyRepository.Insert(history);
|
_historyRepository.Insert(history);
|
||||||
|
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Http.CloudFlare
|
namespace NzbDrone.Core.Http.CloudFlare
|
||||||
@@ -41,7 +42,7 @@ namespace NzbDrone.Core.Http.CloudFlare
|
|||||||
|
|
||||||
// detect Custom CloudFlare for EbookParadijs, Film-Paleis, MuziekFabriek and Puur-Hollands
|
// detect Custom CloudFlare for EbookParadijs, Film-Paleis, MuziekFabriek and Puur-Hollands
|
||||||
if (response.Headers.Vary == "Accept-Encoding,User-Agent" &&
|
if (response.Headers.Vary == "Accept-Encoding,User-Agent" &&
|
||||||
response.Headers.ContentEncoding == "" &&
|
response.Headers.ContentEncoding.IsNullOrWhiteSpace() &&
|
||||||
response.Content.ToLower().Contains("ddos"))
|
response.Content.ToLower().Contains("ddos"))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@@ -59,7 +59,7 @@ namespace NzbDrone.Core.IndexerStats
|
|||||||
var elapsedTimeEvents = sortedEvents.Where(h => int.TryParse(h.Data.GetValueOrDefault("elapsedTime"), out temp))
|
var elapsedTimeEvents = sortedEvents.Where(h => int.TryParse(h.Data.GetValueOrDefault("elapsedTime"), out temp))
|
||||||
.Select(h => temp);
|
.Select(h => temp);
|
||||||
|
|
||||||
indexerStats.AverageResponseTime = elapsedTimeEvents.Count() > 0 ? (int)elapsedTimeEvents.Average() : 0;
|
indexerStats.AverageResponseTime = elapsedTimeEvents.Any() ? (int)elapsedTimeEvents.Average() : 0;
|
||||||
|
|
||||||
foreach (var historyEvent in sortedEvents)
|
foreach (var historyEvent in sortedEvents)
|
||||||
{
|
{
|
||||||
|
@@ -425,7 +425,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|||||||
}
|
}
|
||||||
|
|
||||||
var releaseGroup = releaseTags.LastOrDefault();
|
var releaseGroup = releaseTags.LastOrDefault();
|
||||||
if (releaseGroup != null && releaseGroup.Contains("(") && releaseGroup.Contains(")"))
|
if (releaseGroup != null && releaseGroup.Contains('(') && releaseGroup.Contains(')'))
|
||||||
{
|
{
|
||||||
//// Skip raws if set
|
//// Skip raws if set
|
||||||
//if (releaseGroup.ToLowerInvariant().StartsWith("raw") && !AllowRaws)
|
//if (releaseGroup.ToLowerInvariant().StartsWith("raw") && !AllowRaws)
|
||||||
|
@@ -281,7 +281,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|||||||
var stringSeparator = new[] { " | " };
|
var stringSeparator = new[] { " | " };
|
||||||
var titles = titleSeries.Split(stringSeparator, StringSplitOptions.RemoveEmptyEntries);
|
var titles = titleSeries.Split(stringSeparator, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|
||||||
if (titles.Count() > 1 && !_settings.AddRomajiTitle)
|
if (titles.Length > 1 && !_settings.AddRomajiTitle)
|
||||||
{
|
{
|
||||||
titles = titles.Skip(1).ToArray();
|
titles = titles.Skip(1).ToArray();
|
||||||
}
|
}
|
||||||
@@ -293,7 +293,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|||||||
release.Title = (name + releaseInfo).Trim();
|
release.Title = (name + releaseInfo).Trim();
|
||||||
|
|
||||||
// Ensure the season is defined as this tracker only deals with full seasons
|
// Ensure the season is defined as this tracker only deals with full seasons
|
||||||
if (release.Title.IndexOf("Season") == -1 && _settings.AppendSeason)
|
if (!release.Title.Contains("Season", StringComparison.CurrentCulture) && _settings.AppendSeason)
|
||||||
{
|
{
|
||||||
// Insert before the release info
|
// Insert before the release info
|
||||||
var aidx = release.Title.IndexOf('(');
|
var aidx = release.Title.IndexOf('(');
|
||||||
|
@@ -66,7 +66,7 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
|||||||
{
|
{
|
||||||
if (request.SearchPath.Response != null &&
|
if (request.SearchPath.Response != null &&
|
||||||
request.SearchPath.Response.NoResultsMessage != null &&
|
request.SearchPath.Response.NoResultsMessage != null &&
|
||||||
((request.SearchPath.Response.NoResultsMessage != string.Empty && results.Contains(request.SearchPath.Response.NoResultsMessage)) || (request.SearchPath.Response.NoResultsMessage == string.Empty && results == string.Empty)))
|
((request.SearchPath.Response.NoResultsMessage.IsNotNullOrWhiteSpace() && results.Contains(request.SearchPath.Response.NoResultsMessage)) || (request.SearchPath.Response.NoResultsMessage.IsNullOrWhiteSpace() && results.IsNullOrWhiteSpace())))
|
||||||
{
|
{
|
||||||
return releases;
|
return releases;
|
||||||
}
|
}
|
||||||
|
@@ -351,7 +351,7 @@ public class ShazbatParser : IParseIndexerResponse
|
|||||||
|
|
||||||
private static string ParseTitle(IElement titleRow)
|
private static string ParseTitle(IElement titleRow)
|
||||||
{
|
{
|
||||||
var title = titleRow?.ChildNodes.First(n => n.NodeType == NodeType.Text && n.TextContent.Trim() != string.Empty);
|
var title = titleRow?.ChildNodes.First(n => n.NodeType == NodeType.Text && n.TextContent.Trim().IsNotNullOrWhiteSpace());
|
||||||
|
|
||||||
return title?.TextContent.Trim();
|
return title?.TextContent.Trim();
|
||||||
}
|
}
|
||||||
|
@@ -34,7 +34,7 @@ namespace NzbDrone.Core.Indexers
|
|||||||
|
|
||||||
public override Encoding Encoding => Encoding.UTF8;
|
public override Encoding Encoding => Encoding.UTF8;
|
||||||
public override string Language => "en-US";
|
public override string Language => "en-US";
|
||||||
public override string[] LegacyUrls => new string[] { };
|
public override string[] LegacyUrls => Array.Empty<string>();
|
||||||
|
|
||||||
public override bool FollowRedirect => false;
|
public override bool FollowRedirect => false;
|
||||||
public override IndexerCapabilities Capabilities { get; protected set; }
|
public override IndexerCapabilities Capabilities { get; protected set; }
|
||||||
|
@@ -160,7 +160,7 @@ namespace NzbDrone.Core.Localization
|
|||||||
|
|
||||||
await CopyInto(dictionary, baseFilenamePath).ConfigureAwait(false);
|
await CopyInto(dictionary, baseFilenamePath).ConfigureAwait(false);
|
||||||
|
|
||||||
if (culture.Contains("_"))
|
if (culture.Contains('_'))
|
||||||
{
|
{
|
||||||
var languageBaseFilenamePath = Path.Combine(prefix, GetResourceFilename(culture.Split('_')[0]));
|
var languageBaseFilenamePath = Path.Combine(prefix, GetResourceFilename(culture.Split('_')[0]));
|
||||||
await CopyInto(dictionary, languageBaseFilenamePath).ConfigureAwait(false);
|
await CopyInto(dictionary, languageBaseFilenamePath).ConfigureAwait(false);
|
||||||
|
@@ -219,11 +219,11 @@ namespace NzbDrone.Core.Parser
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.Compare(m.Groups["ampm"].Value, "PM", true) == 0 && hour < 12)
|
if (string.Equals(m.Groups["ampm"].Value, "PM", StringComparison.InvariantCultureIgnoreCase) && hour < 12)
|
||||||
{
|
{
|
||||||
hour += 12;
|
hour += 12;
|
||||||
}
|
}
|
||||||
else if (string.Compare(m.Groups["ampm"].Value, "AM", true) == 0 && hour == 12)
|
else if (string.Equals(m.Groups["ampm"].Value, "AM", StringComparison.InvariantCultureIgnoreCase) && hour == 12)
|
||||||
{
|
{
|
||||||
hour -= 12;
|
hour -= 12;
|
||||||
}
|
}
|
||||||
|
@@ -50,7 +50,7 @@ namespace NzbDrone.Host
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Logger.Info("Starting Prowlarr - {0} - Version {1}",
|
Logger.Info("Starting Prowlarr - {0} - Version {1}",
|
||||||
Process.GetCurrentProcess().MainModule.FileName,
|
Environment.ProcessPath,
|
||||||
Assembly.GetExecutingAssembly().GetName().Version);
|
Assembly.GetExecutingAssembly().GetName().Version);
|
||||||
|
|
||||||
var startupContext = new StartupContext(args);
|
var startupContext = new StartupContext(args);
|
||||||
|
@@ -125,7 +125,7 @@ namespace NzbDrone.Host
|
|||||||
|
|
||||||
c.AddSecurityRequirement(new OpenApiSecurityRequirement
|
c.AddSecurityRequirement(new OpenApiSecurityRequirement
|
||||||
{
|
{
|
||||||
{ apiKeyHeader, new string[] { } }
|
{ apiKeyHeader, Array.Empty<string>() }
|
||||||
});
|
});
|
||||||
|
|
||||||
var apikeyQuery = new OpenApiSecurityScheme
|
var apikeyQuery = new OpenApiSecurityScheme
|
||||||
@@ -156,7 +156,7 @@ namespace NzbDrone.Host
|
|||||||
|
|
||||||
c.AddSecurityRequirement(new OpenApiSecurityRequirement
|
c.AddSecurityRequirement(new OpenApiSecurityRequirement
|
||||||
{
|
{
|
||||||
{ apikeyQuery, new string[] { } }
|
{ apikeyQuery, Array.Empty<string>() }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -27,7 +27,7 @@ namespace NzbDrone.Test.Common
|
|||||||
|
|
||||||
public int Start()
|
public int Start()
|
||||||
{
|
{
|
||||||
int threadId = Thread.CurrentThread.ManagedThreadId;
|
int threadId = Environment.CurrentManagedThreadId;
|
||||||
lock (_mutex)
|
lock (_mutex)
|
||||||
{
|
{
|
||||||
_threads[threadId] = 1;
|
_threads[threadId] = 1;
|
||||||
|
@@ -93,7 +93,7 @@ namespace Prowlarr.Api.V1.System.Backup
|
|||||||
throw new BadRequestException("file must be provided");
|
throw new BadRequestException("file must be provided");
|
||||||
}
|
}
|
||||||
|
|
||||||
var file = files.First();
|
var file = files[0];
|
||||||
var extension = Path.GetExtension(file.FileName);
|
var extension = Path.GetExtension(file.FileName);
|
||||||
|
|
||||||
if (!ValidExtensions.Contains(extension))
|
if (!ValidExtensions.Contains(extension))
|
||||||
|
@@ -35,7 +35,7 @@ namespace Prowlarr.Http.Frontend.Mappers
|
|||||||
|
|
||||||
return !resourceUrl.StartsWith("/content") &&
|
return !resourceUrl.StartsWith("/content") &&
|
||||||
!resourceUrl.StartsWith("/mediacover") &&
|
!resourceUrl.StartsWith("/mediacover") &&
|
||||||
!resourceUrl.Contains(".") &&
|
!resourceUrl.Contains('.') &&
|
||||||
!resourceUrl.StartsWith("/login");
|
!resourceUrl.StartsWith("/login");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user