diff --git a/src/Common.TestLibrary/CommonMockFileSystemExtensions.cs b/src/Common.TestLibrary/CommonMockFileSystemExtensions.cs index 1e0c25b0..db477076 100644 --- a/src/Common.TestLibrary/CommonMockFileSystemExtensions.cs +++ b/src/Common.TestLibrary/CommonMockFileSystemExtensions.cs @@ -2,6 +2,9 @@ using System.IO.Abstractions; using System.IO.Abstractions.TestingHelpers; using System.Reflection; +// ReSharper disable MemberCanBePrivate.Global +// ReSharper disable UnusedMember.Global + namespace Common.TestLibrary; public static class CommonMockFileSystemExtensions diff --git a/src/Common/AppContext.cs b/src/Common/AppContext.cs deleted file mode 100644 index 571bc8dd..00000000 --- a/src/Common/AppContext.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Common; - -public class AppContextProxy : IAppContext -{ - public string BaseDirectory => AppContext.BaseDirectory; -} diff --git a/src/Common/CommonAutofacModule.cs b/src/Common/CommonAutofacModule.cs index f0704950..5b0bc231 100644 --- a/src/Common/CommonAutofacModule.cs +++ b/src/Common/CommonAutofacModule.cs @@ -8,6 +8,5 @@ public class CommonAutofacModule : Module { builder.RegisterType().As(); builder.RegisterType().As(); - builder.RegisterType().As(); } } diff --git a/src/Common/Extensions/DictionaryExtensions.cs b/src/Common/Extensions/DictionaryExtensions.cs index 9e70ea3a..39afc6ba 100644 --- a/src/Common/Extensions/DictionaryExtensions.cs +++ b/src/Common/Extensions/DictionaryExtensions.cs @@ -5,6 +5,7 @@ public static class DictionaryExtensions public static TValue GetOrCreate(this IDictionary dict, TKey key) where TValue : new() { + // ReSharper disable once InvertIf if (!dict.TryGetValue(key, out var val)) { val = new TValue(); diff --git a/src/Common/Extensions/RegexExtensions.cs b/src/Common/Extensions/RegexExtensions.cs deleted file mode 100644 index 8303814b..00000000 --- a/src/Common/Extensions/RegexExtensions.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Diagnostics.CodeAnalysis; -using System.Text.RegularExpressions; - -namespace Common.Extensions; - -public static class RegexExtensions -{ - [SuppressMessage("Design", "CA1021:Avoid out parameters", - Justification = - "The out param has a very specific design purpose. It's to allow regex match expressions " + - "to be executed inside an if condition while also providing match output variable.")] - public static bool Match(this Regex re, string strToCheck, out Match match) - { - match = re.Match(strToCheck); - return match.Success; - } -} diff --git a/src/Common/Extensions/RxExtensions.cs b/src/Common/Extensions/RxExtensions.cs index b1088732..daeef707 100644 --- a/src/Common/Extensions/RxExtensions.cs +++ b/src/Common/Extensions/RxExtensions.cs @@ -6,6 +6,7 @@ namespace Common.Extensions; public static class RxExtensions { + // ReSharper disable once UnusedMember.Global public static IObservable Spy(this IObservable source, ILogger log, string? opName = null) { opName ??= "IObservable"; diff --git a/src/Common/Extensions/StringExtensions.cs b/src/Common/Extensions/StringExtensions.cs index 33c0a4d2..0e3707f8 100644 --- a/src/Common/Extensions/StringExtensions.cs +++ b/src/Common/Extensions/StringExtensions.cs @@ -1,5 +1,7 @@ using System.Globalization; +// ReSharper disable UnusedMember.Global + namespace Common.Extensions; public static class StringExtensions diff --git a/src/Common/FluentValidation/FluentValidationExtensions.cs b/src/Common/FluentValidation/FluentValidationExtensions.cs index 1279828d..9de9260b 100644 --- a/src/Common/FluentValidation/FluentValidationExtensions.cs +++ b/src/Common/FluentValidation/FluentValidationExtensions.cs @@ -6,6 +6,7 @@ namespace Common.FluentValidation; public static class FluentValidationExtensions { // From: https://github.com/FluentValidation/FluentValidation/issues/1648 + // ReSharper disable once UnusedMethodReturnValue.Global public static IRuleBuilderOptions SetNonNullableValidator( this IRuleBuilder ruleBuilder, IValidator validator, params string[] ruleSets) { diff --git a/src/Common/IAppContext.cs b/src/Common/IAppContext.cs deleted file mode 100644 index e7fedcbc..00000000 --- a/src/Common/IAppContext.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Common; - -public interface IAppContext -{ - string BaseDirectory { get; } -} diff --git a/src/Common/YamlDotNet/CannotBeEmptyAttribute.cs b/src/Common/YamlDotNet/CannotBeEmptyAttribute.cs index 58a4e39f..29e8fe55 100644 --- a/src/Common/YamlDotNet/CannotBeEmptyAttribute.cs +++ b/src/Common/YamlDotNet/CannotBeEmptyAttribute.cs @@ -4,6 +4,7 @@ using System.ComponentModel.DataAnnotations; namespace Common.YamlDotNet; [AttributeUsage(AttributeTargets.Property)] +// ReSharper disable once UnusedType.Global public sealed class CannotBeEmptyAttribute : RequiredAttribute { public override bool IsValid(object? value) diff --git a/src/Common/YamlDotNet/YamlDotNetExtensions.cs b/src/Common/YamlDotNet/YamlDotNetExtensions.cs index 6e712e72..ab59efac 100644 --- a/src/Common/YamlDotNet/YamlDotNetExtensions.cs +++ b/src/Common/YamlDotNet/YamlDotNetExtensions.cs @@ -2,6 +2,8 @@ using JetBrains.Annotations; using YamlDotNet.Serialization; using YamlDotNet.Serialization.NodeDeserializers; +// ReSharper disable UnusedMember.Global + namespace Common.YamlDotNet; public static class YamlDotNetExtensions diff --git a/src/Recyclarr/Command/Helpers/ExitCode.cs b/src/Recyclarr/Command/Helpers/ExitCode.cs deleted file mode 100644 index 6c0e28e5..00000000 --- a/src/Recyclarr/Command/Helpers/ExitCode.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Recyclarr.Command.Helpers; - -public enum ExitCode -{ - Success = 0, - Failure = 1 -} diff --git a/src/Recyclarr/Command/IServiceCommand.cs b/src/Recyclarr/Command/IServiceCommand.cs index 3ca67b4d..efb01159 100644 --- a/src/Recyclarr/Command/IServiceCommand.cs +++ b/src/Recyclarr/Command/IServiceCommand.cs @@ -2,8 +2,5 @@ namespace Recyclarr.Command; public interface IServiceCommand { - bool Preview { get; } - bool Debug { get; } - ICollection Config { get; } string Name { get; } } diff --git a/src/Recyclarr/Command/MigrateCommand.cs b/src/Recyclarr/Command/MigrateCommand.cs index 7159e3a7..5a96ef0b 100644 --- a/src/Recyclarr/Command/MigrateCommand.cs +++ b/src/Recyclarr/Command/MigrateCommand.cs @@ -30,6 +30,7 @@ public class MigrateCommand : BaseCommand msg.AppendLine($"Step That Failed: {e.OperationDescription}"); msg.AppendLine($"Failure Reason: {e.OriginalException.Message}"); + // ReSharper disable once InvertIf if (e.Remediation.Any()) { msg.AppendLine("\nPossible remediation steps:"); diff --git a/src/Recyclarr/Command/RadarrCommand.cs b/src/Recyclarr/Command/RadarrCommand.cs index f0b6851b..0eafba3c 100644 --- a/src/Recyclarr/Command/RadarrCommand.cs +++ b/src/Recyclarr/Command/RadarrCommand.cs @@ -18,10 +18,12 @@ internal class RadarrCommand : ServiceCommand { [CommandOption("list-custom-formats", Description = "List available custom formats from the guide in YAML format.")] + // ReSharper disable once MemberCanBePrivate.Global public bool ListCustomFormats { get; [UsedImplicitly] set; } [CommandOption("list-qualities", Description = "List available quality definition types from the guide.")] + // ReSharper disable once MemberCanBePrivate.Global public bool ListQualities { get; [UsedImplicitly] set; } public override string Name => "Radarr"; diff --git a/src/Recyclarr/Command/ServiceCommand.cs b/src/Recyclarr/Command/ServiceCommand.cs index 98022f98..d82e5bca 100644 --- a/src/Recyclarr/Command/ServiceCommand.cs +++ b/src/Recyclarr/Command/ServiceCommand.cs @@ -22,11 +22,13 @@ public abstract class ServiceCommand : BaseCommand, IServiceCommand { [CommandOption("preview", 'p', Description = "Only display the processed markdown results without making any API calls.")] + // ReSharper disable once MemberCanBeProtected.Global public bool Preview { get; [UsedImplicitly] set; } = false; [CommandOption("config", 'c', Description = "One or more YAML config files to use. All configs will be used and settings are additive. " + "If not specified, the script will look for `recyclarr.yml` in the same directory as the executable.")] + // ReSharper disable once MemberCanBeProtected.Global public ICollection Config { get; [UsedImplicitly] set; } = new List(); [CommandOption("app-data", Description = diff --git a/src/Recyclarr/Command/SonarrCommand.cs b/src/Recyclarr/Command/SonarrCommand.cs index 36620c4f..64c70c2d 100644 --- a/src/Recyclarr/Command/SonarrCommand.cs +++ b/src/Recyclarr/Command/SonarrCommand.cs @@ -32,10 +32,12 @@ public class SonarrCommand : ServiceCommand [CommandOption("list-qualities", Description = "List available quality definition types from the guide.")] + // ReSharper disable once MemberCanBeProtected.Global public bool ListQualities { get; [UsedImplicitly] set; } [CommandOption("list-custom-formats", Description = "List available custom formats from the guide in YAML format.")] + // ReSharper disable once MemberCanBeProtected.Global public bool ListCustomFormats { get; [UsedImplicitly] set; } public override string Name => "Sonarr"; diff --git a/src/Recyclarr/Config/ConfigurationLoader.cs b/src/Recyclarr/Config/ConfigurationLoader.cs index 265afaab..ead050a8 100644 --- a/src/Recyclarr/Config/ConfigurationLoader.cs +++ b/src/Recyclarr/Config/ConfigurationLoader.cs @@ -77,9 +77,6 @@ public class ConfigurationLoader : IConfigurationLoader public IEnumerable LoadMany(IEnumerable configFiles, string configSection) { - foreach (var config in configFiles.SelectMany(file => Load(file, configSection))) - { - yield return config; - } + return configFiles.SelectMany(file => Load(file, configSection)); } } diff --git a/src/TrashLib/Config/Settings/SettingsValues.cs b/src/TrashLib/Config/Settings/SettingsValues.cs index f2c2b50f..7ed72403 100644 --- a/src/TrashLib/Config/Settings/SettingsValues.cs +++ b/src/TrashLib/Config/Settings/SettingsValues.cs @@ -1,20 +1,22 @@ +using JetBrains.Annotations; + namespace TrashLib.Config.Settings; public record TrashRepository { - public string CloneUrl { get; init; } = "https://github.com/TRaSH-/Guides.git"; - public string Branch { get; init; } = "master"; - public string? Sha1 { get; init; } + public string CloneUrl { get; [UsedImplicitly] init; } = "https://github.com/TRaSH-/Guides.git"; + public string Branch { get; [UsedImplicitly] init; } = "master"; + public string? Sha1 { get; [UsedImplicitly] init; } } public record LogJanitorSettings { - public int MaxFiles { get; init; } = 20; + public int MaxFiles { get; [UsedImplicitly] init; } = 20; } public record SettingsValues { - public TrashRepository Repository { get; init; } = new(); - public bool EnableSslCertificateValidation { get; init; } = true; - public LogJanitorSettings LogJanitor { get; init; } = new(); + public TrashRepository Repository { get; [UsedImplicitly] init; } = new(); + public bool EnableSslCertificateValidation { get; [UsedImplicitly] init; } = true; + public LogJanitorSettings LogJanitor { get; [UsedImplicitly] init; } = new(); } diff --git a/src/TrashLib/Services/Radarr/QualityDefinition/RadarrQualityData.cs b/src/TrashLib/Services/Radarr/QualityDefinition/RadarrQualityData.cs index a22c3ee4..cdc8ab90 100644 --- a/src/TrashLib/Services/Radarr/QualityDefinition/RadarrQualityData.cs +++ b/src/TrashLib/Services/Radarr/QualityDefinition/RadarrQualityData.cs @@ -1,6 +1,7 @@ namespace TrashLib.Services.Radarr.QualityDefinition; public record RadarrQualityData( + // ReSharper disable once NotAccessedPositionalProperty.Global string TrashId, string Type, IReadOnlyCollection Qualities diff --git a/src/TrashLib/Services/Sonarr/Api/Objects/SonarrTag.cs b/src/TrashLib/Services/Sonarr/Api/Objects/SonarrTag.cs index 1b17f41c..ac1fd78a 100644 --- a/src/TrashLib/Services/Sonarr/Api/Objects/SonarrTag.cs +++ b/src/TrashLib/Services/Sonarr/Api/Objects/SonarrTag.cs @@ -1,7 +1,9 @@ +using JetBrains.Annotations; + namespace TrashLib.Services.Sonarr.Api.Objects; public class SonarrTag { - public string Label { get; set; } = ""; - public int Id { get; set; } + public string Label { get; [UsedImplicitly] set; } = ""; + public int Id { get; [UsedImplicitly] set; } } diff --git a/src/TrashLib/Services/Sonarr/Config/SonarrConfiguration.cs b/src/TrashLib/Services/Sonarr/Config/SonarrConfiguration.cs index 4d0d4349..067a2257 100644 --- a/src/TrashLib/Services/Sonarr/Config/SonarrConfiguration.cs +++ b/src/TrashLib/Services/Sonarr/Config/SonarrConfiguration.cs @@ -1,23 +1,26 @@ +using JetBrains.Annotations; using TrashLib.Config.Services; namespace TrashLib.Services.Sonarr.Config; public class SonarrConfiguration : ServiceConfiguration { - public IList ReleaseProfiles { get; init; } = Array.Empty(); - public string QualityDefinition { get; init; } = ""; + public IList ReleaseProfiles { get; [UsedImplicitly] init; } = + Array.Empty(); + + public string QualityDefinition { get; [UsedImplicitly] init; } = ""; } public class ReleaseProfileConfig { - public IReadOnlyCollection TrashIds { get; init; } = Array.Empty(); - public bool StrictNegativeScores { get; init; } - public IReadOnlyCollection Tags { get; init; } = Array.Empty(); - public SonarrProfileFilterConfig? Filter { get; init; } + public IReadOnlyCollection TrashIds { get; [UsedImplicitly] init; } = Array.Empty(); + public bool StrictNegativeScores { get; [UsedImplicitly] init; } + public IReadOnlyCollection Tags { get; [UsedImplicitly] init; } = Array.Empty(); + public SonarrProfileFilterConfig? Filter { get; [UsedImplicitly] init; } } public class SonarrProfileFilterConfig { - public IReadOnlyCollection Include { get; init; } = Array.Empty(); - public IReadOnlyCollection Exclude { get; init; } = Array.Empty(); + public IReadOnlyCollection Include { get; [UsedImplicitly] init; } = Array.Empty(); + public IReadOnlyCollection Exclude { get; [UsedImplicitly] init; } = Array.Empty(); } diff --git a/src/TrashLib/Services/Sonarr/QualityDefinition/SonarrQualityData.cs b/src/TrashLib/Services/Sonarr/QualityDefinition/SonarrQualityData.cs index f0f614d3..064d8766 100644 --- a/src/TrashLib/Services/Sonarr/QualityDefinition/SonarrQualityData.cs +++ b/src/TrashLib/Services/Sonarr/QualityDefinition/SonarrQualityData.cs @@ -3,6 +3,7 @@ using TrashLib.Services.Common.QualityDefinition; namespace TrashLib.Services.Sonarr.QualityDefinition; public record SonarrQualityData( + // ReSharper disable once NotAccessedPositionalProperty.Global string TrashId, string Type, IReadOnlyCollection Qualities