From fea6575ae873b185a15652062712dfb3c0eb8124 Mon Sep 17 00:00:00 2001 From: Robert Dailey Date: Fri, 30 Dec 2022 12:46:22 -0600 Subject: [PATCH] style: Code cleanup on entire solution --- .../YamlDotNet/CannotBeEmptyAttribute.cs | 4 ++-- .../YamlDotNet/YamlNullableEnumTypeConverter.cs | 6 +++--- .../CustomFormat/Models/ProcessedCustomFormatData.cs | 2 +- .../CustomFormat/Processors/GuideSteps/ConfigStep.cs | 7 +++---- .../QualityProfileApiPersistenceStep.cs | 2 +- .../Services/Radarr/RadarrCapabilities.cs | 3 ++- .../Sonarr/ReleaseProfile/ReleaseProfileData.cs | 10 +++++----- .../Services/Sonarr/SonarrCapabilities.cs | 3 ++- .../Services/Sonarr/SonarrGuideDataLister.cs | 2 +- src/Recyclarr.TrashLib/Startup/AutoMapperConfig.cs | 4 ++-- 10 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/Recyclarr.Common/YamlDotNet/CannotBeEmptyAttribute.cs b/src/Recyclarr.Common/YamlDotNet/CannotBeEmptyAttribute.cs index 8abad3ff..4a120dc1 100644 --- a/src/Recyclarr.Common/YamlDotNet/CannotBeEmptyAttribute.cs +++ b/src/Recyclarr.Common/YamlDotNet/CannotBeEmptyAttribute.cs @@ -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(); } } diff --git a/src/Recyclarr.Common/YamlDotNet/YamlNullableEnumTypeConverter.cs b/src/Recyclarr.Common/YamlDotNet/YamlNullableEnumTypeConverter.cs index 4008ee8b..ae3db151 100644 --- a/src/Recyclarr.Common/YamlDotNet/YamlNullableEnumTypeConverter.cs +++ b/src/Recyclarr.Common/YamlDotNet/YamlNullableEnumTypeConverter.cs @@ -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(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)); } diff --git a/src/Recyclarr.TrashLib/Services/CustomFormat/Models/ProcessedCustomFormatData.cs b/src/Recyclarr.TrashLib/Services/CustomFormat/Models/ProcessedCustomFormatData.cs index 4a13ad8e..8876eb29 100644 --- a/src/Recyclarr.TrashLib/Services/CustomFormat/Models/ProcessedCustomFormatData.cs +++ b/src/Recyclarr.TrashLib/Services/CustomFormat/Models/ProcessedCustomFormatData.cs @@ -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"); } diff --git a/src/Recyclarr.TrashLib/Services/CustomFormat/Processors/GuideSteps/ConfigStep.cs b/src/Recyclarr.TrashLib/Services/CustomFormat/Processors/GuideSteps/ConfigStep.cs index 1a9331bb..c89390a6 100644 --- a/src/Recyclarr.TrashLib/Services/CustomFormat/Processors/GuideSteps/ConfigStep.cs +++ b/src/Recyclarr.TrashLib/Services/CustomFormat/Processors/GuideSteps/ConfigStep.cs @@ -5,10 +5,9 @@ using Recyclarr.TrashLib.Services.CustomFormat.Models; namespace Recyclarr.TrashLib.Services.CustomFormat.Processors.GuideSteps; /// -/// 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. /// public class ConfigStep : IConfigStep { diff --git a/src/Recyclarr.TrashLib/Services/CustomFormat/Processors/PersistenceSteps/QualityProfileApiPersistenceStep.cs b/src/Recyclarr.TrashLib/Services/CustomFormat/Processors/PersistenceSteps/QualityProfileApiPersistenceStep.cs index c8b79f10..8f496515 100644 --- a/src/Recyclarr.TrashLib/Services/CustomFormat/Processors/PersistenceSteps/QualityProfileApiPersistenceStep.cs +++ b/src/Recyclarr.TrashLib/Services/CustomFormat/Processors/PersistenceSteps/QualityProfileApiPersistenceStep.cs @@ -80,6 +80,6 @@ internal class QualityProfileApiPersistenceStep : IQualityProfileApiPersistenceS { return scoreMap.Mapping.FirstOrDefault( m => m.CustomFormat.CacheEntry != null && - formatItem.Value("format") == m.CustomFormat.CacheEntry.CustomFormatId); + formatItem.Value("format") == m.CustomFormat.CacheEntry.CustomFormatId); } } diff --git a/src/Recyclarr.TrashLib/Services/Radarr/RadarrCapabilities.cs b/src/Recyclarr.TrashLib/Services/Radarr/RadarrCapabilities.cs index 6297efec..04271822 100644 --- a/src/Recyclarr.TrashLib/Services/Radarr/RadarrCapabilities.cs +++ b/src/Recyclarr.TrashLib/Services/Radarr/RadarrCapabilities.cs @@ -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()) { } } diff --git a/src/Recyclarr.TrashLib/Services/Sonarr/ReleaseProfile/ReleaseProfileData.cs b/src/Recyclarr.TrashLib/Services/Sonarr/ReleaseProfile/ReleaseProfileData.cs index 87577963..1a8c3981 100644 --- a/src/Recyclarr.TrashLib/Services/Sonarr/ReleaseProfile/ReleaseProfileData.cs +++ b/src/Recyclarr.TrashLib/Services/Sonarr/ReleaseProfile/ReleaseProfileData.cs @@ -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}]"; } } diff --git a/src/Recyclarr.TrashLib/Services/Sonarr/SonarrCapabilities.cs b/src/Recyclarr.TrashLib/Services/Sonarr/SonarrCapabilities.cs index d70788cc..e53af4ed 100644 --- a/src/Recyclarr.TrashLib/Services/Sonarr/SonarrCapabilities.cs +++ b/src/Recyclarr.TrashLib/Services/Sonarr/SonarrCapabilities.cs @@ -2,7 +2,8 @@ namespace Recyclarr.TrashLib.Services.Sonarr; public record SonarrCapabilities(Version Version) { - public SonarrCapabilities() : this(new Version()) + public SonarrCapabilities() + : this(new Version()) { } diff --git a/src/Recyclarr.TrashLib/Services/Sonarr/SonarrGuideDataLister.cs b/src/Recyclarr.TrashLib/Services/Sonarr/SonarrGuideDataLister.cs index c95b2b37..83acfa16 100644 --- a/src/Recyclarr.TrashLib/Services/Sonarr/SonarrGuideDataLister.cs +++ b/src/Recyclarr.TrashLib/Services/Sonarr/SonarrGuideDataLister.cs @@ -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; } diff --git a/src/Recyclarr.TrashLib/Startup/AutoMapperConfig.cs b/src/Recyclarr.TrashLib/Startup/AutoMapperConfig.cs index 23b42e1f..300fde8e 100644 --- a/src/Recyclarr.TrashLib/Startup/AutoMapperConfig.cs +++ b/src/Recyclarr.TrashLib/Startup/AutoMapperConfig.cs @@ -12,9 +12,9 @@ public static class AutoMapperConfig cfg.AddMaps(typeof(AutoMapperConfig)); }); -#if DEBUG + #if DEBUG mapperConfig.AssertConfigurationIsValid(); -#endif + #endif return mapperConfig.CreateMapper(); }