refactor: Address several analysis warnings

pull/201/head
Robert Dailey 10 months ago
parent def934ebeb
commit e0da419ffa

@ -94,6 +94,6 @@ public partial class ServiceCache : IServiceCache
return _storagePath.CalculatePath(config, objectName);
}
[GeneratedRegex("^[\\w-]+$", RegexOptions.None, 1000)]
[GeneratedRegex(@"^[\w-]+$", RegexOptions.None, 1000)]
private static partial Regex AllowedObjectNameCharactersRegex();
}

@ -5,6 +5,7 @@ namespace Recyclarr.Cli.Console.Settings;
public interface ISyncSettings
{
SupportedServices? Service { get; }
// ReSharper disable once ReturnTypeCanBeEnumerable.Global
IReadOnlyCollection<string> Configs { get; }
bool Preview { get; }
IReadOnlyCollection<string>? Instances { get; }

@ -48,11 +48,6 @@ public class LoggerFactory
var logFilePrefix = $"recyclarr_{DateTime.Now:yyyy-MM-dd_HH-mm-ss}";
var logDir = _paths.LogDirectory;
string LogFilePath(string type)
{
return logDir.File($"{logFilePrefix}.{type}.log").FullName;
}
return new LoggerConfiguration()
.MinimumLevel.Is(LogEventLevel.Verbose)
.Enrich.With<ExceptionMessageEnricher>()
@ -65,5 +60,10 @@ public class LoggerFactory
.WriteTo.File(GetFileTemplate(), LogFilePath("verbose")))
.Enrich.FromLogContext()
.CreateLogger();
string LogFilePath(string type)
{
return logDir.File($"{logFilePrefix}.{type}.log").FullName;
}
}
}

@ -68,14 +68,15 @@ public partial class CustomFormatCategoryParser : ICustomFormatCategoryParser
return tableRows
// Filter out the `|---|---|---|` part of the table between the heading & data rows.
.Where(x => !Regex.IsMatch(x[0], @"^-+$", RegexOptions.None, TimeSpan.FromMilliseconds(1000)));
.Where(x => !Regex.IsMatch(x[0], "^-+$", RegexOptions.None, TimeSpan.FromMilliseconds(1000)));
}
private static List<string> GetTableRow(string line)
{
var fields = new List<string>();
var match = TableRegex().Match(line);
// ReSharper disable once InvertIf
if (match.Success)
{
var tableRow = match.Groups[1].Value;
@ -85,9 +86,9 @@ public partial class CustomFormatCategoryParser : ICustomFormatCategoryParser
return fields;
}
[GeneratedRegex("^\\s*\\|(.*)\\|\\s*$", RegexOptions.None, 1000)]
[GeneratedRegex(@"^\s*\|(.*)\|\s*$", RegexOptions.None, 1000)]
private static partial Regex TableRegex();
[GeneratedRegex("^\\[(.+?)\\]\\(#(.+?)\\)$", RegexOptions.None, 1000)]
[GeneratedRegex(@"^\[(.+?)\]\(#(.+?)\)$", RegexOptions.None, 1000)]
private static partial Regex LinkRegex();
}

Loading…
Cancel
Save