style: Code cleanup on entire solution

snyk
Robert Dailey 1 year ago
parent 63d852a4b4
commit fea6575ae8

@ -10,7 +10,7 @@ public sealed class CannotBeEmptyAttribute : RequiredAttribute
public override bool IsValid(object? value)
{
return base.IsValid(value) &&
value is IEnumerable list &&
list.GetEnumerator().MoveNext();
value is IEnumerable list &&
list.GetEnumerator().MoveNext();
}
}

@ -16,7 +16,7 @@ public class YamlNullableEnumTypeConverter : IYamlTypeConverter
public object? ReadYaml(IParser parser, Type type)
{
type = Nullable.GetUnderlyingType(type) ??
throw new ArgumentException("Expected nullable enum type for ReadYaml");
throw new ArgumentException("Expected nullable enum type for ReadYaml");
if (parser.Accept<NodeEvent>(out var @event) && NodeIsNull(@event))
{
@ -38,7 +38,7 @@ public class YamlNullableEnumTypeConverter : IYamlTypeConverter
public void WriteYaml(IEmitter emitter, object? value, Type type)
{
type = Nullable.GetUnderlyingType(type) ??
throw new ArgumentException("Expected nullable enum type for WriteYaml");
throw new ArgumentException("Expected nullable enum type for WriteYaml");
if (value == null)
{
@ -46,7 +46,7 @@ public class YamlNullableEnumTypeConverter : IYamlTypeConverter
}
var toWrite = Enum.GetName(type, value) ??
throw new InvalidOperationException($"Invalid value {value} for enum: {type}");
throw new InvalidOperationException($"Invalid value {value} for enum: {type}");
emitter.Emit(new Scalar(null!, null!, toWrite, ScalarStyle.Any, true, false));
}

@ -30,5 +30,5 @@ public class ProcessedCustomFormatData
[SuppressMessage("Microsoft.Design", "CA1024", Justification = "Method throws an exception")]
public int GetCustomFormatId()
=> CacheEntry?.CustomFormatId ??
throw new InvalidOperationException("CacheEntry must exist to obtain custom format ID");
throw new InvalidOperationException("CacheEntry must exist to obtain custom format ID");
}

@ -5,10 +5,9 @@ using Recyclarr.TrashLib.Services.CustomFormat.Models;
namespace Recyclarr.TrashLib.Services.CustomFormat.Processors.GuideSteps;
/// <remarks>
/// The purpose of this step is to validate the custom format data in the configs:
///
/// - Validate that custom formats specified in the config exist in the guide.
/// - Removal of duplicates.
/// The purpose of this step is to validate the custom format data in the configs:
/// - Validate that custom formats specified in the config exist in the guide.
/// - Removal of duplicates.
/// </remarks>
public class ConfigStep : IConfigStep
{

@ -80,6 +80,6 @@ internal class QualityProfileApiPersistenceStep : IQualityProfileApiPersistenceS
{
return scoreMap.Mapping.FirstOrDefault(
m => m.CustomFormat.CacheEntry != null &&
formatItem.Value<int>("format") == m.CustomFormat.CacheEntry.CustomFormatId);
formatItem.Value<int>("format") == m.CustomFormat.CacheEntry.CustomFormatId);
}
}

@ -6,7 +6,8 @@ namespace Recyclarr.TrashLib.Services.Radarr;
// code does not need to be changed later.
public record RadarrCapabilities(Version Version)
{
public RadarrCapabilities() : this(new Version())
public RadarrCapabilities()
: this(new Version())
{
}
}

@ -51,10 +51,10 @@ public record ReleaseProfileData
public override string ToString()
{
return $"[TrashId: {TrashId}] " +
$"[Name: {Name}] " +
$"[IncludePreferred: {IncludePreferredWhenRenaming}] " +
$"[Required: {Required.Count}] " +
$"[Ignored: {Ignored.Count}] " +
$"[Preferred: {Preferred.Count}]";
$"[Name: {Name}] " +
$"[IncludePreferred: {IncludePreferredWhenRenaming}] " +
$"[Required: {Required.Count}] " +
$"[Ignored: {Ignored.Count}] " +
$"[Preferred: {Preferred.Count}]";
}
}

@ -2,7 +2,8 @@ namespace Recyclarr.TrashLib.Services.Sonarr;
public record SonarrCapabilities(Version Version)
{
public SonarrCapabilities() : this(new Version())
public SonarrCapabilities()
: this(new Version())
{
}

@ -60,7 +60,7 @@ public class SonarrGuideDataLister : ISonarrGuideDataLister
if (!validator.Validate(profile).IsValid)
{
_console.Output.WriteLine("This release profile has no terms that can be filtered. " +
"Terms must have Trash IDs assigned in order to be filtered.");
"Terms must have Trash IDs assigned in order to be filtered.");
return;
}

@ -12,9 +12,9 @@ public static class AutoMapperConfig
cfg.AddMaps(typeof(AutoMapperConfig));
});
#if DEBUG
#if DEBUG
mapperConfig.AssertConfigurationIsValid();
#endif
#endif
return mapperConfig.CreateMapper();
}

Loading…
Cancel
Save