diff --git a/src/Recyclarr.Common/Extensions/CollectionExtensions.cs b/src/Recyclarr.Common/Extensions/CollectionExtensions.cs index 241b5815..56e023c8 100644 --- a/src/Recyclarr.Common/Extensions/CollectionExtensions.cs +++ b/src/Recyclarr.Common/Extensions/CollectionExtensions.cs @@ -39,22 +39,17 @@ public static class CollectionExtensions return observable.Where(x => x is not null).Select(x => x!); } - public static bool Empty(this ICollection? collection) + public static bool IsEmpty(this ICollection? collection) { return collection is null or {Count: 0}; } - public static bool Empty(this IReadOnlyCollection? collection) + public static bool IsEmpty(this IReadOnlyCollection? collection) { return collection is null or {Count: 0}; } - public static bool NotEmpty(this ICollection? collection) - { - return collection is {Count: > 0}; - } - - public static bool NotEmpty(this IReadOnlyCollection? collection) + public static bool IsNotEmpty(this ICollection? collection) { return collection is {Count: > 0}; } diff --git a/src/Recyclarr.TrashLib/Services/Sonarr/Capabilities/SonarrCapabilityEnforcer.cs b/src/Recyclarr.TrashLib/Services/Sonarr/Capabilities/SonarrCapabilityEnforcer.cs index 021385a7..e43b0fc9 100644 --- a/src/Recyclarr.TrashLib/Services/Sonarr/Capabilities/SonarrCapabilityEnforcer.cs +++ b/src/Recyclarr.TrashLib/Services/Sonarr/Capabilities/SonarrCapabilityEnforcer.cs @@ -30,12 +30,12 @@ public class SonarrCapabilityEnforcer switch (capabilities.SupportsCustomFormats) { - case true when config.ReleaseProfiles.NotEmpty(): + case true when config.ReleaseProfiles.IsNotEmpty(): throw new ServiceIncompatibilityException( "Release profiles require Sonarr v3. " + "Please use `custom_formats` instead or use the right version of Sonarr."); - case false when config.CustomFormats.NotEmpty(): + case false when config.CustomFormats.IsNotEmpty(): throw new ServiceIncompatibilityException( "Custom formats require Sonarr v4 or greater. " + "Please use `release_profiles` instead or use the right version of Sonarr."); diff --git a/src/Recyclarr.TrashLib/Services/Sonarr/Config/SonarrConfigurationValidator.cs b/src/Recyclarr.TrashLib/Services/Sonarr/Config/SonarrConfigurationValidator.cs index dccd9dd8..ec698d7e 100644 --- a/src/Recyclarr.TrashLib/Services/Sonarr/Config/SonarrConfigurationValidator.cs +++ b/src/Recyclarr.TrashLib/Services/Sonarr/Config/SonarrConfigurationValidator.cs @@ -12,7 +12,7 @@ public class SonarrConfigurationValidator : AbstractValidator x.ReleaseProfiles) .Empty() - .When(x => x.CustomFormats.NotEmpty()) + .When(x => x.CustomFormats.IsNotEmpty()) .WithMessage("`custom_formats` and `release_profiles` may not be used together"); RuleForEach(x => x.ReleaseProfiles).SetValidator(new ReleaseProfileConfigValidator());