From 19d41c27a460efd255a4e9f5fc0cff6a940c1a1f Mon Sep 17 00:00:00 2001 From: Robert Dailey Date: Sun, 1 May 2022 18:58:28 -0500 Subject: [PATCH] refactor: Address SonarCloud code smells --- src/Recyclarr/CompositionRoot.cs | 8 +++----- src/Recyclarr/Migration/MigrationAutofacModule.cs | 3 --- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/Recyclarr/CompositionRoot.cs b/src/Recyclarr/CompositionRoot.cs index e44bb924..70526f53 100644 --- a/src/Recyclarr/CompositionRoot.cs +++ b/src/Recyclarr/CompositionRoot.cs @@ -55,11 +55,6 @@ public static class CompositionRoot builder.RegisterGeneric(typeof(ConfigurationLoader<>)) .WithProperty(new AutowiringParameter()) .As(typeof(IConfigurationLoader<>)); - - // note: Do not allow consumers to resolve IServiceConfiguration directly; if this gets cached - // they end up using the wrong configuration when multiple instances are used. - // builder.Register(c => c.Resolve().ActiveConfiguration) - // .As(); } private static void CommandRegistrations(ContainerBuilder builder) @@ -69,6 +64,9 @@ public static class CompositionRoot .Where(t => t.IsAssignableTo(typeof(ICommand))); // Used to access the chosen command class. This is assigned from CliTypeActivator + // + // note: Do not allow consumers to resolve IServiceConfiguration directly; if this gets cached they end up using + // the wrong configuration when multiple instances are used. builder.RegisterType() .As() .SingleInstance(); diff --git a/src/Recyclarr/Migration/MigrationAutofacModule.cs b/src/Recyclarr/Migration/MigrationAutofacModule.cs index 3f9c6601..7259a5d0 100644 --- a/src/Recyclarr/Migration/MigrationAutofacModule.cs +++ b/src/Recyclarr/Migration/MigrationAutofacModule.cs @@ -13,8 +13,5 @@ public class MigrationAutofacModule : Module // Migration Steps builder.RegisterType().As(); builder.RegisterType().As(); - - // Automatically register all migration steps - // builder.RegisterAssemblyTypes(typeof(MigrationAutofacModule).Assembly).AssignableTo(); } }