From 39aa061fcfc88cde86f90593233780db43aab29c Mon Sep 17 00:00:00 2001 From: Rain Sallow Date: Wed, 3 Apr 2024 11:52:15 -0400 Subject: [PATCH 01/18] (maint) Update editorconfig per team preferences Following on from the team's meetings about code style preferences, updating the editorconfig to match the desired preferences. --- .editorconfig | 71 ++++++++++--------- .../chocolatey.console.csproj | 1 + .../chocolatey.resources.csproj | 1 + 3 files changed, 40 insertions(+), 33 deletions(-) diff --git a/.editorconfig b/.editorconfig index 7442cc4b63..155eef78a7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -14,28 +14,28 @@ indent_size = 4 dotnet_diagnostic.RS0030.severity=error dotnet_diagnostic.RS0031.severity=error dotnet_diagnostic.RS0035.severity=error -csharp_using_directive_placement = inside_namespace:silent +csharp_using_directive_placement = outside_namespace:warning csharp_prefer_simple_using_statement = true:suggestion -csharp_prefer_braces = true:silent -csharp_style_namespace_declarations = block_scoped:suggestion +csharp_prefer_braces = true:error +csharp_style_namespace_declarations = block_scoped:error csharp_style_prefer_method_group_conversion = true:silent -csharp_style_prefer_top_level_statements = true:silent -csharp_style_expression_bodied_methods = false:silent -csharp_style_expression_bodied_constructors = false:suggestion -csharp_style_expression_bodied_operators = false:silent -csharp_style_expression_bodied_properties = true:silent -csharp_style_expression_bodied_indexers = true:silent -csharp_style_expression_bodied_accessors = true:silent +csharp_style_prefer_top_level_statements = false:error +csharp_style_expression_bodied_methods = false:warning +csharp_style_expression_bodied_constructors = false:warning +csharp_style_expression_bodied_operators = false:warning +csharp_style_expression_bodied_properties = false:warning +csharp_style_expression_bodied_indexers = false:warning +csharp_style_expression_bodied_accessors = false:warning csharp_style_expression_bodied_lambdas = true:silent -csharp_style_expression_bodied_local_functions = false:silent +csharp_style_expression_bodied_local_functions = false:error csharp_indent_labels = no_change csharp_space_around_binary_operators = before_and_after -csharp_style_throw_expression = true:suggestion -csharp_style_prefer_null_check_over_type_check = true:suggestion +csharp_style_throw_expression = true:silent +csharp_style_prefer_null_check_over_type_check = true:error csharp_prefer_simple_default_expression = true:suggestion csharp_style_prefer_local_over_anonymous_function = true:suggestion csharp_style_prefer_index_operator = true:suggestion -csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion +csharp_style_implicit_object_creation_when_type_is_apparent = false:warning csharp_style_prefer_range_operator = true:suggestion csharp_style_prefer_tuple_swap = true:suggestion csharp_style_prefer_utf8_string_literals = true:suggestion @@ -55,9 +55,13 @@ csharp_style_prefer_pattern_matching = true:suggestion csharp_style_prefer_not_pattern = true:suggestion csharp_style_pattern_matching_over_as_with_null_check = true:suggestion csharp_style_prefer_extended_property_pattern = true:suggestion -csharp_style_var_for_built_in_types = true:suggestion -csharp_style_var_when_type_is_apparent = true:suggestion -csharp_style_var_elsewhere = true:suggestion +csharp_style_var_for_built_in_types = true:warning +csharp_style_var_when_type_is_apparent = true:warning +csharp_style_var_elsewhere = false:silent +csharp_style_prefer_primary_constructors = false:error +csharp_style_prefer_readonly_struct_member = true:suggestion +csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent +csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent [*.{cs,vb}] #### Naming styles #### @@ -149,31 +153,32 @@ tab_width = 4 indent_size = 4 dotnet_style_coalesce_expression = true:suggestion dotnet_style_null_propagation = true:suggestion -dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion -dotnet_style_prefer_auto_properties = true:silent -dotnet_style_object_initializer = true:suggestion -dotnet_style_collection_initializer = true:suggestion -dotnet_style_prefer_simplified_boolean_expressions = true:suggestion -dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion -dotnet_style_prefer_conditional_expression_over_return = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning +dotnet_style_prefer_auto_properties = true:warning +dotnet_style_object_initializer = true:warning +dotnet_style_collection_initializer = true:warning +dotnet_style_prefer_simplified_boolean_expressions = true:warning +dotnet_style_prefer_conditional_expression_over_assignment = true:silent +dotnet_style_prefer_conditional_expression_over_return = true:silent dotnet_style_explicit_tuple_names = true:suggestion dotnet_style_prefer_inferred_tuple_names = true:suggestion dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion dotnet_style_prefer_compound_assignment = true:suggestion dotnet_style_prefer_simplified_interpolation = true:suggestion -dotnet_style_namespace_match_folder = true:suggestion +dotnet_style_namespace_match_folder = true:error dotnet_style_readonly_field = true:suggestion -dotnet_style_predefined_type_for_locals_parameters_members = true:silent -dotnet_style_predefined_type_for_member_access = true:silent -dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent +dotnet_style_predefined_type_for_locals_parameters_members = true:warning +dotnet_style_predefined_type_for_member_access = true:warning +dotnet_style_require_accessibility_modifiers = for_non_interface_members:error dotnet_style_allow_multiple_blank_lines_experimental = true:silent dotnet_style_allow_statement_immediately_after_block_experimental = true:silent -dotnet_code_quality_unused_parameters = all:suggestion +dotnet_code_quality_unused_parameters = all:error dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent -dotnet_style_qualification_for_property = false:suggestion -dotnet_style_qualification_for_field = false:suggestion -dotnet_style_qualification_for_method = false:suggestion -dotnet_style_qualification_for_event = false:suggestion +dotnet_style_qualification_for_property = false:error +dotnet_style_qualification_for_field = false:error +dotnet_style_qualification_for_method = false:error +dotnet_style_qualification_for_event = false:error +dotnet_style_prefer_collection_expression = true:suggestion diff --git a/src/chocolatey.console/chocolatey.console.csproj b/src/chocolatey.console/chocolatey.console.csproj index 53854ff273..92cfc151e8 100644 --- a/src/chocolatey.console/chocolatey.console.csproj +++ b/src/chocolatey.console/chocolatey.console.csproj @@ -15,6 +15,7 @@ 512 ..\ + true x86 diff --git a/src/chocolatey.resources/chocolatey.resources.csproj b/src/chocolatey.resources/chocolatey.resources.csproj index a43e256039..9ac71dba5f 100644 --- a/src/chocolatey.resources/chocolatey.resources.csproj +++ b/src/chocolatey.resources/chocolatey.resources.csproj @@ -13,6 +13,7 @@ v4.8 512 + true true From c8f0702880070c6729323626a04f4a4df86c2ec7 Mon Sep 17 00:00:00 2001 From: Rain Sallow Date: Wed, 3 Apr 2024 14:18:25 -0400 Subject: [PATCH 02/18] (maint) Disable style rules for option.cs This file we tend not to touch, so evaluating every style rule here is a bit pointless, especially as we want to try replacing this when we get an opportunity. --- src/chocolatey/infrastructure/commandline/Options.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/chocolatey/infrastructure/commandline/Options.cs b/src/chocolatey/infrastructure/commandline/Options.cs index 8468e37cd2..bf16a7223d 100644 --- a/src/chocolatey/infrastructure/commandline/Options.cs +++ b/src/chocolatey/infrastructure/commandline/Options.cs @@ -133,6 +133,10 @@ using NDesk.Options; #endif + +// Disable anything this file runs into, we generally don't put much maintenance in here. +#pragma warning disable IDE0003, IDE0006, IDE0007, IDE0008,IDE0011, IDE0032, IDE0040, IDE0046, IDE0049, IDE0055, IDE0075, IDE1006 + namespace chocolatey.infrastructure.commandline { @@ -242,8 +246,8 @@ public override string ToString () } public class OptionContext { - private Option option; - private string name; + private Option option; + private string name; private int index; private OptionSet set; private OptionValueCollection c; @@ -1147,3 +1151,5 @@ private static int GetLineEnd (int start, int length, string description) // ReSharper restore InconsistentNaming } + +#pragma warning restore IDE0003, IDE0006, IDE0007, IDE0008,IDE0011, IDE0032, IDE0040, IDE0046, IDE0049, IDE0055, IDE0075, IDE1006 \ No newline at end of file From 83843b702abfb7b93621e5b17df507f9d534c023 Mon Sep 17 00:00:00 2001 From: Rain Sallow Date: Wed, 3 Apr 2024 15:01:36 -0400 Subject: [PATCH 03/18] (maint) Disable warnings on deprecated methods These overloads will be removed anyway, we don't need the warning noise from these. --- .../MockEventSubscriptionManager.cs | 4 ++-- src/chocolatey/AssemblyExtensions.cs | 4 ++-- src/chocolatey/EnumExtensions.cs | 4 ++-- src/chocolatey/EnumerableExtensions.cs | 4 ++-- src/chocolatey/FileSystemExtensions.cs | 4 ++-- src/chocolatey/NuGetVersionExtensions.cs | 4 ++-- src/chocolatey/ObjectExtensions.cs | 4 ++-- src/chocolatey/RuleResultExtensions.cs | 4 ++-- src/chocolatey/StringExtensions.cs | 4 ++-- src/chocolatey/TypeExtensions.cs | 4 ++-- .../infrastructure.app/ApplicationParameters.cs | 4 ++-- .../builders/ConfigurationBuilder.cs | 4 ++-- .../commands/ChocolateyApiKeyCommand.cs | 4 ++-- .../commands/ChocolateyConfigCommand.cs | 4 ++-- .../commands/ChocolateyExportCommand.cs | 4 ++-- .../commands/ChocolateyFeatureCommand.cs | 4 ++-- .../commands/ChocolateyHelpCommand.cs | 4 ++-- .../commands/ChocolateyInstallCommand.cs | 4 ++-- .../commands/ChocolateyListCommand.cs | 4 ++-- .../commands/ChocolateyNewCommand.cs | 4 ++-- .../commands/ChocolateyOutdatedCommand.cs | 4 ++-- .../commands/ChocolateyPackCommand.cs | 4 ++-- .../commands/ChocolateyPinCommand.cs | 4 ++-- .../commands/ChocolateyPushCommand.cs | 4 ++-- .../commands/ChocolateySearchCommand.cs | 4 ++-- .../commands/ChocolateySourceCommand.cs | 4 ++-- .../commands/ChocolateyTemplateCommand.cs | 4 ++-- .../commands/ChocolateyUninstallCommand.cs | 4 ++-- .../commands/ChocolateyUnpackSelfCommand.cs | 4 ++-- .../commands/ChocolateyUpgradeCommand.cs | 4 ++-- .../configuration/ChocolateyConfiguration.cs | 4 ++-- .../configuration/ConfigurationOptions.cs | 4 ++-- .../configuration/EnvironmentSettings.cs | 4 ++-- .../infrastructure.app/domain/CommandNameType.cs | 4 ++-- .../infrastructure.app/domain/ConfigCommandType.cs | 4 ++-- .../infrastructure.app/domain/FeatureCommandType.cs | 4 ++-- .../infrastructure.app/domain/InstallTokens.cs | 4 ++-- .../infrastructure.app/domain/PinCommandType.cs | 4 ++-- .../domain/RegistryApplicationKey.cs | 4 ++-- .../domain/RegistryValueExtensions.cs | 4 ++-- .../infrastructure.app/domain/SourceCommandType.cs | 4 ++-- .../infrastructure.app/domain/SourceTypes.cs | 4 ++-- .../infrastructure.app/domain/TemplateCommandType.cs | 4 ++-- .../domain/installers/IInstaller.cs | 4 ++-- .../domain/installers/InstallerBase.cs | 4 ++-- .../nuget/ChocolateyNugetCredentialProvider.cs | 4 ++-- .../infrastructure.app/nuget/NugetCommon.cs | 6 ++++-- .../nuget/NugetEncryptionUtility.cs | 4 ++-- src/chocolatey/infrastructure.app/nuget/NugetList.cs | 4 ++-- src/chocolatey/infrastructure.app/nuget/NugetPush.cs | 4 ++-- .../registration/ChocolateyRegistrationModule.cs | 4 ++-- .../registration/IContainerRegistrator.cs | 4 ++-- .../registration/IContainerResolver.cs | 4 ++-- .../registration/IExtensionConfiguration.cs | 4 ++-- .../registration/IExtensionEnvironment.cs | 4 ++-- .../registration/IExtensionModule.cs | 4 ++-- .../SimpleInjectorContainerRegistrator.cs | 4 ++-- .../registration/SimpleInjectorContainerResolver.cs | 4 ++-- .../infrastructure.app/rules/MetadataRuleBase.cs | 4 ++-- .../infrastructure.app/runners/ConsoleApplication.cs | 4 ++-- .../infrastructure.app/runners/GenericRunner.cs | 4 ++-- .../services/AutomaticUninstallerService.cs | 4 ++-- .../services/ChocolateyConfigSettingsService.cs | 4 ++-- .../services/ChocolateyPackageInformationService.cs | 4 ++-- .../services/ChocolateyPackageService.cs | 4 ++-- .../services/ConfigTransformService.cs | 4 ++-- .../infrastructure.app/services/CygwinService.cs | 4 ++-- .../infrastructure.app/services/FilesService.cs | 4 ++-- .../services/IAutomaticUninstallerService.cs | 4 ++-- .../services/IChocolateyConfigSettingsService.cs | 4 ++-- .../services/IChocolateyPackageInformationService.cs | 4 ++-- .../services/IChocolateyPackageService.cs | 4 ++-- .../services/IConfigTransformService.cs | 4 ++-- .../infrastructure.app/services/IFilesService.cs | 4 ++-- .../infrastructure.app/services/INugetService.cs | 4 ++-- .../services/IPendingRebootService.cs | 4 ++-- .../services/IPowershellService.cs | 4 ++-- .../infrastructure.app/services/IRegistryService.cs | 4 ++-- .../services/IShimGenerationService.cs | 4 ++-- .../infrastructure.app/services/ISourceRunner.cs | 4 ++-- .../infrastructure.app/services/ITemplateService.cs | 4 ++-- .../infrastructure.app/services/NugetService.cs | 4 ++-- .../services/PendingRebootService.cs | 4 ++-- .../infrastructure.app/services/PowershellService.cs | 4 ++-- .../infrastructure.app/services/PythonService.cs | 4 ++-- .../infrastructure.app/services/RegistryService.cs | 4 ++-- .../infrastructure.app/services/RubyGemsService.cs | 4 ++-- .../infrastructure.app/services/RuleService.cs | 4 ++-- .../services/ShimGenerationService.cs | 4 ++-- .../infrastructure.app/services/TemplateService.cs | 4 ++-- .../services/WindowsFeatureService.cs | 4 ++-- .../tasks/RemovePendingPackagesTask.cs | 4 ++-- .../infrastructure.app/templates/TemplateValues.cs | 4 ++-- .../infrastructure.app/utility/ArgumentsUtility.cs | 4 ++-- .../infrastructure.app/utility/PackageUtility.cs | 4 ++-- .../validations/CacheFolderValidationLockdown.cs | 4 ++-- .../validations/GlobalConfigurationValidation.cs | 4 ++-- .../validations/SystemStateValidation.cs | 4 ++-- src/chocolatey/infrastructure/adapters/Assembly.cs | 4 ++-- .../infrastructure/adapters/IEncryptionUtility.cs | 4 ++-- .../infrastructure/commandline/InteractivePrompt.cs | 4 ++-- .../infrastructure/commandline/ReadKeyTimeout.cs | 4 ++-- .../infrastructure/commandline/ReadLineTimeout.cs | 4 ++-- .../infrastructure/commands/CommandExecutor.cs | 4 ++-- src/chocolatey/infrastructure/commands/Execute.cs | 4 ++-- .../commands/ExternalCommandArgsBuilder.cs | 4 ++-- src/chocolatey/infrastructure/commands/ICommand.cs | 4 ++-- .../infrastructure/commands/ICommandExecutor.cs | 4 ++-- .../infrastructure/commands/IListCommand.cs | 8 ++++---- .../infrastructure/commands/PowershellExecutor.cs | 4 ++-- .../infrastructure/configuration/Config.cs | 4 ++-- .../cryptography/CryptoHashProvider.cs | 4 ++-- .../cryptography/DefaultEncryptionUtility.cs | 4 ++-- .../infrastructure/cryptography/IHashProvider.cs | 4 ++-- src/chocolatey/infrastructure/events/EventManager.cs | 4 ++-- .../extractors/AssemblyFileExtractor.cs | 4 ++-- .../infrastructure/filesystem/DotNetFileSystem.cs | 4 ++-- .../infrastructure/filesystem/FileSystem.cs | 4 ++-- .../infrastructure/filesystem/IFileSystem.cs | 4 ++-- src/chocolatey/infrastructure/guards/Ensure.cs | 12 ++++++------ .../infrastructure/information/ProcessInformation.cs | 4 ++-- .../infrastructure/information/VersionInformation.cs | 4 ++-- .../infrastructure/licensing/ChocolateyLicense.cs | 4 ++-- src/chocolatey/infrastructure/licensing/License.cs | 4 ++-- .../infrastructure/licensing/LicenseValidation.cs | 4 ++-- .../logging/Log4NetAppenderConfiguration.cs | 4 ++-- src/chocolatey/infrastructure/logging/Log4NetLog.cs | 4 ++-- src/chocolatey/infrastructure/platforms/Platform.cs | 4 ++-- .../registration/AssemblyResolution.cs | 4 ++-- .../infrastructure/registration/Bootstrap.cs | 4 ++-- .../infrastructure/registration/SecurityProtocol.cs | 4 ++-- .../registration/SimpleInjectorContainer.cs | 4 ++-- src/chocolatey/infrastructure/results/Result.cs | 4 ++-- src/chocolatey/infrastructure/rules/IMetadataRule.cs | 4 ++-- .../services/EventSubscriptionManagerService.cs | 4 ++-- .../infrastructure/services/IDateTimeService.cs | 4 ++-- .../services/IEventSubscriptionManagerService.cs | 4 ++-- .../services/IRegularExpressionService.cs | 4 ++-- .../infrastructure/services/IRuleService.cs | 4 ++-- .../infrastructure/services/IXmlService.cs | 4 ++-- .../services/RegularExpressionService.cs | 4 ++-- .../infrastructure/services/SystemDateTimeService.cs | 4 ++-- .../services/SystemDateTimeUtcService.cs | 4 ++-- src/chocolatey/infrastructure/services/XmlService.cs | 4 ++-- .../infrastructure/synchronization/GlobalMutex.cs | 4 ++-- src/chocolatey/infrastructure/tasks/ITask.cs | 4 ++-- .../infrastructure/tokens/TokenReplacer.cs | 4 ++-- .../infrastructure/tolerance/FaultTolerance.cs | 4 ++-- .../infrastructure/validations/IValidation.cs | 4 ++-- 149 files changed, 306 insertions(+), 304 deletions(-) diff --git a/src/chocolatey.tests.integration/MockEventSubscriptionManager.cs b/src/chocolatey.tests.integration/MockEventSubscriptionManager.cs index b5bf610773..c4769998e3 100644 --- a/src/chocolatey.tests.integration/MockEventSubscriptionManager.cs +++ b/src/chocolatey.tests.integration/MockEventSubscriptionManager.cs @@ -45,7 +45,7 @@ public IDisposable Subscribe(Action handleEvent, Action return new Subject(); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public void publish(Event eventMessage) where Event : class, IMessage => Publish(eventMessage); @@ -53,6 +53,6 @@ public void publish(Event eventMessage) where Event : class, IMessage [Obsolete("This overload is deprecated and will be removed in v3.")] public IDisposable subscribe(Action handleEvent, Action handleError, Func filter) where Event : class, IMessage => Subscribe(handleEvent, handleError, filter); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 } } diff --git a/src/chocolatey/AssemblyExtensions.cs b/src/chocolatey/AssemblyExtensions.cs index dd9330e67c..510379431e 100644 --- a/src/chocolatey/AssemblyExtensions.cs +++ b/src/chocolatey/AssemblyExtensions.cs @@ -139,7 +139,7 @@ public static IEnumerable GetExtensionModules(this IAssembly a return result; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static string get_manifest_string(this IAssembly assembly, string manifestResourceStreamLocation) => GetManifestString(assembly, manifestResourceStreamLocation); @@ -163,6 +163,6 @@ public static IEnumerable get_loadable_types(this IAssembly assembly) [Obsolete("This overload is deprecated and will be removed in v3.")] public static IEnumerable get_extension_modules(this IAssembly assembly) => GetExtensionModules(assembly); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/EnumExtensions.cs b/src/chocolatey/EnumExtensions.cs index de8d879604..0950b235bd 100644 --- a/src/chocolatey/EnumExtensions.cs +++ b/src/chocolatey/EnumExtensions.cs @@ -66,7 +66,7 @@ public static TEnum ParseEnumDescription(this string description) return default(TEnum); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static string get_description_or_value(this Enum enumeration) => DescriptionOrValue(enumeration); @@ -75,6 +75,6 @@ public static string get_description_or_value(this Enum enumeration) public static TEnum parse_enum_from_description(this string description) where TEnum : struct, Enum => ParseEnumDescription(description); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/EnumerableExtensions.cs b/src/chocolatey/EnumerableExtensions.cs index 1880e7fd32..db17c3bd6e 100644 --- a/src/chocolatey/EnumerableExtensions.cs +++ b/src/chocolatey/EnumerableExtensions.cs @@ -122,7 +122,7 @@ public static int SequenceHashCode(this IEnumerable source) } } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static IEnumerable or_empty_list_if_null(this IEnumerable source) => OrEmpty(source); @@ -142,6 +142,6 @@ public static IEnumerable distinct_last(this IEnumerable source, IEqual [Obsolete("This overload is deprecated and will be removed in v3.")] public static int get_sequence_hash_code(this IEnumerable source) => SequenceHashCode(source); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/FileSystemExtensions.cs b/src/chocolatey/FileSystemExtensions.cs index 9791cdde24..af6b198caa 100644 --- a/src/chocolatey/FileSystemExtensions.cs +++ b/src/chocolatey/FileSystemExtensions.cs @@ -66,10 +66,10 @@ internal static IEnumerable GetExtensionAssemblies(this IFileSystem f return result.Distinct(); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] internal static IEnumerable get_extension_assemblies(this IFileSystem fileSystem) => GetExtensionAssemblies(fileSystem); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/NuGetVersionExtensions.cs b/src/chocolatey/NuGetVersionExtensions.cs index 6bef91eda4..abac470c41 100644 --- a/src/chocolatey/NuGetVersionExtensions.cs +++ b/src/chocolatey/NuGetVersionExtensions.cs @@ -59,7 +59,7 @@ public static string ToNormalizedStringChecked(this NuGetVersion version) } #pragma warning restore RS0030 // Do not used banned APIs -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static string to_full_string(this NuGetVersion version) => ToFullStringChecked(version); @@ -67,6 +67,6 @@ public static string to_full_string(this NuGetVersion version) [Obsolete("This overload is deprecated and will be removed in v3.")] public static string to_normalized_string(this NuGetVersion version) => ToNormalizedStringChecked(version); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/ObjectExtensions.cs b/src/chocolatey/ObjectExtensions.cs index f7a7a7c546..a714faf7f2 100644 --- a/src/chocolatey/ObjectExtensions.cs +++ b/src/chocolatey/ObjectExtensions.cs @@ -48,7 +48,7 @@ public static T DeepCopy(this T other) } } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static string to_string(this object input) => ToStringSafe(input); @@ -56,6 +56,6 @@ public static string to_string(this object input) [Obsolete("This overload is deprecated and will be removed in v3.")] public static T deep_copy(this T other) => DeepCopy(other); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/RuleResultExtensions.cs b/src/chocolatey/RuleResultExtensions.cs index 50a1a1504d..492d7c465b 100644 --- a/src/chocolatey/RuleResultExtensions.cs +++ b/src/chocolatey/RuleResultExtensions.cs @@ -42,10 +42,10 @@ public static IEnumerable WhereUnsupportedOrDeprecated(this IEnumera .Where(r => string.IsNullOrEmpty(r.Id) || (!r.Id.StartsWith("CHCU") && !r.Id.StartsWith("CHCD"))); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static IEnumerable where_unsupported_or_deprecated(this IEnumerable ruleResults, bool inverse = false) => WhereUnsupportedOrDeprecated(ruleResults, inverse); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/StringExtensions.cs b/src/chocolatey/StringExtensions.cs index 5da1455870..3cdfdd35a6 100644 --- a/src/chocolatey/StringExtensions.cs +++ b/src/chocolatey/StringExtensions.cs @@ -290,7 +290,7 @@ public static string QuoteIfContainsPipe(this string input) return input; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static string format_with(this string input, params object[] formatting) => FormatWith(input, formatting); @@ -338,6 +338,6 @@ public static string escape_curly_braces(this string input) [Obsolete("This overload is deprecated and will be removed in v3.")] public static string quote_if_pipe_found(this string input) => QuoteIfContainsPipe(input); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/TypeExtensions.cs b/src/chocolatey/TypeExtensions.cs index 29457b3165..42af1cf895 100644 --- a/src/chocolatey/TypeExtensions.cs +++ b/src/chocolatey/TypeExtensions.cs @@ -53,7 +53,7 @@ public static bool IsCollectionType(this Type type) || type.Namespace.Contains("System.Collections"); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static bool is_built_in_system_type(this Type type) => IsBuiltinType(type); @@ -61,6 +61,6 @@ public static bool is_built_in_system_type(this Type type) [Obsolete("This overload is deprecated and will be removed in v3.")] public static bool is_collections_type(this Type type) => IsCollectionType(type); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/ApplicationParameters.cs b/src/chocolatey/infrastructure.app/ApplicationParameters.cs index 4f28197ce0..8f413ddab1 100644 --- a/src/chocolatey/infrastructure.app/ApplicationParameters.cs +++ b/src/chocolatey/infrastructure.app/ApplicationParameters.cs @@ -251,10 +251,10 @@ public static bool IsDebugModeCliPrimitive() return isDebug; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static bool is_debug_mode_cli_primitive() => IsDebugModeCliPrimitive(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs index 2f0055b3af..e593c4c6f6 100644 --- a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs +++ b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs @@ -605,7 +605,7 @@ FIPS Mode detected - run 'choco feature enable -n {0}' } } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] [EditorBrowsable(EditorBrowsableState.Never)] public static void initialize_with(Lazy environment) @@ -618,6 +618,6 @@ public static bool is_compatibility_checks_disabled(IFileSystem filesystem, IXml [Obsolete("This overload is deprecated and will be removed in v3.")] public static void set_up_configuration(IList args, ChocolateyConfiguration config, Container container, ChocolateyLicense license, Action notifyWarnLoggingAction) => SetupConfiguration(args, config, container, license, notifyWarnLoggingAction); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs index 5840d1db41..b0a7900a81 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs @@ -217,7 +217,7 @@ public virtual bool MayRequireAdminAccess() return !string.IsNullOrWhiteSpace(config.ApiKeyCommand.Key); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyConfiguration configuration) => ConfigureArgumentParser(optionSet, configuration); @@ -245,6 +245,6 @@ public virtual void run(ChocolateyConfiguration configuration) [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual bool may_require_admin_access() => MayRequireAdminAccess(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs index e878133fb8..59af1fc88f 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs @@ -172,7 +172,7 @@ public virtual bool MayRequireAdminAccess() return config.ConfigCommand.Command != ConfigCommandType.List; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyConfiguration configuration) => ConfigureArgumentParser(optionSet, configuration); @@ -200,6 +200,6 @@ public virtual void run(ChocolateyConfiguration configuration) [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual bool may_require_admin_access() => MayRequireAdminAccess(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyExportCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyExportCommand.cs index ce8fd569a5..46302b6e60 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyExportCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyExportCommand.cs @@ -195,7 +195,7 @@ public void Run(ChocolateyConfiguration configuration) ); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyConfiguration configuration) => ConfigureArgumentParser(optionSet, configuration); @@ -223,6 +223,6 @@ public virtual void run(ChocolateyConfiguration configuration) [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual bool may_require_admin_access() => MayRequireAdminAccess(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs index 968e161661..9df151432e 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs @@ -162,7 +162,7 @@ public virtual bool MayRequireAdminAccess() return config.FeatureCommand.Command != FeatureCommandType.List; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyConfiguration configuration) => ConfigureArgumentParser(optionSet, configuration); @@ -190,6 +190,6 @@ public virtual void run(ChocolateyConfiguration configuration) [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual bool may_require_admin_access() => MayRequireAdminAccess(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyHelpCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyHelpCommand.cs index 221665768d..fd22fe12bd 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyHelpCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyHelpCommand.cs @@ -266,7 +266,7 @@ everywhere they are used and with newer versions of Chocolatey. "chocolatey".Log().Info(ChocolateyLoggers.Important, "Default Options and Switches"); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyConfiguration configuration) => ConfigureArgumentParser(optionSet, configuration); @@ -294,6 +294,6 @@ public virtual void run(ChocolateyConfiguration configuration) [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual bool may_require_admin_access() => MayRequireAdminAccess(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs index 78f78b9787..bcd42ec666 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs @@ -431,7 +431,7 @@ public virtual bool MayRequireAdminAccess() return true; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyConfiguration configuration) => ConfigureArgumentParser(optionSet, configuration); @@ -459,6 +459,6 @@ public virtual void run(ChocolateyConfiguration configuration) [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual bool may_require_admin_access() => MayRequireAdminAccess(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs index 9e37dd568b..a9a1c4ef1a 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs @@ -269,7 +269,7 @@ public virtual void Run(ChocolateyConfiguration config) } } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyConfiguration configuration) => ConfigureArgumentParser(optionSet, configuration); @@ -305,6 +305,6 @@ public virtual int count(ChocolateyConfiguration config) [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual IEnumerable list(ChocolateyConfiguration config) => List(config); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyNewCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyNewCommand.cs index 859f51affe..3c24cc51ea 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyNewCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyNewCommand.cs @@ -193,7 +193,7 @@ public virtual bool MayRequireAdminAccess() return false; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyConfiguration configuration) => ConfigureArgumentParser(optionSet, configuration); @@ -221,6 +221,6 @@ public virtual void run(ChocolateyConfiguration configuration) [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual bool may_require_admin_access() => MayRequireAdminAccess(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyOutdatedCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyOutdatedCommand.cs index af63ffed56..e0238c4485 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyOutdatedCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyOutdatedCommand.cs @@ -166,7 +166,7 @@ public virtual bool MayRequireAdminAccess() return false; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyConfiguration configuration) => ConfigureArgumentParser(optionSet, configuration); @@ -194,6 +194,6 @@ public virtual void run(ChocolateyConfiguration configuration) [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual bool may_require_admin_access() => MayRequireAdminAccess(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyPackCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyPackCommand.cs index 1236b00f91..9723772468 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyPackCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyPackCommand.cs @@ -136,7 +136,7 @@ public virtual bool MayRequireAdminAccess() return false; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyConfiguration configuration) => ConfigureArgumentParser(optionSet, configuration); @@ -164,6 +164,6 @@ public virtual void run(ChocolateyConfiguration configuration) [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual bool may_require_admin_access() => MayRequireAdminAccess(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs index ef4ebe3d36..6b55dc389c 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs @@ -229,7 +229,7 @@ public virtual bool MayRequireAdminAccess() return config.PinCommand.Command != PinCommandType.List; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyConfiguration configuration) => ConfigureArgumentParser(optionSet, configuration); @@ -257,6 +257,6 @@ public virtual void run(ChocolateyConfiguration configuration) [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual bool may_require_admin_access() => MayRequireAdminAccess(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs index 390b1cd877..fe67e3c581 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs @@ -194,7 +194,7 @@ public virtual bool MayRequireAdminAccess() return false; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyConfiguration configuration) => ConfigureArgumentParser(optionSet, configuration); @@ -222,6 +222,6 @@ public virtual void run(ChocolateyConfiguration configuration) [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual bool may_require_admin_access() => MayRequireAdminAccess(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateySearchCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateySearchCommand.cs index 28c3368a73..018dcd2028 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateySearchCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateySearchCommand.cs @@ -249,7 +249,7 @@ public virtual bool MayRequireAdminAccess() return false; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyConfiguration configuration) => ConfigureArgumentParser(optionSet, configuration); @@ -285,6 +285,6 @@ public virtual int count(ChocolateyConfiguration config) [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual IEnumerable list(ChocolateyConfiguration config) => List(config); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs index bf78c4ca26..a9d43047c3 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs @@ -215,7 +215,7 @@ public virtual bool MayRequireAdminAccess() return config.SourceCommand.Command != SourceCommandType.List; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyConfiguration configuration) => ConfigureArgumentParser(optionSet, configuration); @@ -251,6 +251,6 @@ public virtual int count(ChocolateyConfiguration config) [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual IEnumerable list(ChocolateyConfiguration config) => List(config); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyTemplateCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyTemplateCommand.cs index ee8fa0aac1..7904fa0553 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyTemplateCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyTemplateCommand.cs @@ -155,7 +155,7 @@ public virtual bool MayRequireAdminAccess() return false; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyConfiguration configuration) => ConfigureArgumentParser(optionSet, configuration); @@ -183,6 +183,6 @@ public virtual void run(ChocolateyConfiguration configuration) [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual bool may_require_admin_access() => MayRequireAdminAccess(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs index dc468bfb80..2deceb51be 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs @@ -291,7 +291,7 @@ public virtual bool MayRequireAdminAccess() return true; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyConfiguration configuration) => ConfigureArgumentParser(optionSet, configuration); @@ -319,6 +319,6 @@ public virtual void run(ChocolateyConfiguration configuration) [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual bool may_require_admin_access() => MayRequireAdminAccess(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyUnpackSelfCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyUnpackSelfCommand.cs index 449396479d..02f0b66a5d 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyUnpackSelfCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyUnpackSelfCommand.cs @@ -121,7 +121,7 @@ public virtual bool MayRequireAdminAccess() return true; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyConfiguration configuration) => ConfigureArgumentParser(optionSet, configuration); @@ -149,6 +149,6 @@ public virtual void run(ChocolateyConfiguration configuration) [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual bool may_require_admin_access() => MayRequireAdminAccess(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs index 8c8080d3b8..12f0c06ccf 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs @@ -386,7 +386,7 @@ public virtual bool MayRequireAdminAccess() return true; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyConfiguration configuration) => ConfigureArgumentParser(optionSet, configuration); @@ -414,6 +414,6 @@ public virtual void run(ChocolateyConfiguration configuration) [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual bool may_require_admin_access() => MayRequireAdminAccess(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs b/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs index 5ec4816f43..120dfc5d0d 100644 --- a/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs +++ b/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs @@ -494,7 +494,7 @@ private void AppendOutput(StringBuilder propertyValues, string append) /// public CacheCommandConfiguration CacheCommand { get; set; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public void start_backup() => CreateBackup(); @@ -502,7 +502,7 @@ public void start_backup() [Obsolete("This overload is deprecated and will be removed in v3.")] public void reset_config(bool removeBackup = false) => RevertChanges(removeBackup); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } [Serializable] diff --git a/src/chocolatey/infrastructure.app/configuration/ConfigurationOptions.cs b/src/chocolatey/infrastructure.app/configuration/ConfigurationOptions.cs index 8b13a07ff0..4266f70e13 100644 --- a/src/chocolatey/infrastructure.app/configuration/ConfigurationOptions.cs +++ b/src/chocolatey/infrastructure.app/configuration/ConfigurationOptions.cs @@ -178,7 +178,7 @@ private static void ShowHelp(OptionSet optionSet, Action helpMessage) optionSet.WriteOptionDescriptions(Console.Out); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] [EditorBrowsable(EditorBrowsableState.Never)] public static void initialize_with(Lazy console) @@ -196,6 +196,6 @@ public static void parse_arguments_and_update_configuration(ICollection Action validateConfiguration, Action helpMessage) => ParseArgumentsAndUpdateConfiguration(args, configuration, setOptions, afterParse, validateConfiguration, helpMessage); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs b/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs index 6f1decbde3..f7b729c278 100644 --- a/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs +++ b/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs @@ -313,7 +313,7 @@ private static string GetProcessOnlyItems(string currentValues, IEnumerable environment) @@ -330,6 +330,6 @@ public static void set_environment_variables(ChocolateyConfiguration config) [Obsolete("This overload is deprecated and will be removed in v3.")] public static void update_environment_variables() => UpdateEnvironmentVariables(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/domain/CommandNameType.cs b/src/chocolatey/infrastructure.app/domain/CommandNameType.cs index 55a9d6f7fb..c5b00c6eed 100644 --- a/src/chocolatey/infrastructure.app/domain/CommandNameType.cs +++ b/src/chocolatey/infrastructure.app/domain/CommandNameType.cs @@ -25,7 +25,7 @@ public enum CommandNameType Upgrade, Uninstall, -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] list = List, [Obsolete("This overload is deprecated and will be removed in v3.")] @@ -34,6 +34,6 @@ public enum CommandNameType upgrade = Upgrade, [Obsolete("This overload is deprecated and will be removed in v3.")] uninstall = Uninstall, -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/domain/ConfigCommandType.cs b/src/chocolatey/infrastructure.app/domain/ConfigCommandType.cs index b82ef2d17b..919d40cf2a 100644 --- a/src/chocolatey/infrastructure.app/domain/ConfigCommandType.cs +++ b/src/chocolatey/infrastructure.app/domain/ConfigCommandType.cs @@ -26,7 +26,7 @@ public enum ConfigCommandType Set, Unset, -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] unknown = Unknown, [Obsolete("This overload is deprecated and will be removed in v3.")] @@ -37,6 +37,6 @@ public enum ConfigCommandType set = Set, [Obsolete("This overload is deprecated and will be removed in v3.")] unset = Unset, -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/domain/FeatureCommandType.cs b/src/chocolatey/infrastructure.app/domain/FeatureCommandType.cs index f91ac060b4..ed823b70ac 100644 --- a/src/chocolatey/infrastructure.app/domain/FeatureCommandType.cs +++ b/src/chocolatey/infrastructure.app/domain/FeatureCommandType.cs @@ -26,7 +26,7 @@ public enum FeatureCommandType Enable, Disable, -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] unknown = Unknown, [Obsolete("This overload is deprecated and will be removed in v3.")] @@ -35,6 +35,6 @@ public enum FeatureCommandType enable = Enable, [Obsolete("This overload is deprecated and will be removed in v3.")] disable = Disable, -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/domain/InstallTokens.cs b/src/chocolatey/infrastructure.app/domain/InstallTokens.cs index a72bc64045..58278cd1ac 100644 --- a/src/chocolatey/infrastructure.app/domain/InstallTokens.cs +++ b/src/chocolatey/infrastructure.app/domain/InstallTokens.cs @@ -27,7 +27,7 @@ public static class InstallTokens public const string UninstallerLocation = "{{UNINSTALLER_LOCATION}}"; public const string TempLocation = "{{TEMP_LOCATION}}"; -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public const string INSTALLER_LOCATION = InstallerLocation; [Obsolete("This overload is deprecated and will be removed in v3.")] @@ -40,6 +40,6 @@ public static class InstallTokens public const string UNINSTALLER_LOCATION = UninstallerLocation; [Obsolete("This overload is deprecated and will be removed in v3.")] public const string TEMP_LOCATION = TempLocation; -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/domain/PinCommandType.cs b/src/chocolatey/infrastructure.app/domain/PinCommandType.cs index 92aa9b4ff2..cd9157d34a 100644 --- a/src/chocolatey/infrastructure.app/domain/PinCommandType.cs +++ b/src/chocolatey/infrastructure.app/domain/PinCommandType.cs @@ -25,7 +25,7 @@ public enum PinCommandType Add, Remove, -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] unknown = Unknown, [Obsolete("This overload is deprecated and will be removed in v3.")] @@ -34,6 +34,6 @@ public enum PinCommandType add = Add, [Obsolete("This overload is deprecated and will be removed in v3.")] remove = Remove, -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/domain/RegistryApplicationKey.cs b/src/chocolatey/infrastructure.app/domain/RegistryApplicationKey.cs index dc49cef296..89b6cdb22f 100644 --- a/src/chocolatey/infrastructure.app/domain/RegistryApplicationKey.cs +++ b/src/chocolatey/infrastructure.app/domain/RegistryApplicationKey.cs @@ -123,10 +123,10 @@ bool IEquatable.Equals(RegistryApplicationKey other) ; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public bool is_in_programs_and_features() => IsInProgramsAndFeatures(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/domain/RegistryValueExtensions.cs b/src/chocolatey/infrastructure.app/domain/RegistryValueExtensions.cs index 7a3f6e1860..8440ef6ab9 100644 --- a/src/chocolatey/infrastructure.app/domain/RegistryValueExtensions.cs +++ b/src/chocolatey/infrastructure.app/domain/RegistryValueExtensions.cs @@ -35,10 +35,10 @@ public static string AsXmlSafeString(this RegistryKey key, string name) .Replace("\0", string.Empty); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static string get_value_as_string(this RegistryKey key, string name) => AsXmlSafeString(key, name); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/domain/SourceCommandType.cs b/src/chocolatey/infrastructure.app/domain/SourceCommandType.cs index a8020de803..c5239c32eb 100644 --- a/src/chocolatey/infrastructure.app/domain/SourceCommandType.cs +++ b/src/chocolatey/infrastructure.app/domain/SourceCommandType.cs @@ -27,7 +27,7 @@ public enum SourceCommandType Enable, Disable, -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] unknown = Unknown, [Obsolete("This overload is deprecated and will be removed in v3.")] @@ -40,6 +40,6 @@ public enum SourceCommandType enable = Enable, [Obsolete("This overload is deprecated and will be removed in v3.")] disable = Disable, -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/domain/SourceTypes.cs b/src/chocolatey/infrastructure.app/domain/SourceTypes.cs index 8299e528fc..978f302514 100644 --- a/src/chocolatey/infrastructure.app/domain/SourceTypes.cs +++ b/src/chocolatey/infrastructure.app/domain/SourceTypes.cs @@ -60,7 +60,7 @@ public static class SourceTypes /// public const string WindowsFeatures = "windowsfeatures"; -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public const string CYGWIN = Cygwin; [Obsolete("This overload is deprecated and will be removed in v3.")] @@ -73,6 +73,6 @@ public static class SourceTypes public const string WINDOWS_FEATURE = WindowsFeature; [Obsolete("This overload is deprecated and will be removed in v3.")] public const string WINDOWS_FEATURES = WindowsFeatures; -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/domain/TemplateCommandType.cs b/src/chocolatey/infrastructure.app/domain/TemplateCommandType.cs index 38b0321b63..85c5cb9797 100644 --- a/src/chocolatey/infrastructure.app/domain/TemplateCommandType.cs +++ b/src/chocolatey/infrastructure.app/domain/TemplateCommandType.cs @@ -24,13 +24,13 @@ public enum TemplateCommandType List, Info, -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] unknown = Unknown, [Obsolete("This overload is deprecated and will be removed in v3.")] list = List, [Obsolete("This overload is deprecated and will be removed in v3.")] info = Info, -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/domain/installers/IInstaller.cs b/src/chocolatey/infrastructure.app/domain/installers/IInstaller.cs index 785e5671ed..cf4ba5b773 100644 --- a/src/chocolatey/infrastructure.app/domain/installers/IInstaller.cs +++ b/src/chocolatey/infrastructure.app/domain/installers/IInstaller.cs @@ -38,12 +38,12 @@ public interface IInstaller string BuildInstallCommandArguments(bool logFile, bool customInstallLocation, bool languageRequested); string BuildUninstallCommandArguments(); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] string build_install_command_arguments(bool logFile, bool customInstallLocation, bool languageRequested); [Obsolete("This overload is deprecated and will be removed in v3.")] string build_uninstall_command_arguments(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/domain/installers/InstallerBase.cs b/src/chocolatey/infrastructure.app/domain/installers/InstallerBase.cs index 8682e11c74..70cef15d36 100644 --- a/src/chocolatey/infrastructure.app/domain/installers/InstallerBase.cs +++ b/src/chocolatey/infrastructure.app/domain/installers/InstallerBase.cs @@ -56,7 +56,7 @@ public virtual string BuildUninstallCommandArguments() return "{0} {1} {2}".FormatWith(SilentUninstall, NoReboot, OtherUninstallOptions).TrimSafe(); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual string build_install_command_arguments(bool logFile, bool customInstallLocation, bool languageRequested) => BuildInstallCommandArguments(logFile, customInstallLocation, languageRequested); @@ -64,7 +64,7 @@ public virtual string build_install_command_arguments(bool logFile, bool customI [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual string build_uninstall_command_arguments() => BuildUninstallCommandArguments(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/nuget/ChocolateyNugetCredentialProvider.cs b/src/chocolatey/infrastructure.app/nuget/ChocolateyNugetCredentialProvider.cs index 1025e2bfef..ec744e264d 100644 --- a/src/chocolatey/infrastructure.app/nuget/ChocolateyNugetCredentialProvider.cs +++ b/src/chocolatey/infrastructure.app/nuget/ChocolateyNugetCredentialProvider.cs @@ -194,10 +194,10 @@ public ICredentials GetUserCredentials(Uri uri, IWebProxy proxy, CredentialReque return credentials; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public ICredentials get_credentials_from_user(Uri uri, IWebProxy proxy, CredentialRequestType credentialType) => GetUserCredentials(uri, proxy, credentialType); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs b/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs index 3550ebd467..ceae03e53e 100644 --- a/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs +++ b/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs @@ -59,14 +59,14 @@ public sealed class NugetCommon [Obsolete("This member is unused and should probably be removed.")] private static Lazy _console = new Lazy(() => new Console()); -#pragma warning disable IDE1006 +#pragma warning disable IDE1006 // Naming [EditorBrowsable(EditorBrowsableState.Never)] [Obsolete("This member is unused and should probably be removed.")] public static void initialize_with(Lazy console) { _console = console; } -#pragma warning restore IDE1006 +#pragma warning restore IDE1006 // Naming [Obsolete("This member is unused and should probably be removed.")] private static IConsole Console @@ -74,9 +74,11 @@ private static IConsole Console get { return _console.Value; } } +#pragma warning disable IDE0022 // Block body for methods [Obsolete("This overload is obsolete and will be removed in a future version.")] public static ChocolateyPackagePathResolver GetPathResolver(ChocolateyConfiguration configuration, IFileSystem nugetPackagesFileSystem) => GetPathResolver(nugetPackagesFileSystem); +#pragma warning restore IDE0022 // Block body for methods public static ChocolateyPackagePathResolver GetPathResolver(IFileSystem nugetPackagesFileSystem) { diff --git a/src/chocolatey/infrastructure.app/nuget/NugetEncryptionUtility.cs b/src/chocolatey/infrastructure.app/nuget/NugetEncryptionUtility.cs index f7eb65bc47..700a2e4207 100644 --- a/src/chocolatey/infrastructure.app/nuget/NugetEncryptionUtility.cs +++ b/src/chocolatey/infrastructure.app/nuget/NugetEncryptionUtility.cs @@ -52,11 +52,11 @@ public static string GenerateUniqueToken(string caseInsensitiveKey) return EncryptionUtility.GenerateUniqueToken(caseInsensitiveKey); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] [EditorBrowsable(EditorBrowsableState.Never)] public static void initialize_with(Lazy encryptionUtility) => InitializeWith(encryptionUtility); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/nuget/NugetList.cs b/src/chocolatey/infrastructure.app/nuget/NugetList.cs index 7ea3957df0..ebf0564e83 100644 --- a/src/chocolatey/infrastructure.app/nuget/NugetList.cs +++ b/src/chocolatey/infrastructure.app/nuget/NugetList.cs @@ -405,11 +405,11 @@ public static IPackageSearchMetadata FindPackage( return packagesList.OrderByDescending(p => p.Identity.Version).FirstOrDefault(); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static ISet find_all_package_versions(string packageName, ChocolateyConfiguration config, ILogger nugetLogger, ChocolateySourceCacheContext cacheContext, IEnumerable resources) => FindAllPackageVersions(packageName, config, nugetLogger, cacheContext, resources); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } public class ComparePackageSearchMetadataIdOnly: IEqualityComparer diff --git a/src/chocolatey/infrastructure.app/nuget/NugetPush.cs b/src/chocolatey/infrastructure.app/nuget/NugetPush.cs index 7b6cfa84ad..b93cc86e15 100644 --- a/src/chocolatey/infrastructure.app/nuget/NugetPush.cs +++ b/src/chocolatey/infrastructure.app/nuget/NugetPush.cs @@ -91,10 +91,10 @@ public static void PushPackage(ChocolateyConfiguration config, string nupkgFileP "chocolatey".Log().Info(ChocolateyLoggers.Important, () => "{0} was pushed successfully to {1}".FormatWith(nupkgFileName, config.Sources)); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static void push_package(ChocolateyConfiguration config, string nupkgFilePath, ILogger nugetLogger, string nupkgFileName, IFileSystem filesystem) => PushPackage(config, nupkgFilePath, nugetLogger, nupkgFileName, filesystem); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/registration/ChocolateyRegistrationModule.cs b/src/chocolatey/infrastructure.app/registration/ChocolateyRegistrationModule.cs index dc48004502..7929f6617f 100644 --- a/src/chocolatey/infrastructure.app/registration/ChocolateyRegistrationModule.cs +++ b/src/chocolatey/infrastructure.app/registration/ChocolateyRegistrationModule.cs @@ -96,10 +96,10 @@ public void RegisterDependencies(IContainerRegistrator registrator, ChocolateyCo registrator.RegisterService(availableRules); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public void register_dependencies(IContainerRegistrator registrator, ChocolateyConfiguration configuration) => RegisterDependencies(registrator, configuration); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/registration/IContainerRegistrator.cs b/src/chocolatey/infrastructure.app/registration/IContainerRegistrator.cs index 027c3975b0..20088790e8 100644 --- a/src/chocolatey/infrastructure.app/registration/IContainerRegistrator.cs +++ b/src/chocolatey/infrastructure.app/registration/IContainerRegistrator.cs @@ -42,7 +42,7 @@ void RegisterInstance(Func instance) void RegisterInstance(Func instance) where TImplementation : class, TService; -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] void register_validator(Func validation_func); @@ -64,6 +64,6 @@ void register_instance(Func instance [Obsolete("This overload is deprecated and will be removed in v3.")] void register_instance(Func instance) where TImplementation : class, TService; -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/registration/IContainerResolver.cs b/src/chocolatey/infrastructure.app/registration/IContainerResolver.cs index 89788e0343..ea2e478b3a 100644 --- a/src/chocolatey/infrastructure.app/registration/IContainerResolver.cs +++ b/src/chocolatey/infrastructure.app/registration/IContainerResolver.cs @@ -27,7 +27,7 @@ TService Resolve() IEnumerable ResolveAll() where TService : class; -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] TService resolve() where TService : class; @@ -35,6 +35,6 @@ TService resolve() [Obsolete("This overload is deprecated and will be removed in v3.")] IEnumerable resolve_all() where TService : class; -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/registration/IExtensionConfiguration.cs b/src/chocolatey/infrastructure.app/registration/IExtensionConfiguration.cs index e36bdc73bc..2d8cfe5f37 100644 --- a/src/chocolatey/infrastructure.app/registration/IExtensionConfiguration.cs +++ b/src/chocolatey/infrastructure.app/registration/IExtensionConfiguration.cs @@ -36,9 +36,9 @@ public interface IExtensionConfiguration /// This is not used, and is only a placeholder for the future. object CreateInitialExtensionConfiguration(); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] object create_initial_extension_configuration(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/registration/IExtensionEnvironment.cs b/src/chocolatey/infrastructure.app/registration/IExtensionEnvironment.cs index 4984b9abe1..e6ddab93a5 100644 --- a/src/chocolatey/infrastructure.app/registration/IExtensionEnvironment.cs +++ b/src/chocolatey/infrastructure.app/registration/IExtensionEnvironment.cs @@ -33,9 +33,9 @@ public interface IExtensionEnvironment /// This is not used, and is only a placeholder for the future. IDictionary GetEnvironmentConfiguration(ChocolateyConfiguration config); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] IDictionary get_environment_configuration(ChocolateyConfiguration config); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/registration/IExtensionModule.cs b/src/chocolatey/infrastructure.app/registration/IExtensionModule.cs index c11116ca26..5e61986dfd 100644 --- a/src/chocolatey/infrastructure.app/registration/IExtensionModule.cs +++ b/src/chocolatey/infrastructure.app/registration/IExtensionModule.cs @@ -23,9 +23,9 @@ public interface IExtensionModule { void RegisterDependencies(IContainerRegistrator registrator, ChocolateyConfiguration configuration); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] void register_dependencies(IContainerRegistrator registrator, ChocolateyConfiguration configuration); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/registration/SimpleInjectorContainerRegistrator.cs b/src/chocolatey/infrastructure.app/registration/SimpleInjectorContainerRegistrator.cs index 3c2e5dd824..3f6467d206 100644 --- a/src/chocolatey/infrastructure.app/registration/SimpleInjectorContainerRegistrator.cs +++ b/src/chocolatey/infrastructure.app/registration/SimpleInjectorContainerRegistrator.cs @@ -544,7 +544,7 @@ private void ValidateServiceRegistrations(Type interfaceType, Type serviceType, } } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public void register_assembly_commands(IAssembly assembly) => RegisterAssemblyCommands(assembly); @@ -580,6 +580,6 @@ public void register_service(bool transient = false) [Obsolete("This overload is deprecated and will be removed in v3.")] public void register_validator(Func validation_func) => RegisterValidator(validation_func); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/registration/SimpleInjectorContainerResolver.cs b/src/chocolatey/infrastructure.app/registration/SimpleInjectorContainerResolver.cs index c36b010fa4..4f181e4383 100644 --- a/src/chocolatey/infrastructure.app/registration/SimpleInjectorContainerResolver.cs +++ b/src/chocolatey/infrastructure.app/registration/SimpleInjectorContainerResolver.cs @@ -41,7 +41,7 @@ public IEnumerable ResolveAll() return _container.GetAllInstances(); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public TService resolve() where TService : class @@ -51,6 +51,6 @@ public TService resolve() public IEnumerable resolve_all() where TService : class => ResolveAll(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/rules/MetadataRuleBase.cs b/src/chocolatey/infrastructure.app/rules/MetadataRuleBase.cs index c02517f966..da938a0a1f 100644 --- a/src/chocolatey/infrastructure.app/rules/MetadataRuleBase.cs +++ b/src/chocolatey/infrastructure.app/rules/MetadataRuleBase.cs @@ -82,7 +82,7 @@ protected static string GetElementValue(NuspecReader reader, string name) protected abstract IEnumerable GetRules(); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual IEnumerable validate(NuspecReader reader) => Validate(reader); @@ -94,6 +94,6 @@ protected static bool has_element(NuspecReader reader, string name) [Obsolete("This overload is deprecated and will be removed in v3.")] protected static string get_element_value(NuspecReader reader, string name) => GetElementValue(reader, name); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } \ No newline at end of file diff --git a/src/chocolatey/infrastructure.app/runners/ConsoleApplication.cs b/src/chocolatey/infrastructure.app/runners/ConsoleApplication.cs index afa9dde90b..0a6b8b2d4c 100644 --- a/src/chocolatey/infrastructure.app/runners/ConsoleApplication.cs +++ b/src/chocolatey/infrastructure.app/runners/ConsoleApplication.cs @@ -153,10 +153,10 @@ private int ReportValidationSummary(IList validationResults, C return errors; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public void run(string[] args, ChocolateyConfiguration config, Container container) => Run(args, config, container); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/runners/GenericRunner.cs b/src/chocolatey/infrastructure.app/runners/GenericRunner.cs index f4f34cd0a9..3c6c0720db 100644 --- a/src/chocolatey/infrastructure.app/runners/GenericRunner.cs +++ b/src/chocolatey/infrastructure.app/runners/GenericRunner.cs @@ -332,7 +332,7 @@ location. See } } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public void fail_when_license_is_missing_or_invalid_if_requested(ChocolateyConfiguration config) => FailOnMissingOrInvalidLicenseIfFeatureSet(config); @@ -352,6 +352,6 @@ public int count(ChocolateyConfiguration config, Container container, bool isCon [Obsolete("This overload is deprecated and will be removed in v3.")] public void warn_when_admin_needs_elevation(ChocolateyConfiguration config) => WarnIfAdminAndNeedsElevation(config); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/AutomaticUninstallerService.cs b/src/chocolatey/infrastructure.app/services/AutomaticUninstallerService.cs index 84c28b402a..e412914342 100644 --- a/src/chocolatey/infrastructure.app/services/AutomaticUninstallerService.cs +++ b/src/chocolatey/infrastructure.app/services/AutomaticUninstallerService.cs @@ -299,7 +299,7 @@ public virtual IInstaller GetInstallerType(RegistryApplicationKey key, string un return installer; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public void run(PackageResult packageResult, ChocolateyConfiguration config) => Run(packageResult, config); @@ -311,6 +311,6 @@ public void remove(RegistryApplicationKey key, ChocolateyConfiguration config, P [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual IInstaller get_installer_type(RegistryApplicationKey key, string uninstallExe, string uninstallArgs) => GetInstallerType(key, uninstallExe, uninstallArgs); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyConfigSettingsService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyConfigSettingsService.cs index 3cc63103d1..42df1f4966 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyConfigSettingsService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyConfigSettingsService.cs @@ -511,7 +511,7 @@ protected void ValidateSupportedFeature(ConfigFileFeatureSetting feature) } } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public void noop(ChocolateyConfiguration configuration) => DryRun(configuration); @@ -595,6 +595,6 @@ protected void add_known_feature(string name) [Obsolete("This overload is deprecated and will be removed in v3.")] protected void validate_supported_feature(ConfigFileFeatureSetting feature) => ValidateSupportedFeature(feature); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs index 37eaeee373..15d99994b9 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs @@ -306,7 +306,7 @@ private static string GetStorePath(IFileSystem fileSystem, string id, NuGetVersi return preferredStorePath; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public ChocolateyPackageInformation get_package_information(IPackageMetadata package) => Get(package); @@ -318,6 +318,6 @@ public void save_package_information(ChocolateyPackageInformation packageInforma [Obsolete("This overload is deprecated and will be removed in v3.")] public void remove_package_information(IPackageMetadata package) => Remove(package); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs index e79199659d..0449429fa7 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs @@ -1847,7 +1847,7 @@ private void HandleHookPackages(ChocolateyConfiguration config, PackageResult pa } } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual int count_run(ChocolateyConfiguration config) => Count(config); @@ -1935,6 +1935,6 @@ public virtual void set_pending(PackageResult packageResult, ChocolateyConfigura [Obsolete("This overload is deprecated and will be removed in v3.")] public virtual void remove_pending(PackageResult packageResult, ChocolateyConfiguration config) => UnmarkPackagePending(packageResult, config); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/ConfigTransformService.cs b/src/chocolatey/infrastructure.app/services/ConfigTransformService.cs index 7dc4d3f05a..e547cc9b20 100644 --- a/src/chocolatey/infrastructure.app/services/ConfigTransformService.cs +++ b/src/chocolatey/infrastructure.app/services/ConfigTransformService.cs @@ -193,10 +193,10 @@ private string FindBackupTargetFile(string targetFile, string installDirectory, return targetFile.Replace(installDirectory, backupDirectory); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public void run(PackageResult packageResult, ChocolateyConfiguration config) => Run(packageResult, config); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/CygwinService.cs b/src/chocolatey/infrastructure.app/services/CygwinService.cs index 252d24cc0d..9269b9e7c5 100644 --- a/src/chocolatey/infrastructure.app/services/CygwinService.cs +++ b/src/chocolatey/infrastructure.app/services/CygwinService.cs @@ -275,7 +275,7 @@ private static string GetValueFromOutput(string output, Regex regex, string grou return string.Empty; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public const string CYGWIN_PACKAGE = CygwinPackage; @@ -300,6 +300,6 @@ public ConcurrentDictionary install_run(ChocolateyConfigu [Obsolete("This overload is deprecated and will be removed in v3.")] public ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction, Action beforeModifyAction) => Install(config, continueAction, beforeModifyAction); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/FilesService.cs b/src/chocolatey/infrastructure.app/services/FilesService.cs index da5f278937..17ca7ad152 100644 --- a/src/chocolatey/infrastructure.app/services/FilesService.cs +++ b/src/chocolatey/infrastructure.app/services/FilesService.cs @@ -230,7 +230,7 @@ public bool MovePackageUsingBackupStrategy(string sourceFolder, string destinati return errored; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public PackageFiles read_from_file(string filePath) => ReadPackageSnapshot(filePath); @@ -258,6 +258,6 @@ public PackageFiles capture_package_files(string directory, ChocolateyConfigurat [Obsolete("This overload is deprecated and will be removed in v3.")] public PackageFile get_package_file(string file) => GetPackageFile(file); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/IAutomaticUninstallerService.cs b/src/chocolatey/infrastructure.app/services/IAutomaticUninstallerService.cs index 32478d7698..8b9f7e4379 100644 --- a/src/chocolatey/infrastructure.app/services/IAutomaticUninstallerService.cs +++ b/src/chocolatey/infrastructure.app/services/IAutomaticUninstallerService.cs @@ -42,12 +42,12 @@ public interface IAutomaticUninstallerService /// The package cache location. void Remove(RegistryApplicationKey key, ChocolateyConfiguration config, PackageResult packageResult, string packageCacheLocation); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] void run(PackageResult packageResult, ChocolateyConfiguration config); [Obsolete("This overload is deprecated and will be removed in v3.")] void remove(RegistryApplicationKey key, ChocolateyConfiguration config, PackageResult packageResult, string packageCacheLocation); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/IChocolateyConfigSettingsService.cs b/src/chocolatey/infrastructure.app/services/IChocolateyConfigSettingsService.cs index 0a844bd9ce..c7e19b416d 100644 --- a/src/chocolatey/infrastructure.app/services/IChocolateyConfigSettingsService.cs +++ b/src/chocolatey/infrastructure.app/services/IChocolateyConfigSettingsService.cs @@ -40,7 +40,7 @@ public interface IChocolateyConfigSettingsService void SetConfig(ChocolateyConfiguration configuration); void UnsetConfig(ChocolateyConfiguration configuration); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] void noop(ChocolateyConfiguration configuration); [Obsolete("This overload is deprecated and will be removed in v3.")] @@ -73,6 +73,6 @@ public interface IChocolateyConfigSettingsService void config_set(ChocolateyConfiguration configuration); [Obsolete("This overload is deprecated and will be removed in v3.")] void config_unset(ChocolateyConfiguration configuration); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/IChocolateyPackageInformationService.cs b/src/chocolatey/infrastructure.app/services/IChocolateyPackageInformationService.cs index 2e51aa0612..eacf4c1c49 100644 --- a/src/chocolatey/infrastructure.app/services/IChocolateyPackageInformationService.cs +++ b/src/chocolatey/infrastructure.app/services/IChocolateyPackageInformationService.cs @@ -26,13 +26,13 @@ public interface IChocolateyPackageInformationService void Save(ChocolateyPackageInformation packageInformation); void Remove(IPackageMetadata package); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] ChocolateyPackageInformation get_package_information(IPackageMetadata package); [Obsolete("This overload is deprecated and will be removed in v3.")] void save_package_information(ChocolateyPackageInformation packageInformation); [Obsolete("This overload is deprecated and will be removed in v3.")] void remove_package_information(IPackageMetadata package); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/IChocolateyPackageService.cs b/src/chocolatey/infrastructure.app/services/IChocolateyPackageService.cs index fbb84d7902..b03174bf54 100644 --- a/src/chocolatey/infrastructure.app/services/IChocolateyPackageService.cs +++ b/src/chocolatey/infrastructure.app/services/IChocolateyPackageService.cs @@ -123,7 +123,7 @@ public interface IChocolateyPackageService ConcurrentDictionary Uninstall(ChocolateyConfiguration config); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] int count_run(ChocolateyConfiguration config); [Obsolete("This overload is deprecated and will be removed in v3.")] @@ -152,6 +152,6 @@ public interface IChocolateyPackageService void uninstall_noop(ChocolateyConfiguration config); [Obsolete("This overload is deprecated and will be removed in v3.")] ConcurrentDictionary uninstall_run(ChocolateyConfiguration config); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/IConfigTransformService.cs b/src/chocolatey/infrastructure.app/services/IConfigTransformService.cs index e877c23f11..ba5fa6eaa4 100644 --- a/src/chocolatey/infrastructure.app/services/IConfigTransformService.cs +++ b/src/chocolatey/infrastructure.app/services/IConfigTransformService.cs @@ -29,9 +29,9 @@ public interface IConfigTransformService /// The configuration. void Run(PackageResult packageResult, ChocolateyConfiguration config); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] void run(PackageResult packageResult, ChocolateyConfiguration config); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/IFilesService.cs b/src/chocolatey/infrastructure.app/services/IFilesService.cs index 1d25ff6b87..5861e3ff98 100644 --- a/src/chocolatey/infrastructure.app/services/IFilesService.cs +++ b/src/chocolatey/infrastructure.app/services/IFilesService.cs @@ -79,7 +79,7 @@ public interface IFilesService bool MovePackageUsingBackupStrategy(string sourceFolder, string destinationFolder, bool restoreSource); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] PackageFiles read_from_file(string filepath); [Obsolete("This overload is deprecated and will be removed in v3.")] @@ -94,6 +94,6 @@ public interface IFilesService PackageFiles capture_package_files(string directory, ChocolateyConfiguration config); [Obsolete("This overload is deprecated and will be removed in v3.")] PackageFile get_package_file(string file); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/INugetService.cs b/src/chocolatey/infrastructure.app/services/INugetService.cs index a11e5571ef..b664ae58ca 100644 --- a/src/chocolatey/infrastructure.app/services/INugetService.cs +++ b/src/chocolatey/infrastructure.app/services/INugetService.cs @@ -67,7 +67,7 @@ public interface INugetService : ISourceRunner /// The configuration IEnumerable GetInstalledPackages(ChocolateyConfiguration config); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] ConcurrentDictionary get_outdated(ChocolateyConfiguration config); [Obsolete("This overload is deprecated and will be removed in v3.")] @@ -82,6 +82,6 @@ public interface INugetService : ISourceRunner void remove_rollback_directory_if_exists(string packageName); [Obsolete("This overload is deprecated and will be removed in v3.")] IEnumerable get_all_installed_packages(ChocolateyConfiguration config); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/IPendingRebootService.cs b/src/chocolatey/infrastructure.app/services/IPendingRebootService.cs index 61ef8a2576..3884d7c6e9 100644 --- a/src/chocolatey/infrastructure.app/services/IPendingRebootService.cs +++ b/src/chocolatey/infrastructure.app/services/IPendingRebootService.cs @@ -28,9 +28,9 @@ public interface IPendingRebootService { bool IsRebootPending(ChocolateyConfiguration config); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] bool is_pending_reboot(ChocolateyConfiguration config); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/IPowershellService.cs b/src/chocolatey/infrastructure.app/services/IPowershellService.cs index 320e1f91f8..58f047ac84 100644 --- a/src/chocolatey/infrastructure.app/services/IPowershellService.cs +++ b/src/chocolatey/infrastructure.app/services/IPowershellService.cs @@ -72,7 +72,7 @@ public interface IPowershellService PowerShellExecutionResults RunHost(ChocolateyConfiguration config, string chocoPowerShellScript, Action additionalActionsBeforeScript, IEnumerable hookPreScriptPathList, IEnumerable hookPostScriptPathList); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] void install_noop(PackageResult packageResult); [Obsolete("This overload is deprecated and will be removed in v3.")] @@ -89,6 +89,6 @@ public interface IPowershellService void prepare_powershell_environment(IPackageSearchMetadata package, ChocolateyConfiguration configuration, string packageDirectory); [Obsolete("This overload is deprecated and will be removed in v3.")] PowerShellExecutionResults run_host(ChocolateyConfiguration config, string chocoPowerShellScript, Action additionalActionsBeforeScript, IEnumerable hookPreScriptPathList, IEnumerable hookPostScriptPathList); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/IRegistryService.cs b/src/chocolatey/infrastructure.app/services/IRegistryService.cs index 3439979bc9..0657b88ad5 100644 --- a/src/chocolatey/infrastructure.app/services/IRegistryService.cs +++ b/src/chocolatey/infrastructure.app/services/IRegistryService.cs @@ -34,7 +34,7 @@ public interface IRegistryService bool InstallerKeyExists(string keyPath); RegistryKey GetKey(RegistryHive hive, string subKeyPath); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] Registry get_installer_keys(); [Obsolete("This overload is deprecated and will be removed in v3.")] @@ -53,6 +53,6 @@ public interface IRegistryService bool installer_value_exists(string keyPath, string value); [Obsolete("This overload is deprecated and will be removed in v3.")] RegistryKey get_key(RegistryHive hive, string subKeyPath); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/IShimGenerationService.cs b/src/chocolatey/infrastructure.app/services/IShimGenerationService.cs index b14ccc8840..1f9de35217 100644 --- a/src/chocolatey/infrastructure.app/services/IShimGenerationService.cs +++ b/src/chocolatey/infrastructure.app/services/IShimGenerationService.cs @@ -36,11 +36,11 @@ public interface IShimGenerationService /// The package result. void Uninstall(ChocolateyConfiguration configuration, PackageResult packageResult); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] void install(ChocolateyConfiguration configuration, PackageResult packageResult); [Obsolete("This overload is deprecated and will be removed in v3.")] void uninstall(ChocolateyConfiguration configuration, PackageResult packageResult); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/ISourceRunner.cs b/src/chocolatey/infrastructure.app/services/ISourceRunner.cs index 44fb09014e..f424a6a8c3 100644 --- a/src/chocolatey/infrastructure.app/services/ISourceRunner.cs +++ b/src/chocolatey/infrastructure.app/services/ISourceRunner.cs @@ -28,7 +28,7 @@ namespace chocolatey.infrastructure.app.services [Obsolete("This interface is deprecated and will be removed in v3.")] public interface ISourceRunner : IBootstrappableSourceRunner, ICountSourceRunner, IListSourceRunner, IInstallSourceRunner, IUpgradeSourceRunner, IUninstallSourceRunner { -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] void ensure_source_app_installed(ChocolateyConfiguration config, Action ensureAction); [Obsolete("This overload is deprecated and will be removed in v3.")] @@ -51,7 +51,7 @@ public interface ISourceRunner : IBootstrappableSourceRunner, ICountSourceRunner void uninstall_noop(ChocolateyConfiguration config, Action continueAction); [Obsolete("This overload is deprecated and will be removed in v3.")] ConcurrentDictionary uninstall_run(ChocolateyConfiguration config, Action continueAction, Action beforeUninstallAction = null); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } public interface IAlternativeSourceRunner diff --git a/src/chocolatey/infrastructure.app/services/ITemplateService.cs b/src/chocolatey/infrastructure.app/services/ITemplateService.cs index 3f8400cd15..a4c7f587fd 100644 --- a/src/chocolatey/infrastructure.app/services/ITemplateService.cs +++ b/src/chocolatey/infrastructure.app/services/ITemplateService.cs @@ -26,7 +26,7 @@ public interface ITemplateService void ListDryRun(ChocolateyConfiguration configuration); void List(ChocolateyConfiguration configuration); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] void generate_noop(ChocolateyConfiguration configuration); [Obsolete("This overload is deprecated and will be removed in v3.")] @@ -35,6 +35,6 @@ public interface ITemplateService void list_noop(ChocolateyConfiguration configuration); [Obsolete("This overload is deprecated and will be removed in v3.")] void list(ChocolateyConfiguration configuration); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/NugetService.cs b/src/chocolatey/infrastructure.app/services/NugetService.cs index 354fa6ca6e..4a1963dc17 100644 --- a/src/chocolatey/infrastructure.app/services/NugetService.cs +++ b/src/chocolatey/infrastructure.app/services/NugetService.cs @@ -2730,7 +2730,7 @@ private IEnumerable SetPackageNamesIfAllSpecified(ChocolateyConfi return allPackages; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public void ensure_source_app_installed(ChocolateyConfiguration config, Action ensureAction) => EnsureSourceAppInstalled(config, ensureAction); @@ -2864,6 +2864,6 @@ public virtual void remove_installation_files(IPackageMetadata removedPackage, C [Obsolete("This overload is deprecated and will be removed in v3.")] public IEnumerable get_all_installed_packages(ChocolateyConfiguration config) => GetInstalledPackages(config); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/PendingRebootService.cs b/src/chocolatey/infrastructure.app/services/PendingRebootService.cs index d4251504dd..815c739d20 100644 --- a/src/chocolatey/infrastructure.app/services/PendingRebootService.cs +++ b/src/chocolatey/infrastructure.app/services/PendingRebootService.cs @@ -225,10 +225,10 @@ private bool IsAtLeastVistaSp1() return versionNumber.Build >= 6001; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public bool is_pending_reboot(ChocolateyConfiguration config) => IsRebootPending(config); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/PowershellService.cs b/src/chocolatey/infrastructure.app/services/PowershellService.cs index b80dce5ba8..a2868e4b7b 100644 --- a/src/chocolatey/infrastructure.app/services/PowershellService.cs +++ b/src/chocolatey/infrastructure.app/services/PowershellService.cs @@ -759,7 +759,7 @@ public PowerShellExecutionResults RunHost(ChocolateyConfiguration config, string return result; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public void noop_action(PackageResult packageResult, CommandNameType command) => DryRunAction(packageResult, command); @@ -803,6 +803,6 @@ public void prepare_powershell_environment(IPackageSearchMetadata package, Choco [Obsolete("This overload is deprecated and will be removed in v3.")] public PowerShellExecutionResults run_host(ChocolateyConfiguration config, string chocoPowerShellScript, Action additionalActionsBeforeScript, IEnumerable hookPreScriptPathList, IEnumerable hookPostScriptPathList) => RunHost(config, chocoPowerShellScript, additionalActionsBeforeScript, hookPreScriptPathList, hookPostScriptPathList); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/PythonService.cs b/src/chocolatey/infrastructure.app/services/PythonService.cs index 718bbccae3..be511611de 100644 --- a/src/chocolatey/infrastructure.app/services/PythonService.cs +++ b/src/chocolatey/infrastructure.app/services/PythonService.cs @@ -565,7 +565,7 @@ private static string GetValueFromOutput(string output, Regex regex, string grou return string.Empty; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public const string PYTHON_PACKAGE = PythonPackage; [Obsolete("This overload is deprecated and will be removed in v3.")] @@ -628,6 +628,6 @@ public void uninstall_noop(ChocolateyConfiguration config, Action uninstall_run(ChocolateyConfiguration config, Action continueAction, Action beforeUninstallAction = null) => Uninstall(config, continueAction, beforeUninstallAction); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/RegistryService.cs b/src/chocolatey/infrastructure.app/services/RegistryService.cs index 2a39ed966c..07813b36b2 100644 --- a/src/chocolatey/infrastructure.app/services/RegistryService.cs +++ b/src/chocolatey/infrastructure.app/services/RegistryService.cs @@ -516,7 +516,7 @@ public static GenericRegistryValue GetRegistryValue(RegistryHiveType hive, strin return value; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public Registry get_installer_keys() => GetInstallerKeys(); @@ -560,6 +560,6 @@ public RegistryKey get_key(RegistryHive hive, string subKeyPath) [Obsolete("This overload is deprecated and will be removed in v3.")] public static GenericRegistryValue get_value(RegistryHiveType hive, string subKeyPath, string registryValue) => GetRegistryValue(hive, subKeyPath, registryValue); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/RubyGemsService.cs b/src/chocolatey/infrastructure.app/services/RubyGemsService.cs index 6ffb618ef9..9b4c8fdfa9 100644 --- a/src/chocolatey/infrastructure.app/services/RubyGemsService.cs +++ b/src/chocolatey/infrastructure.app/services/RubyGemsService.cs @@ -279,7 +279,7 @@ private static string GetValueFromOutput(string output, Regex regex, string grou return string.Empty; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public const string RUBY_PORTABLE_PACKAGE = "ruby.portable"; [Obsolete("This overload is deprecated and will be removed in v3.")] @@ -322,6 +322,6 @@ public ConcurrentDictionary install_run(ChocolateyConfigu [Obsolete("This overload is deprecated and will be removed in v3.")] public ConcurrentDictionary install_run(ChocolateyConfiguration config, Action continueAction, Action beforeModifyAction) => Install(config, continueAction, beforeModifyAction); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/RuleService.cs b/src/chocolatey/infrastructure.app/services/RuleService.cs index a0ab53dc55..ebdc90bf7c 100644 --- a/src/chocolatey/infrastructure.app/services/RuleService.cs +++ b/src/chocolatey/infrastructure.app/services/RuleService.cs @@ -94,11 +94,11 @@ private static IEnumerable ValidateNuspec(NuspecReader reader, IMeta } } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public IEnumerable validate_rules(string filePath) => ValidateRules(filePath); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 private class RuleIdEqualityComparer : IEqualityComparer { diff --git a/src/chocolatey/infrastructure.app/services/ShimGenerationService.cs b/src/chocolatey/infrastructure.app/services/ShimGenerationService.cs index 0ebcc58130..fcc388d7c3 100644 --- a/src/chocolatey/infrastructure.app/services/ShimGenerationService.cs +++ b/src/chocolatey/infrastructure.app/services/ShimGenerationService.cs @@ -144,7 +144,7 @@ public void Uninstall(ChocolateyConfiguration configuration, PackageResult packa } } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public void install(ChocolateyConfiguration configuration, PackageResult packageResult) => Install(configuration, packageResult); @@ -152,6 +152,6 @@ public void install(ChocolateyConfiguration configuration, PackageResult package [Obsolete("This overload is deprecated and will be removed in v3.")] public void uninstall(ChocolateyConfiguration configuration, PackageResult packageResult) => Uninstall(configuration, packageResult); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/TemplateService.cs b/src/chocolatey/infrastructure.app/services/TemplateService.cs index f1f103a276..5a88c9d377 100644 --- a/src/chocolatey/infrastructure.app/services/TemplateService.cs +++ b/src/chocolatey/infrastructure.app/services/TemplateService.cs @@ -408,7 +408,7 @@ protected HashSet GetTemplateParametersFromFiles(ChocolateyConfiguration return parametersList; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public void generate_noop(ChocolateyConfiguration configuration) => GenerateDryRun(configuration); @@ -444,6 +444,6 @@ protected IEnumerable get_template_parameters(ChocolateyConfiguration co [Obsolete("This overload is deprecated and will be removed in v3.")] protected HashSet get_template_parameters_from_files(ChocolateyConfiguration configuration) => GetTemplateParametersFromFiles(configuration); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs b/src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs index 3c44a8d8d2..5aed4c7033 100644 --- a/src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs +++ b/src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs @@ -403,7 +403,7 @@ public ConcurrentDictionary Uninstall(ChocolateyConfigura return packageResults; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public const string PACKAGE_NAME_GROUP = PackageNameGroup; [Obsolete("This overload is deprecated and will be removed in v3.")] @@ -452,6 +452,6 @@ public void uninstall_noop(ChocolateyConfiguration config, Action uninstall_run(ChocolateyConfiguration config, Action continueAction, Action beforeUninstallAction = null) => Uninstall(config, continueAction, beforeUninstallAction); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/tasks/RemovePendingPackagesTask.cs b/src/chocolatey/infrastructure.app/tasks/RemovePendingPackagesTask.cs index 9200b4c2e2..259d6ec796 100644 --- a/src/chocolatey/infrastructure.app/tasks/RemovePendingPackagesTask.cs +++ b/src/chocolatey/infrastructure.app/tasks/RemovePendingPackagesTask.cs @@ -100,7 +100,7 @@ private void HandleMessage(PreRunMessage message) } } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public void initialize() => Initialize(); @@ -108,6 +108,6 @@ public void initialize() [Obsolete("This overload is deprecated and will be removed in v3.")] public void shutdown() => Shutdown(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/templates/TemplateValues.cs b/src/chocolatey/infrastructure.app/templates/TemplateValues.cs index 72054a07d4..02424765bd 100644 --- a/src/chocolatey/infrastructure.app/templates/TemplateValues.cs +++ b/src/chocolatey/infrastructure.app/templates/TemplateValues.cs @@ -85,7 +85,7 @@ public string PackageNameLower public static readonly string VersionPropertyName = "PackageVersion"; public static readonly string MaintainerPropertyName = "MaintainerName"; -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public void set_normal() => SetNormal(); @@ -93,6 +93,6 @@ public void set_normal() [Obsolete("This overload is deprecated and will be removed in v3.")] public void set_auto() => SetAutomatic(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/utility/ArgumentsUtility.cs b/src/chocolatey/infrastructure.app/utility/ArgumentsUtility.cs index e11df001ed..bd64f32910 100644 --- a/src/chocolatey/infrastructure.app/utility/ArgumentsUtility.cs +++ b/src/chocolatey/infrastructure.app/utility/ArgumentsUtility.cs @@ -50,10 +50,10 @@ public static bool SensitiveArgumentsProvided(string commandArguments) ; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static bool arguments_contain_sensitive_information(string commandArguments) => SensitiveArgumentsProvided(commandArguments); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/utility/PackageUtility.cs b/src/chocolatey/infrastructure.app/utility/PackageUtility.cs index 78b52f0425..87dbf23af0 100644 --- a/src/chocolatey/infrastructure.app/utility/PackageUtility.cs +++ b/src/chocolatey/infrastructure.app/utility/PackageUtility.cs @@ -52,10 +52,10 @@ public static bool PackageIdHasDependencySuffix(ChocolateyConfiguration config, return true; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static bool package_is_a_dependency(ChocolateyConfiguration config, string packageName) => PackageIdHasDependencySuffix(config, packageName); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/validations/CacheFolderValidationLockdown.cs b/src/chocolatey/infrastructure.app/validations/CacheFolderValidationLockdown.cs index 17cf157a6b..53eebc1246 100644 --- a/src/chocolatey/infrastructure.app/validations/CacheFolderValidationLockdown.cs +++ b/src/chocolatey/infrastructure.app/validations/CacheFolderValidationLockdown.cs @@ -114,7 +114,7 @@ public ICollection Validate(ChocolateyConfiguration config) return result; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public ICollection validate(ChocolateyConfiguration config) @@ -122,6 +122,6 @@ public ICollection validate(ChocolateyConfiguration config) return Validate(config); } -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } \ No newline at end of file diff --git a/src/chocolatey/infrastructure.app/validations/GlobalConfigurationValidation.cs b/src/chocolatey/infrastructure.app/validations/GlobalConfigurationValidation.cs index beadb4e02f..0d72ec1383 100644 --- a/src/chocolatey/infrastructure.app/validations/GlobalConfigurationValidation.cs +++ b/src/chocolatey/infrastructure.app/validations/GlobalConfigurationValidation.cs @@ -84,10 +84,10 @@ to enable this feature (exit code 1). this.Log().Debug(" - Package Exit Code / Exit On Reboot = {0}".FormatWith(validationStatusResult.ToStringSafe())); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public ICollection validate(ChocolateyConfiguration config) => Validate(config); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure.app/validations/SystemStateValidation.cs b/src/chocolatey/infrastructure.app/validations/SystemStateValidation.cs index 89bc90acfe..0840685f97 100644 --- a/src/chocolatey/infrastructure.app/validations/SystemStateValidation.cs +++ b/src/chocolatey/infrastructure.app/validations/SystemStateValidation.cs @@ -105,10 +105,10 @@ or pass the option --exit-when-reboot-detected. } } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public ICollection validate(ChocolateyConfiguration config) => Validate(config); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/adapters/Assembly.cs b/src/chocolatey/infrastructure/adapters/Assembly.cs index 999eb6348a..a37d199e2e 100644 --- a/src/chocolatey/infrastructure/adapters/Assembly.cs +++ b/src/chocolatey/infrastructure/adapters/Assembly.cs @@ -138,10 +138,10 @@ public static implicit operator Assembly(System.Reflection.Assembly value) return new Assembly(value); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static IAssembly set_assembly(System.Reflection.Assembly value) => SetAssembly(value); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/adapters/IEncryptionUtility.cs b/src/chocolatey/infrastructure/adapters/IEncryptionUtility.cs index ad9fda3ee8..f9e25f0451 100644 --- a/src/chocolatey/infrastructure/adapters/IEncryptionUtility.cs +++ b/src/chocolatey/infrastructure/adapters/IEncryptionUtility.cs @@ -24,13 +24,13 @@ public interface IEncryptionUtility string DecryptString(string encryptedString); string GenerateUniqueToken(string caseInsensitiveKey); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] string encrypt_string(string cleartextValue); [Obsolete("This overload is deprecated and will be removed in v3.")] string decrypt_string(string encryptedString); [Obsolete("This overload is deprecated and will be removed in v3.")] string generate_unique_token(string caseInsensitiveKey); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs b/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs index c732105fd5..6d179255b5 100644 --- a/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs +++ b/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs @@ -196,7 +196,7 @@ public static string GetPassword(bool interactive) } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] [EditorBrowsable(EditorBrowsableState.Never)] public static void initialize_with(Lazy console) @@ -209,6 +209,6 @@ public static string prompt_for_confirmation(string prompt, IEnumerable [Obsolete("This overload is deprecated and will be removed in v3.")] public static string get_password(bool interactive) => GetPassword(interactive); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/commandline/ReadKeyTimeout.cs b/src/chocolatey/infrastructure/commandline/ReadKeyTimeout.cs index df6132c53d..df8a7ffe02 100644 --- a/src/chocolatey/infrastructure/commandline/ReadKeyTimeout.cs +++ b/src/chocolatey/infrastructure/commandline/ReadKeyTimeout.cs @@ -79,10 +79,10 @@ public void Dispose() _foregroundResponseReset.Dispose(); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static ConsoleKeyInfo read_key(int timeoutMilliseconds) => ReadKey(timeoutMilliseconds); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/commandline/ReadLineTimeout.cs b/src/chocolatey/infrastructure/commandline/ReadLineTimeout.cs index 5e75b48497..02e3257089 100644 --- a/src/chocolatey/infrastructure/commandline/ReadLineTimeout.cs +++ b/src/chocolatey/infrastructure/commandline/ReadLineTimeout.cs @@ -80,10 +80,10 @@ public void Dispose() } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static string read(int timeoutMilliseconds) => Read(timeoutMilliseconds); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/commands/CommandExecutor.cs b/src/chocolatey/infrastructure/commands/CommandExecutor.cs index 3eb526c3da..371df94c36 100644 --- a/src/chocolatey/infrastructure/commands/CommandExecutor.cs +++ b/src/chocolatey/infrastructure/commands/CommandExecutor.cs @@ -254,7 +254,7 @@ private static void LogError(object sender, DataReceivedEventArgs e) } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] [EditorBrowsable(EditorBrowsableState.Never)] public static void initialize_with(Lazy file_system, Func process_initializer) @@ -331,6 +331,6 @@ private static void log_output(object sender, DataReceivedEventArgs e) [Obsolete("This overload is deprecated and will be removed in v3.")] private static void log_error(object sender, DataReceivedEventArgs e) => LogError(sender, e); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/commands/Execute.cs b/src/chocolatey/infrastructure/commands/Execute.cs index 1fe7040763..819af1934f 100644 --- a/src/chocolatey/infrastructure/commands/Execute.cs +++ b/src/chocolatey/infrastructure/commands/Execute.cs @@ -135,7 +135,7 @@ public bool Command(Action action) return completed; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static Execute with_timeout(int timeoutInSeconds) => WithTimeout(timeoutInSeconds); @@ -151,6 +151,6 @@ public T command(Func function, T timeoutDefaultValue) [Obsolete("This overload is deprecated and will be removed in v3.")] public bool command(Action action) => Command(action); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/commands/ExternalCommandArgsBuilder.cs b/src/chocolatey/infrastructure/commands/ExternalCommandArgsBuilder.cs index b018331af5..4ce26c46b9 100644 --- a/src/chocolatey/infrastructure/commands/ExternalCommandArgsBuilder.cs +++ b/src/chocolatey/infrastructure/commands/ExternalCommandArgsBuilder.cs @@ -126,7 +126,7 @@ private static string QuoteArgumentValueIfRequired(ExternalCommandArgument argum return argument.ArgumentValue; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static string build_arguments(object properties, IDictionary configToArgNames) => BuildArguments(properties, configToArgNames); @@ -138,6 +138,6 @@ private static void fill_args_dictionary(Dictionary propertyValu [Obsolete("This overload is deprecated and will be removed in v3.")] private static string quote_arg_value_if_required(ExternalCommandArgument argument) => QuoteArgumentValueIfRequired(argument); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/commands/ICommand.cs b/src/chocolatey/infrastructure/commands/ICommand.cs index 3c62b649aa..b21f4f1426 100644 --- a/src/chocolatey/infrastructure/commands/ICommand.cs +++ b/src/chocolatey/infrastructure/commands/ICommand.cs @@ -66,7 +66,7 @@ public interface ICommand /// bool MayRequireAdminAccess(); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] void configure_argument_parser(OptionSet optionSet, ChocolateyConfiguration configuration); @@ -87,6 +87,6 @@ public interface ICommand [Obsolete("This overload is deprecated and will be removed in v3.")] bool may_require_admin_access(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/commands/ICommandExecutor.cs b/src/chocolatey/infrastructure/commands/ICommandExecutor.cs index 276f4b0ac3..a54a8a1267 100644 --- a/src/chocolatey/infrastructure/commands/ICommandExecutor.cs +++ b/src/chocolatey/infrastructure/commands/ICommandExecutor.cs @@ -56,7 +56,7 @@ int Execute( bool waitForExit ); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] int execute(string process, string arguments, int waitForExitInSeconds); @@ -96,6 +96,6 @@ int execute( bool allowUseWindow, bool waitForExit ); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/commands/IListCommand.cs b/src/chocolatey/infrastructure/commands/IListCommand.cs index 33de9cc57c..ba8bc1453f 100644 --- a/src/chocolatey/infrastructure/commands/IListCommand.cs +++ b/src/chocolatey/infrastructure/commands/IListCommand.cs @@ -24,19 +24,19 @@ public interface IListCommand : ICommand { int Count(ChocolateyConfiguration config); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] int count(ChocolateyConfiguration config); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } public interface IListCommand : IListCommand { IEnumerable List(ChocolateyConfiguration config); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] IEnumerable list(ChocolateyConfiguration config); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/commands/PowershellExecutor.cs b/src/chocolatey/infrastructure/commands/PowershellExecutor.cs index 392e60be3f..2f1bf137c9 100644 --- a/src/chocolatey/infrastructure/commands/PowershellExecutor.cs +++ b/src/chocolatey/infrastructure/commands/PowershellExecutor.cs @@ -82,7 +82,7 @@ public static string GetPowerShellLocation(IFileSystem fileSystem) throw new FileNotFoundException("Unable to find suitable location for PowerShell. Searched the following locations: '{0}'".FormatWith(string.Join("; ", _powershellLocations))); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static int execute( string command, @@ -95,6 +95,6 @@ public static int execute( [Obsolete("This overload is deprecated and will be removed in v3.")] public static string get_powershell_location(IFileSystem fileSystem) => GetPowerShellLocation(fileSystem); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/configuration/Config.cs b/src/chocolatey/infrastructure/configuration/Config.cs index dd2b47b2ac..0b00577198 100644 --- a/src/chocolatey/infrastructure/configuration/Config.cs +++ b/src/chocolatey/infrastructure/configuration/Config.cs @@ -53,7 +53,7 @@ public static ChocolateyConfiguration GetConfigurationSettings() return _configuration; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static void initialize_with(ChocolateyConfiguration configuration) => InitializeWith(configuration); @@ -61,6 +61,6 @@ public static void initialize_with(ChocolateyConfiguration configuration) [Obsolete("This overload is deprecated and will be removed in v3.")] public static ChocolateyConfiguration get_configuration_settings() => GetConfigurationSettings(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/cryptography/CryptoHashProvider.cs b/src/chocolatey/infrastructure/cryptography/CryptoHashProvider.cs index a88e0bc929..0d43aa50f2 100644 --- a/src/chocolatey/infrastructure/cryptography/CryptoHashProvider.cs +++ b/src/chocolatey/infrastructure/cryptography/CryptoHashProvider.cs @@ -142,7 +142,7 @@ public static string ComputeStringHash(string originalText, CryptoHashProviderTy return BitConverter.ToString(hash).Replace("-", string.Empty); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public void set_hash_algorithm(CryptoHashProviderType algorithmType) => SetHashAlgorithm(algorithmType); @@ -170,6 +170,6 @@ private static bool file_is_locked(Exception exception) [Obsolete("This overload is deprecated and will be removed in v3.")] public static string hash_value(string originalText, CryptoHashProviderType providerType) => ComputeStringHash(originalText, providerType); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/cryptography/DefaultEncryptionUtility.cs b/src/chocolatey/infrastructure/cryptography/DefaultEncryptionUtility.cs index f00f261159..e50a65f159 100644 --- a/src/chocolatey/infrastructure/cryptography/DefaultEncryptionUtility.cs +++ b/src/chocolatey/infrastructure/cryptography/DefaultEncryptionUtility.cs @@ -92,7 +92,7 @@ public string GenerateUniqueToken(string caseInsensitiveKey) return Convert.ToBase64String(hashProvider.CalculateHash(pathBytes)).ToUpperInvariant(); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public string encrypt_string(string cleartextValue) => EncryptString(cleartextValue); @@ -104,6 +104,6 @@ public string decrypt_string(string encryptedString) [Obsolete("This overload is deprecated and will be removed in v3.")] public string generate_unique_token(string caseInsensitiveKey) => GenerateUniqueToken(caseInsensitiveKey); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/cryptography/IHashProvider.cs b/src/chocolatey/infrastructure/cryptography/IHashProvider.cs index 16e18175f8..0f86eec0a1 100644 --- a/src/chocolatey/infrastructure/cryptography/IHashProvider.cs +++ b/src/chocolatey/infrastructure/cryptography/IHashProvider.cs @@ -51,7 +51,7 @@ public interface IHashProvider /// A computed hash of the array, based on the contents. string ComputeByteArrayHash(byte[] buffer); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] void set_hash_algorithm(CryptoHashProviderType algorithmType); @@ -63,6 +63,6 @@ public interface IHashProvider [Obsolete("This overload is deprecated and will be removed in v3.")] string hash_byte_array(byte[] buffer); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/events/EventManager.cs b/src/chocolatey/infrastructure/events/EventManager.cs index 6323dd5f3e..b05cc14def 100644 --- a/src/chocolatey/infrastructure/events/EventManager.cs +++ b/src/chocolatey/infrastructure/events/EventManager.cs @@ -76,7 +76,7 @@ public static IDisposable Subscribe(Action handleEvent, Action messageSubscriptionManager) => InitializeWith(messageSubscriptionManager); @@ -88,6 +88,6 @@ public static void publish(Event message) where Event : class, IMessage [Obsolete("This overload is deprecated and will be removed in v3.")] public static IDisposable subscribe(Action handleEvent, Action handleError, Func filter) where Event : class, IMessage => Subscribe(handleEvent,handleError, filter); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/extractors/AssemblyFileExtractor.cs b/src/chocolatey/infrastructure/extractors/AssemblyFileExtractor.cs index baec02c18d..927d46f4a8 100644 --- a/src/chocolatey/infrastructure/extractors/AssemblyFileExtractor.cs +++ b/src/chocolatey/infrastructure/extractors/AssemblyFileExtractor.cs @@ -118,7 +118,7 @@ public static void ExtractAssemblyResourcesToRelativeDirectory(IFileSystem fileS } } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static void extract_text_file_from_assembly(IFileSystem fileSystem, IAssembly assembly, string manifestLocation, string filePath, bool overwriteExisting = false) => ExtractTextFileFromAssembly(fileSystem, assembly, manifestLocation, filePath, overwriteExisting); @@ -130,6 +130,6 @@ public static void extract_binary_file_from_assembly(IFileSystem fileSystem, IAs [Obsolete("This overload is deprecated and will be removed in v3.")] public static void extract_all_resources_to_relative_directory(IFileSystem fileSystem, IAssembly assembly, string directoryPath, IList relativeDirectories, string resourcesToInclude, bool overwriteExisting = false, bool logOutput = false, bool throwError = true) => ExtractAssemblyResourcesToRelativeDirectory(fileSystem, assembly, directoryPath, relativeDirectories, resourcesToInclude, overwriteExisting, logOutput, throwError); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs b/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs index 048cba2866..b437ca704a 100644 --- a/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs +++ b/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs @@ -1030,7 +1030,7 @@ public Encoding GetFileEncoding(string filePath) } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public void initialize_with(Lazy environment) => InitializeWith(environment); @@ -1258,6 +1258,6 @@ public void ensure_file_attribute_removed(string path, FileAttributes attributes [Obsolete("This overload is deprecated and will be removed in v3.")] public Encoding get_file_encoding(string filePath) => GetFileEncoding(filePath); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/filesystem/FileSystem.cs b/src/chocolatey/infrastructure/filesystem/FileSystem.cs index e628c82348..0e09322544 100644 --- a/src/chocolatey/infrastructure/filesystem/FileSystem.cs +++ b/src/chocolatey/infrastructure/filesystem/FileSystem.cs @@ -35,10 +35,10 @@ public static byte[] ReadFileBytes(string filePath) return fileBytes; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static byte[] read_binary_file_into_byte_array(string filePath) => ReadFileBytes(filePath); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/filesystem/IFileSystem.cs b/src/chocolatey/infrastructure/filesystem/IFileSystem.cs index 34c36c8de3..784c44237a 100644 --- a/src/chocolatey/infrastructure/filesystem/IFileSystem.cs +++ b/src/chocolatey/infrastructure/filesystem/IFileSystem.cs @@ -465,7 +465,7 @@ public interface IFileSystem void EnsureFileAttributeRemoved(string path, FileAttributes attributes); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] string combine_paths(string leftItem, params string[] rightItems); @@ -624,6 +624,6 @@ public interface IFileSystem [Obsolete("This overload is deprecated and will be removed in v3.")] void ensure_file_attribute_removed(string path, FileAttributes attributes); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/guards/Ensure.cs b/src/chocolatey/infrastructure/guards/Ensure.cs index de4409afb9..2052f628a2 100644 --- a/src/chocolatey/infrastructure/guards/Ensure.cs +++ b/src/chocolatey/infrastructure/guards/Ensure.cs @@ -58,7 +58,7 @@ private static MemberExpression GetNameOnRight(this Expression e) } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static EnsureString that(Expression> expression) => That(expression); @@ -66,7 +66,7 @@ public static EnsureString that(Expression> expression) [Obsolete("This overload is deprecated and will be removed in v3.")] public static Ensure that(Expression> expression) where TypeToEnsure : class => That(expression); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } public class EnsureString : Ensure @@ -102,7 +102,7 @@ public EnsureString HasExtension(params string[] extensions) throw new ArgumentException(Name, "Value for {0} must contain one of the following extensions: {1}".FormatWith(Name, string.Join(", ", extensions))); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public EnsureString is_not_null_or_whitespace() => NotNullOrWhitespace(); @@ -110,7 +110,7 @@ public EnsureString is_not_null_or_whitespace() [Obsolete("This overload is deprecated and will be removed in v3.")] public EnsureString has_any_extension(params string[] extensions) => HasExtension(extensions); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } public class Ensure where EnsurableType : class @@ -142,7 +142,7 @@ public void Meets(Func ensureFunction, Action NotNull(); @@ -150,6 +150,6 @@ public void is_not_null() [Obsolete("This overload is deprecated and will be removed in v3.")] public void meets(Func ensureFunction, Action exceptionAction) => Meets(ensureFunction, exceptionAction); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/information/ProcessInformation.cs b/src/chocolatey/infrastructure/information/ProcessInformation.cs index e70e1b253e..5560fad706 100644 --- a/src/chocolatey/infrastructure/information/ProcessInformation.cs +++ b/src/chocolatey/infrastructure/information/ProcessInformation.cs @@ -226,7 +226,7 @@ enum TokenElevationType TokenElevationTypeLimited } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static bool user_is_administrator() => UserIsAdministrator(); @@ -246,6 +246,6 @@ public static bool user_is_remote() [Obsolete("This overload is deprecated and will be removed in v3.")] public static bool user_is_system() => UserIsSystem(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/information/VersionInformation.cs b/src/chocolatey/infrastructure/information/VersionInformation.cs index 3c5b52960e..d4b46ce752 100644 --- a/src/chocolatey/infrastructure/information/VersionInformation.cs +++ b/src/chocolatey/infrastructure/information/VersionInformation.cs @@ -95,7 +95,7 @@ public static string GetMinimumChocolateyVersion(IAssembly assembly = null) return "1.0.0"; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static string get_current_assembly_version(IAssembly assembly = null) => GetCurrentAssemblyVersion(assembly = null); @@ -107,6 +107,6 @@ public static string get_current_informational_version(IAssembly assembly = null [Obsolete("This overload is deprecated and will be removed in v3.")] public static string get_minimum_chocolatey_version(IAssembly assembly = null) => GetMinimumChocolateyVersion(assembly); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/licensing/ChocolateyLicense.cs b/src/chocolatey/infrastructure/licensing/ChocolateyLicense.cs index 65c4851616..47ab4858ab 100644 --- a/src/chocolatey/infrastructure/licensing/ChocolateyLicense.cs +++ b/src/chocolatey/infrastructure/licensing/ChocolateyLicense.cs @@ -42,10 +42,10 @@ public bool IsLicensedVersion() ; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public bool is_licensed_version() => IsLicensedVersion(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/licensing/License.cs b/src/chocolatey/infrastructure/licensing/License.cs index f6fe5090a1..85e27214eb 100644 --- a/src/chocolatey/infrastructure/licensing/License.cs +++ b/src/chocolatey/infrastructure/licensing/License.cs @@ -88,10 +88,10 @@ public static ChocolateyLicense ValidateLicense() return license; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static ChocolateyLicense validate_license() => ValidateLicense(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/licensing/LicenseValidation.cs b/src/chocolatey/infrastructure/licensing/LicenseValidation.cs index fe30004b5f..a930b56226 100644 --- a/src/chocolatey/infrastructure/licensing/LicenseValidation.cs +++ b/src/chocolatey/infrastructure/licensing/LicenseValidation.cs @@ -147,10 +147,10 @@ private static bool ShouldLogErrorsToConsole() return true; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static ChocolateyLicense validate() => Validate(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/logging/Log4NetAppenderConfiguration.cs b/src/chocolatey/infrastructure/logging/Log4NetAppenderConfiguration.cs index 2110f19989..8597f35b47 100644 --- a/src/chocolatey/infrastructure/logging/Log4NetAppenderConfiguration.cs +++ b/src/chocolatey/infrastructure/logging/Log4NetAppenderConfiguration.cs @@ -416,7 +416,7 @@ public static void SetupAdditionalLogFile(string logFileLocation) } } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static void initialize_with(Lazy console) => InitializeWith(console); @@ -440,6 +440,6 @@ public static void set_trace_logger_when_trace(bool enableTrace, string traceLog [Obsolete("This overload is deprecated and will be removed in v3.")] public static void configure_additional_log_file(string logFileLocation) => SetupAdditionalLogFile(logFileLocation); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/logging/Log4NetLog.cs b/src/chocolatey/infrastructure/logging/Log4NetLog.cs index c1ad0153c2..70ee2cfce5 100644 --- a/src/chocolatey/infrastructure/logging/Log4NetLog.cs +++ b/src/chocolatey/infrastructure/logging/Log4NetLog.cs @@ -116,10 +116,10 @@ private void Log(Level level, string message, params object[] formatting) _logger.Logger.Log(_declaringType, level, message.FormatWith(formatting), null); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public string decorate_message_with_audit_information(string message) => DecorateMessageWithAuditInformation(message); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/platforms/Platform.cs b/src/chocolatey/infrastructure/platforms/Platform.cs index 253612edf5..16f5c90ed5 100644 --- a/src/chocolatey/infrastructure/platforms/Platform.cs +++ b/src/chocolatey/infrastructure/platforms/Platform.cs @@ -196,7 +196,7 @@ _Inout_ LPOSVERSIONINFO lpVersionInfo // ReSharper restore InconsistentNaming -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] [EditorBrowsable(EditorBrowsableState.Never)] public static void initialize_with(Lazy environment, Lazy file_system) @@ -213,6 +213,6 @@ public static Version get_version() [Obsolete("This overload is deprecated and will be removed in v3.")] public static string get_name() => GetName(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/registration/AssemblyResolution.cs b/src/chocolatey/infrastructure/registration/AssemblyResolution.cs index 3845358672..900211e403 100644 --- a/src/chocolatey/infrastructure/registration/AssemblyResolution.cs +++ b/src/chocolatey/infrastructure/registration/AssemblyResolution.cs @@ -378,7 +378,7 @@ public static System.Reflection.Assembly ResolveExtensionOrMergedAssembly(object return null; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static IAssembly resolve_or_load_assembly(string assemblySimpleName, string publicKeyToken, string assemblyFileLocation) => ResolveOrLoadAssembly(assemblySimpleName, publicKeyToken, assemblyFileLocation); @@ -402,6 +402,6 @@ public static IAssembly load_extension(string assemblySimpleName) [Obsolete("This overload is deprecated and will be removed in v3.")] public static System.Reflection.Assembly resolve_extension_or_merged_assembly(object sender, ResolveEventArgs args) => ResolveExtensionOrMergedAssembly(sender, args); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/registration/Bootstrap.cs b/src/chocolatey/infrastructure/registration/Bootstrap.cs index 65ce247688..fcd42985b3 100644 --- a/src/chocolatey/infrastructure/registration/Bootstrap.cs +++ b/src/chocolatey/infrastructure/registration/Bootstrap.cs @@ -79,7 +79,7 @@ public static void Shutdown() { } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static void initialize() => Initialize(); @@ -91,6 +91,6 @@ public static void startup() [Obsolete("This overload is deprecated and will be removed in v3.")] public static void shutdown() => Shutdown(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/registration/SecurityProtocol.cs b/src/chocolatey/infrastructure/registration/SecurityProtocol.cs index a15a73d9a7..e9071245fc 100644 --- a/src/chocolatey/infrastructure/registration/SecurityProtocol.cs +++ b/src/chocolatey/infrastructure/registration/SecurityProtocol.cs @@ -24,9 +24,9 @@ namespace chocolatey.infrastructure.registration [Obsolete("This type is deprecated and will be removed in v3.")] public sealed class SecurityProtocol { -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 public static void set_protocol(ChocolateyConfiguration config, bool provideWarning) => HttpsSecurity.Reset(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/registration/SimpleInjectorContainer.cs b/src/chocolatey/infrastructure/registration/SimpleInjectorContainer.cs index bc4a61e6a0..ca73eba59c 100644 --- a/src/chocolatey/infrastructure/registration/SimpleInjectorContainer.cs +++ b/src/chocolatey/infrastructure/registration/SimpleInjectorContainer.cs @@ -146,10 +146,10 @@ private static void LoadComponentRegistry(Type componentRegistry, Container cont } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static void add_component_registry_class(Type componentType) => AddComponentRegistryClass(componentType); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/results/Result.cs b/src/chocolatey/infrastructure/results/Result.cs index 6b1e679f64..d0ce6d8991 100644 --- a/src/chocolatey/infrastructure/results/Result.cs +++ b/src/chocolatey/infrastructure/results/Result.cs @@ -46,9 +46,9 @@ public ICollection Messages get { return LazyMessages.Value; } } -#pragma warning disable IDE1006 // Naming Styles +#pragma warning disable IDE0022, IDE1006 // Naming Styles [Obsolete("This field is deprecated and will be removed in v3. Use LazyMessages or Messages instead.")] protected readonly Lazy> _messages; -#pragma warning restore IDE1006 // Naming Styles +#pragma warning restore IDE0022, IDE1006 // Naming Styles } } diff --git a/src/chocolatey/infrastructure/rules/IMetadataRule.cs b/src/chocolatey/infrastructure/rules/IMetadataRule.cs index d444e57b93..e37b387e56 100644 --- a/src/chocolatey/infrastructure/rules/IMetadataRule.cs +++ b/src/chocolatey/infrastructure/rules/IMetadataRule.cs @@ -27,9 +27,9 @@ public interface IMetadataRule IReadOnlyList GetAvailableRules(); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] IEnumerable validate(NuspecReader reader); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/services/EventSubscriptionManagerService.cs b/src/chocolatey/infrastructure/services/EventSubscriptionManagerService.cs index 9f931afb37..849e736be3 100644 --- a/src/chocolatey/infrastructure/services/EventSubscriptionManagerService.cs +++ b/src/chocolatey/infrastructure/services/EventSubscriptionManagerService.cs @@ -54,7 +54,7 @@ public IDisposable Subscribe(Action handleEvent, Action return subscription; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public void publish(Event eventMessage) where Event : class, IMessage => Publish(eventMessage); @@ -62,6 +62,6 @@ public void publish(Event eventMessage) where Event : class, IMessage [Obsolete("This overload is deprecated and will be removed in v3.")] public IDisposable subscribe(Action handleEvent, Action handleError, Func filter) where Event : class, IMessage => Subscribe(handleEvent, handleError, filter); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/services/IDateTimeService.cs b/src/chocolatey/infrastructure/services/IDateTimeService.cs index e5ba1584fe..2e28c1ace6 100644 --- a/src/chocolatey/infrastructure/services/IDateTimeService.cs +++ b/src/chocolatey/infrastructure/services/IDateTimeService.cs @@ -28,9 +28,9 @@ public interface IDateTimeService /// DateTime? GetCurrentDateTime(); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] DateTime? get_current_date_time(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/services/IEventSubscriptionManagerService.cs b/src/chocolatey/infrastructure/services/IEventSubscriptionManagerService.cs index b90b3ce8ab..6fa94c7849 100644 --- a/src/chocolatey/infrastructure/services/IEventSubscriptionManagerService.cs +++ b/src/chocolatey/infrastructure/services/IEventSubscriptionManagerService.cs @@ -41,12 +41,12 @@ public interface IEventSubscriptionManagerService /// The subscription as Disposable IDisposable Subscribe(Action handleEvent, Action handleError, Func filter) where Event : class, IMessage; -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] void publish(Event eventMessage) where Event : class, IMessage; [Obsolete("This overload is deprecated and will be removed in v3.")] IDisposable subscribe(Action handleEvent, Action handleError, Func filter) where Event : class, IMessage; -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/services/IRegularExpressionService.cs b/src/chocolatey/infrastructure/services/IRegularExpressionService.cs index 5d626a564c..4c44fd5dbc 100644 --- a/src/chocolatey/infrastructure/services/IRegularExpressionService.cs +++ b/src/chocolatey/infrastructure/services/IRegularExpressionService.cs @@ -33,9 +33,9 @@ public interface IRegularExpressionService /// string Replace(string input, string pattern, MatchEvaluator matchEvaluator); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] string replace(string input, string pattern, MatchEvaluator matchEvaluator); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/services/IRuleService.cs b/src/chocolatey/infrastructure/services/IRuleService.cs index e4c211cdf0..51a6c003ac 100644 --- a/src/chocolatey/infrastructure/services/IRuleService.cs +++ b/src/chocolatey/infrastructure/services/IRuleService.cs @@ -23,9 +23,9 @@ public interface IRuleService { IEnumerable ValidateRules(string filePath); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] IEnumerable validate_rules(string filePath); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/services/IXmlService.cs b/src/chocolatey/infrastructure/services/IXmlService.cs index eb2aa8389f..19cb89d53b 100644 --- a/src/chocolatey/infrastructure/services/IXmlService.cs +++ b/src/chocolatey/infrastructure/services/IXmlService.cs @@ -54,7 +54,7 @@ public interface IXmlService /// Log messages? void Serialize(XmlType xmlType, string xmlFilePath, bool isSilent); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] XmlType deserialize(string xmlFilePath); @@ -66,6 +66,6 @@ public interface IXmlService [Obsolete("This overload is deprecated and will be removed in v3.")] void serialize(XmlType xmlType, string xmlFilePath, bool isSilent); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/services/RegularExpressionService.cs b/src/chocolatey/infrastructure/services/RegularExpressionService.cs index 123c6d1132..122bac4973 100644 --- a/src/chocolatey/infrastructure/services/RegularExpressionService.cs +++ b/src/chocolatey/infrastructure/services/RegularExpressionService.cs @@ -30,10 +30,10 @@ public string Replace(string input, string pattern, MatchEvaluator matchEvaluato return regex.Replace(input, matchEvaluator); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public string replace(string input, string pattern, MatchEvaluator matchEvaluator) => Replace(input, pattern, matchEvaluator); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/services/SystemDateTimeService.cs b/src/chocolatey/infrastructure/services/SystemDateTimeService.cs index 6bd0eafd59..5a39b090b6 100644 --- a/src/chocolatey/infrastructure/services/SystemDateTimeService.cs +++ b/src/chocolatey/infrastructure/services/SystemDateTimeService.cs @@ -28,10 +28,10 @@ public class SystemDateTimeService : IDateTimeService return DateTime.Now; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public DateTime? get_current_date_time() => GetCurrentDateTime(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/services/SystemDateTimeUtcService.cs b/src/chocolatey/infrastructure/services/SystemDateTimeUtcService.cs index cb11d04087..bef5625d8f 100644 --- a/src/chocolatey/infrastructure/services/SystemDateTimeUtcService.cs +++ b/src/chocolatey/infrastructure/services/SystemDateTimeUtcService.cs @@ -28,10 +28,10 @@ public class SystemDateTimeUtcService : IDateTimeService return DateTime.UtcNow; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public DateTime? get_current_date_time() => GetCurrentDateTime(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/services/XmlService.cs b/src/chocolatey/infrastructure/services/XmlService.cs index 3a5e10116f..44f6cc52eb 100644 --- a/src/chocolatey/infrastructure/services/XmlService.cs +++ b/src/chocolatey/infrastructure/services/XmlService.cs @@ -197,7 +197,7 @@ public void Serialize(XmlType xmlType, string xmlFilePath, bool isSilen increaseRetryByMilliseconds: 200); } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public XmlType deserialize(string xmlFilePath) => Deserialize(xmlFilePath); @@ -213,6 +213,6 @@ public void serialize(XmlType xmlType, string xmlFilePath) [Obsolete("This overload is deprecated and will be removed in v3.")] public void serialize(XmlType xmlType, string xmlFilePath, bool isSilent) => Serialize(xmlType, xmlFilePath, isSilent); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/synchronization/GlobalMutex.cs b/src/chocolatey/infrastructure/synchronization/GlobalMutex.cs index 892953fc64..4a785ed2fa 100644 --- a/src/chocolatey/infrastructure/synchronization/GlobalMutex.cs +++ b/src/chocolatey/infrastructure/synchronization/GlobalMutex.cs @@ -130,7 +130,7 @@ public void Dispose() } } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static void enter(Action action, int timeout) => Enter(action, timeout); @@ -138,6 +138,6 @@ public static void enter(Action action, int timeout) [Obsolete("This overload is deprecated and will be removed in v3.")] public static T enter(Func func, int timeout) => Enter(func, timeout); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/tasks/ITask.cs b/src/chocolatey/infrastructure/tasks/ITask.cs index 35d3c5abfd..06bc3928bb 100644 --- a/src/chocolatey/infrastructure/tasks/ITask.cs +++ b/src/chocolatey/infrastructure/tasks/ITask.cs @@ -36,12 +36,12 @@ public interface ITask /// void Shutdown(); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] void initialize(); [Obsolete("This overload is deprecated and will be removed in v3.")] void shutdown(); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/tokens/TokenReplacer.cs b/src/chocolatey/infrastructure/tokens/TokenReplacer.cs index db107f4ba1..58b54e1223 100644 --- a/src/chocolatey/infrastructure/tokens/TokenReplacer.cs +++ b/src/chocolatey/infrastructure/tokens/TokenReplacer.cs @@ -74,7 +74,7 @@ public static IEnumerable GetTokens(string textWithTokens, string tokenP } } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static string replace_tokens(TConfig configuration, string textToReplace, string tokenPrefix = "[[", string tokenSuffix = "]]") => ReplaceTokens(configuration, textToReplace, tokenPrefix, tokenSuffix); @@ -82,6 +82,6 @@ public static string replace_tokens(TConfig configuration, string textT [Obsolete("This overload is deprecated and will be removed in v3.")] public static IEnumerable get_tokens(string textWithTokens, string tokenPrefix = "[[", string tokenSuffix = "]]") => GetTokens(textWithTokens, tokenPrefix, tokenSuffix); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/tolerance/FaultTolerance.cs b/src/chocolatey/infrastructure/tolerance/FaultTolerance.cs index b5aa14d20d..5ac6c0250d 100644 --- a/src/chocolatey/infrastructure/tolerance/FaultTolerance.cs +++ b/src/chocolatey/infrastructure/tolerance/FaultTolerance.cs @@ -194,7 +194,7 @@ public static T TryCatchWithLoggingException(Func function, string errorMe return returnValue; } -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] public static void retry(int numberOfTries, Action action, int waitDurationMilliseconds = 100, int increaseRetryByMilliseconds = 0, bool isSilent = false) => Retry(numberOfTries, action, waitDurationMilliseconds, increaseRetryByMilliseconds, isSilent); @@ -210,6 +210,6 @@ public static void try_catch_with_logging_exception(Action action, string errorM [Obsolete("This overload is deprecated and will be removed in v3.")] public static T try_catch_with_logging_exception(Func function, string errorMessage, bool throwError = false, bool logWarningInsteadOfError = false, bool logDebugInsteadOfError = false, bool isSilent = false) => TryCatchWithLoggingException(function, errorMessage, throwError, logWarningInsteadOfError, logDebugInsteadOfError, isSilent); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/validations/IValidation.cs b/src/chocolatey/infrastructure/validations/IValidation.cs index 3694d7fcaf..b335f18cde 100644 --- a/src/chocolatey/infrastructure/validations/IValidation.cs +++ b/src/chocolatey/infrastructure/validations/IValidation.cs @@ -34,9 +34,9 @@ public interface IValidation /// The validation results ICollection Validate(ChocolateyConfiguration config); -#pragma warning disable IDE1006 +#pragma warning disable IDE0022, IDE1006 [Obsolete("This overload is deprecated and will be removed in v3.")] ICollection validate(ChocolateyConfiguration config); -#pragma warning restore IDE1006 +#pragma warning restore IDE0022, IDE1006 } } From 44af99d9bf3f1ea98dda0f0961d7e608fc0c9700 Mon Sep 17 00:00:00 2001 From: Rain Sallow Date: Mon, 8 Apr 2024 10:51:17 -0400 Subject: [PATCH 04/18] (maint) Fix IDE1006 error Naming conventions --- .../infrastructure.app/registration/ContainerBinding.cs | 2 +- .../registration/SimpleInjectorContainerRegistrator.cs | 8 ++++---- src/chocolatey/infrastructure/adapters/Console.cs | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/chocolatey/infrastructure.app/registration/ContainerBinding.cs b/src/chocolatey/infrastructure.app/registration/ContainerBinding.cs index b4e136ea36..522e1248a6 100644 --- a/src/chocolatey/infrastructure.app/registration/ContainerBinding.cs +++ b/src/chocolatey/infrastructure.app/registration/ContainerBinding.cs @@ -150,7 +150,7 @@ You can override this compatibility check and force loading the extension by pas } this.Log().Debug("Calling registration module '{0}' in extension '{1}'!", registration.GetType().Name, assemblyName); - clonedRegistrator._validationHandlers.Clear(); + clonedRegistrator.ValidationHandlers.Clear(); clonedRegistrator.RegisterValidator((instanceType) => ValidateMinimumChocolateyVersion(instanceType, chocoVersion)); registration.RegisterDependencies(clonedRegistrator, configuration.DeepCopy()); hasRegisteredDependencies = !clonedRegistrator.RegistrationFailed; diff --git a/src/chocolatey/infrastructure.app/registration/SimpleInjectorContainerRegistrator.cs b/src/chocolatey/infrastructure.app/registration/SimpleInjectorContainerRegistrator.cs index 3f6467d206..1794185eab 100644 --- a/src/chocolatey/infrastructure.app/registration/SimpleInjectorContainerRegistrator.cs +++ b/src/chocolatey/infrastructure.app/registration/SimpleInjectorContainerRegistrator.cs @@ -33,7 +33,7 @@ namespace chocolatey.infrastructure.app.registration internal sealed class SimpleInjectorContainerRegistrator : IContainerRegistrator, ICloneable { - internal List> _validationHandlers = new List>(); + internal List> ValidationHandlers = new List>(); // We need to store the aliases for the commands to prevent them from // being overridden when the original class implementing these hasn't been removed. @@ -76,7 +76,7 @@ public object Clone() cloned._registeredCommands = _registeredCommands.DeepCopy(); cloned._singletonServices = _singletonServices.DeepCopy(); cloned._transientServices = _transientServices.DeepCopy(); - cloned._validationHandlers = new List>(); + cloned.ValidationHandlers = new List>(); return cloned; } @@ -221,7 +221,7 @@ public void RegisterService(bool transient = false) public void RegisterValidator(Func validation_func) { - _validationHandlers.Add(validation_func); + ValidationHandlers.Add(validation_func); } public void RegisterSourceRunner() where TService : class @@ -356,7 +356,7 @@ private void AddToMultiServices(Type interfaceType, Type serviceType) private bool CanRegisterService(Type serviceType) { - foreach (var validator in _validationHandlers) + foreach (var validator in ValidationHandlers) { if (!validator(serviceType)) { diff --git a/src/chocolatey/infrastructure/adapters/Console.cs b/src/chocolatey/infrastructure/adapters/Console.cs index 9bacb403f9..413a963346 100644 --- a/src/chocolatey/infrastructure/adapters/Console.cs +++ b/src/chocolatey/infrastructure/adapters/Console.cs @@ -327,6 +327,7 @@ private CONSOLE_SCREEN_BUFFER_INFO GetConsoleBuffer() return defaultConsoleBuffer; } + #pragma warning disable IDE1006 // naming conventions /// /// Contains information about a console screen buffer. /// @@ -346,6 +347,7 @@ private struct CONSOLE_SCREEN_BUFFER_INFO /// A CoOrd structure that contains the maximum size of the console window, in character columns and rows, given the current screen buffer size and font and the screen size. internal COORD dwMaximumWindowSize; } + #pragma warning restore IDE1006 // naming conventions /// /// Defines the coordinates of a character cell in a console screen buffer. From 976d8551c3f01721c428fc8619626e70dbcef9fb Mon Sep 17 00:00:00 2001 From: Rain Sallow Date: Wed, 3 Apr 2024 15:29:34 -0400 Subject: [PATCH 05/18] (maint) Fix IDE0011 errors Use braces for if statements --- src/chocolatey.console/Program.cs | 15 +- .../scenarios/InstallScenarios.cs | 5 +- src/chocolatey.tests/MockLogger.cs | 10 +- src/chocolatey.tests/TinySpec.cs | 5 +- .../utility/PackageUtilitySpecs.cs | 7 +- src/chocolatey/AssemblyExtensions.cs | 15 +- src/chocolatey/GetChocolatey.cs | 6 +- src/chocolatey/ILogExtensions.cs | 10 +- src/chocolatey/ObjectExtensions.cs | 5 +- src/chocolatey/StringExtensions.cs | 55 ++- src/chocolatey/TypeExtensions.cs | 10 +- .../builders/ConfigurationBuilder.cs | 17 +- .../commands/ChocolateyApiKeyCommand.cs | 5 +- .../commands/ChocolateyConfigCommand.cs | 27 +- .../commands/ChocolateyFeatureCommand.cs | 11 +- .../commands/ChocolateyInstallCommand.cs | 15 +- .../commands/ChocolateyPinCommand.cs | 11 +- .../commands/ChocolateySourceCommand.cs | 11 +- .../commands/ChocolateyTemplateCommand.cs | 6 +- .../commands/ChocolateyUpgradeCommand.cs | 25 +- .../configuration/EnvironmentSettings.cs | 85 +++- .../domain/GenericRegistryValue.cs | 5 +- .../domain/RegistryApplicationKey.cs | 10 +- .../domain/RegistryValueExtensions.cs | 5 +- .../domain/installers/CustomInstaller.cs | 11 +- .../domain/installers/InstallerBase.cs | 15 +- .../infrastructure.app/nuget/NugetCommon.cs | 49 +- .../infrastructure.app/nuget/NugetList.cs | 5 +- .../runners/ConsoleApplication.cs | 5 +- .../runners/GenericRunner.cs | 25 +- .../services/AutomaticUninstallerService.cs | 22 +- .../ChocolateyConfigSettingsService.cs | 66 ++- .../ChocolateyPackageInformationService.cs | 56 ++- .../services/ChocolateyPackageService.cs | 418 ++++++++++++++---- .../services/ConfigTransformService.cs | 6 +- .../services/CygwinService.cs | 22 +- .../services/FilesService.cs | 75 +++- .../services/NugetService.cs | 303 ++++++++++--- .../services/PowershellService.cs | 75 +++- .../services/PythonService.cs | 68 ++- .../services/RegistryService.cs | 45 +- .../services/RubyGemsService.cs | 29 +- .../services/ShimGenerationService.cs | 23 +- .../services/TemplateService.cs | 38 +- .../services/WindowsFeatureService.cs | 51 ++- .../tasks/RemovePendingPackagesTask.cs | 5 +- .../utility/PackageUtility.cs | 11 +- .../infrastructure/adapters/Console.cs | 170 +++++-- .../infrastructure/adapters/Environment.cs | 5 +- .../commandline/ExitScenarioHandler.cs | 5 +- .../commandline/InteractivePrompt.cs | 23 +- .../commandline/ReadKeyTimeout.cs | 5 +- .../commandline/ReadLineTimeout.cs | 5 +- .../commands/CommandExecutor.cs | 10 +- .../infrastructure/commands/Execute.cs | 15 +- .../commands/ExternalCommandArgsBuilder.cs | 10 +- .../commands/PowershellExecutor.cs | 5 +- .../cryptography/CryptoHashProvider.cs | 12 +- .../cryptography/DefaultEncryptionUtility.cs | 5 +- .../extractors/AssemblyFileExtractor.cs | 6 +- .../filesystem/DotNetFileSystem.cs | 125 +++++- .../infrastructure/guards/Ensure.cs | 4 + .../information/ProcessInformation.cs | 30 +- .../information/VersionInformation.cs | 17 +- .../licensing/LicenseValidation.cs | 15 +- src/chocolatey/infrastructure/logging/Log.cs | 10 +- .../logging/Log4NetAppenderConfiguration.cs | 26 +- .../infrastructure/logging/Log4NetLog.cs | 30 +- .../infrastructure/logging/TraceLog.cs | 5 +- .../infrastructure/platforms/Platform.cs | 5 + .../powershell/PoshHostUserInterface.cs | 67 ++- .../registration/SimpleInjectorContainer.cs | 5 +- .../EventSubscriptionManagerService.cs | 11 +- .../synchronization/GlobalMutex.cs | 20 +- .../infrastructure/tokens/TokenReplacer.cs | 15 +- .../tolerance/FaultTolerance.cs | 38 +- src/chocolatey/infrastructure/xml/XmlCData.cs | 5 +- 77 files changed, 2030 insertions(+), 473 deletions(-) diff --git a/src/chocolatey.console/Program.cs b/src/chocolatey.console/Program.cs index 1f89ff978b..943f5b12b9 100644 --- a/src/chocolatey.console/Program.cs +++ b/src/chocolatey.console/Program.cs @@ -60,7 +60,10 @@ private static void Main(string[] args) string loggingLocation = ApplicationParameters.LoggingLocation; //no file system at this point - if (!Directory.Exists(loggingLocation)) Directory.CreateDirectory(loggingLocation); + if (!Directory.Exists(loggingLocation)) + { + Directory.CreateDirectory(loggingLocation); + } Log4NetAppenderConfiguration.Configure(loggingLocation, excludeLoggerNames: ChocolateyLoggers.Trace.ToStringSafe()); Bootstrap.Initialize(); @@ -178,7 +181,10 @@ private static void Main(string[] args) "chocolatey".Log().Error(ChocolateyLoggers.LogFileOnly, () => "More Details: {0}".FormatWith(ex.ToString())); } - if (Environment.ExitCode == 0) Environment.ExitCode = 1; + if (Environment.ExitCode == 0) + { + Environment.ExitCode = 1; + } } finally { @@ -228,7 +234,10 @@ private static void AddAssemblyResolver() private static void ReportVersionAndExitIfRequested(string[] args, ChocolateyConfiguration config) { - if (args == null || args.Length == 0) return; + if (args == null || args.Length == 0) + { + return; + } var firstArg = args.FirstOrDefault(); if (firstArg.IsEqualTo("-v") || firstArg.IsEqualTo("--version")) diff --git a/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs b/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs index 53f21c6f44..f42660a397 100644 --- a/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs @@ -383,7 +383,10 @@ public void Should_install_where_install_location_reports() { foreach (var packageResult in Results) { - if (packageResult.Value.Name.IsEqualTo("missingpackage")) continue; + if (packageResult.Value.Name.IsEqualTo("missingpackage")) + { + continue; + } DirectoryAssert.Exists(packageResult.Value.InstallLocation); } diff --git a/src/chocolatey.tests/MockLogger.cs b/src/chocolatey.tests/MockLogger.cs index 21b9bbcc04..2d09c9562f 100644 --- a/src/chocolatey.tests/MockLogger.cs +++ b/src/chocolatey.tests/MockLogger.cs @@ -63,7 +63,10 @@ public int ContainsMessageCount(string expectedMessage) { foreach (var message in messageLevel.Value.OrEmpty()) { - if (message.Contains(expectedMessage)) messageCount++; + if (message.Contains(expectedMessage)) + { + messageCount++; + } } } @@ -75,7 +78,10 @@ public int ContainsMessageCount(string expectedMessage, LogLevel level) int messageCount = 0; foreach (var message in MessagesFor(level).OrEmpty()) { - if (message.Contains(expectedMessage)) messageCount++; + if (message.Contains(expectedMessage)) + { + messageCount++; + } } return messageCount; diff --git a/src/chocolatey.tests/TinySpec.cs b/src/chocolatey.tests/TinySpec.cs index f072a37cf2..c1e601d905 100644 --- a/src/chocolatey.tests/TinySpec.cs +++ b/src/chocolatey.tests/TinySpec.cs @@ -63,7 +63,10 @@ public MockLogger MockLogger [OneTimeSetUp] public void Setup() { - if (MockLogger != null) MockLogger.Reset(); + if (MockLogger != null) + { + MockLogger.Reset(); + } //Log.InitializeWith(MockLogger); NugetCommon.ClearRepositoriesCache(); Context(); diff --git a/src/chocolatey.tests/infrastructure.app/utility/PackageUtilitySpecs.cs b/src/chocolatey.tests/infrastructure.app/utility/PackageUtilitySpecs.cs index ea81e2d309..5a49ad2e29 100644 --- a/src/chocolatey.tests/infrastructure.app/utility/PackageUtilitySpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/utility/PackageUtilitySpecs.cs @@ -52,8 +52,11 @@ public class When_PackageUtility_is_checking_if_package_is_dependency : PackageU public When_PackageUtility_is_checking_if_package_is_dependency(string packageName, string configNames, bool expectedResult) { - if (Platform.GetPlatform() != PlatformType.Windows) configNames = configNames.Replace("\\", "/"); - + if (Platform.GetPlatform() != PlatformType.Windows) + { + configNames = configNames.Replace("\\", "/"); + } + _packageName = packageName; _config.PackageNames = configNames; _expectedResult = expectedResult; diff --git a/src/chocolatey/AssemblyExtensions.cs b/src/chocolatey/AssemblyExtensions.cs index 510379431e..efc47ec119 100644 --- a/src/chocolatey/AssemblyExtensions.cs +++ b/src/chocolatey/AssemblyExtensions.cs @@ -75,18 +75,27 @@ public static Stream GetManifestStream(this IAssembly assembly, string manifestR /// Borrowed heavily from http://dhvik.blogspot.com/2009/05/assemblynamegetpublickeytoken-tostring.html public static string GetPublicKeyToken(this IAssembly assembly) { - if (assembly == null) return string.Empty; + if (assembly == null) + { + return string.Empty; + } return assembly.GetName().GetPublicKeyTokenString(); } public static string GetPublicKeyTokenString(this AssemblyName assemblyName) { - if (assemblyName == null) return string.Empty; + if (assemblyName == null) + { + return string.Empty; + } byte[] publicKeyToken = assemblyName.GetPublicKeyToken(); - if (publicKeyToken == null || publicKeyToken.Length == 0) return string.Empty; + if (publicKeyToken == null || publicKeyToken.Length == 0) + { + return string.Empty; + } return publicKeyToken.Select(x => x.ToString("x2")).Aggregate((x, y) => x + y); } diff --git a/src/chocolatey/GetChocolatey.cs b/src/chocolatey/GetChocolatey.cs index c4f2814062..d66320d537 100644 --- a/src/chocolatey/GetChocolatey.cs +++ b/src/chocolatey/GetChocolatey.cs @@ -413,7 +413,11 @@ private void EnsureOriginalConfiguration(IList args, Action { - if (action != null) action.Invoke(config); + if (action != null) + { + action.Invoke(config); + } + return true; }); } diff --git a/src/chocolatey/ILogExtensions.cs b/src/chocolatey/ILogExtensions.cs index fa4d2ae227..cf382ebfd5 100644 --- a/src/chocolatey/ILogExtensions.cs +++ b/src/chocolatey/ILogExtensions.cs @@ -33,13 +33,19 @@ public static class ILogExtensions [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] public static void Trace(this ILog logger, string message, params object[] formatting) { - if (LogTraceMessages) ChocolateyLoggers.Trace.ToStringSafe().Log().Debug(message, formatting); + if (LogTraceMessages) + { + ChocolateyLoggers.Trace.ToStringSafe().Log().Debug(message, formatting); + } } [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] public static void Trace(this ILog logger, Func message) { - if (LogTraceMessages) ChocolateyLoggers.Trace.ToStringSafe().Log().Debug(message); + if (LogTraceMessages) + { + ChocolateyLoggers.Trace.ToStringSafe().Log().Debug(message); + } } [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] diff --git a/src/chocolatey/ObjectExtensions.cs b/src/chocolatey/ObjectExtensions.cs index a714faf7f2..6233675e06 100644 --- a/src/chocolatey/ObjectExtensions.cs +++ b/src/chocolatey/ObjectExtensions.cs @@ -32,7 +32,10 @@ public static class ObjectExtensions /// if is null, otherwise .ToString() public static string ToStringSafe(this object input) { - if (input == null) return string.Empty; + if (input == null) + { + return string.Empty; + } return input.ToString(); } diff --git a/src/chocolatey/StringExtensions.cs b/src/chocolatey/StringExtensions.cs index 3cdfdd35a6..fba121736e 100644 --- a/src/chocolatey/StringExtensions.cs +++ b/src/chocolatey/StringExtensions.cs @@ -42,7 +42,10 @@ public static class StringExtensions /// A formatted string, or if is null. public static string FormatWith(this string input, params object[] formatting) { - if (string.IsNullOrWhiteSpace(input)) return string.Empty; + if (string.IsNullOrWhiteSpace(input)) + { + return string.Empty; + } try { @@ -137,7 +140,10 @@ public static string SplitOnSpace(this string input, string linePrefix = "", int /// public static string TrimSafe(this string input) { - if (string.IsNullOrWhiteSpace(input)) return string.Empty; + if (string.IsNullOrWhiteSpace(input)) + { + return string.Empty; + } return input.Trim(); } @@ -149,7 +155,10 @@ public static string TrimSafe(this string input) /// public static string ToLowerSafe(this string input) { - if (string.IsNullOrWhiteSpace(input)) return string.Empty; + if (string.IsNullOrWhiteSpace(input)) + { + return string.Empty; + } return input.ToLower(); } @@ -161,7 +170,10 @@ public static string ToLowerSafe(this string input) /// public static string ToStringSafe(this string input) { - if (string.IsNullOrWhiteSpace(input)) return string.Empty; + if (string.IsNullOrWhiteSpace(input)) + { + return string.Empty; + } return input; } @@ -175,7 +187,10 @@ public static SecureString ToSecureStringSafe(this string input) { var secureString = new SecureString(); - if (string.IsNullOrWhiteSpace(input)) return secureString; + if (string.IsNullOrWhiteSpace(input)) + { + return secureString; + } foreach (char character in input) { @@ -187,7 +202,10 @@ public static SecureString ToSecureStringSafe(this string input) public static string FromSecureStringSafe(this SecureString input) { - if (input == null) return string.Empty; + if (input == null) + { + return string.Empty; + } IntPtr unmanagedString = IntPtr.Zero; try @@ -210,7 +228,10 @@ public static string FromSecureStringSafe(this SecureString input) /// public static string QuoteIfContainsSpaces(this string input) { - if (string.IsNullOrWhiteSpace(input)) return input; + if (string.IsNullOrWhiteSpace(input)) + { + return input; + } if (_spacePattern.IsMatch(input)) { @@ -250,7 +271,10 @@ public static bool ContainsSafe(this string input, string search, StringComparis /// public static string UnquoteSafe(this string input) { - if (string.IsNullOrWhiteSpace(input)) return string.Empty; + if (string.IsNullOrWhiteSpace(input)) + { + return string.Empty; + } if (input.StartsWith(" ")) { @@ -271,7 +295,10 @@ public static string UnquoteSafe(this string input) public static string EscapeCurlyBraces(this string input) { - if (string.IsNullOrWhiteSpace(input)) return string.Empty; + if (string.IsNullOrWhiteSpace(input)) + { + return string.Empty; + } return _openBraceRegex.Replace(_closeBraceRegex.Replace(input,"}}"),"{{"); } @@ -283,9 +310,15 @@ public static string EscapeCurlyBraces(this string input) /// The input, but with double quotes if there is a pipe character found in the string. public static string QuoteIfContainsPipe(this string input) { - if (string.IsNullOrWhiteSpace(input)) return input.ToStringSafe(); + if (string.IsNullOrWhiteSpace(input)) + { + return input.ToStringSafe(); + } - if (input.ContainsSafe("|")) return "\"{0}\"".FormatWith(input); + if (input.ContainsSafe("|")) + { + return "\"{0}\"".FormatWith(input); + } return input; } diff --git a/src/chocolatey/TypeExtensions.cs b/src/chocolatey/TypeExtensions.cs index 42af1cf895..3ee507f1b7 100644 --- a/src/chocolatey/TypeExtensions.cs +++ b/src/chocolatey/TypeExtensions.cs @@ -30,7 +30,10 @@ public static class TypeExtensions /// true if meets criteria for system type public static bool IsBuiltinType(this Type type) { - if (type == null) return false; + if (type == null) + { + return false; + } // if all else fails, check to see if the namespace is at system. return type.IsPrimitive @@ -46,7 +49,10 @@ public static bool IsBuiltinType(this Type type) /// true if enumerable public static bool IsCollectionType(this Type type) { - if (type == null) return false; + if (type == null) + { + return false; + } // Surely we can do a check around "is ICollection" / "is ICollection<>" here? return type.IsArray diff --git a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs index e593c4c6f6..ce574f0829 100644 --- a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs +++ b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs @@ -239,7 +239,10 @@ private static void SetAllConfigItems(ChocolateyConfiguration config, ConfigFile } // if it is still empty, use temp in the Chocolatey install directory. - if (string.IsNullOrWhiteSpace(config.CacheLocation)) config.CacheLocation = fileSystem.CombinePaths(ApplicationParameters.InstallLocation, "temp"); + if (string.IsNullOrWhiteSpace(config.CacheLocation)) + { + config.CacheLocation = fileSystem.CombinePaths(ApplicationParameters.InstallLocation, "temp"); + } var commandExecutionTimeoutSeconds = 0; var commandExecutionTimeout = SetConfigItem( @@ -531,9 +534,13 @@ private static void SetLicensedOptions(ChocolateyConfiguration config, Chocolate if (licensedConfigBuilder == null) { - if (config.RegularOutput) "chocolatey".Log().Warn(ChocolateyLoggers.Important, + if (config.RegularOutput) + { + "chocolatey".Log().Warn(ChocolateyLoggers.Important, @"Unable to set licensed configuration. Please upgrade to a newer licensed version (choco upgrade chocolatey.extension)."); + } + return; } try @@ -551,7 +558,11 @@ private static void SetLicensedOptions(ChocolateyConfiguration config, Chocolate catch (Exception ex) { var isDebug = ApplicationParameters.IsDebugModeCliPrimitive(); - if (config.Debug) isDebug = true; + if (config.Debug) + { + isDebug = true; + } + var message = isDebug ? ex.ToString() : ex.Message; if (isDebug && ex.InnerException != null) diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs index b0a7900a81..13515f5a10 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs @@ -212,7 +212,10 @@ public virtual void Run(ChocolateyConfiguration configuration) public virtual bool MayRequireAdminAccess() { var config = Config.GetConfigurationSettings(); - if (config == null) return true; + if (config == null) + { + return true; + } return !string.IsNullOrWhiteSpace(config.ApiKeyCommand.Key); } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs index 59af1fc88f..48fa69d470 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs @@ -62,7 +62,11 @@ public virtual void ParseAdditionalArguments(IList unparsedArguments, Ch Enum.TryParse(unparsedCommand, true, out command); if (command == ConfigCommandType.Unknown) { - if (!string.IsNullOrWhiteSpace(unparsedCommand)) this.Log().Warn("Unknown command {0}. Setting to list.".FormatWith(unparsedCommand)); + if (!string.IsNullOrWhiteSpace(unparsedCommand)) + { + this.Log().Warn("Unknown command {0}. Setting to list.".FormatWith(unparsedCommand)); + } + command = ConfigCommandType.List; } @@ -71,7 +75,10 @@ public virtual void ParseAdditionalArguments(IList unparsedArguments, Ch if ((configuration.ConfigCommand.Command == ConfigCommandType.List || !string.IsNullOrWhiteSpace(configuration.ConfigCommand.Name) ) - && unparsedArguments.Count > 1) throw new ApplicationException("A single features command must be listed. Please see the help menu for those commands"); + && unparsedArguments.Count > 1) + { + throw new ApplicationException("A single features command must be listed. Please see the help menu for those commands"); + } if (string.IsNullOrWhiteSpace(configuration.ConfigCommand.Name) && unparsedArguments.Count >= 2) { @@ -85,8 +92,15 @@ public virtual void ParseAdditionalArguments(IList unparsedArguments, Ch public virtual void Validate(ChocolateyConfiguration configuration) { - if (configuration.ConfigCommand.Command != ConfigCommandType.List && string.IsNullOrWhiteSpace(configuration.ConfigCommand.Name)) throw new ApplicationException("When specifying the subcommand '{0}', you must also specify --name by option or position.".FormatWith(configuration.ConfigCommand.Command.ToStringSafe().ToLower())); - if (configuration.ConfigCommand.Command == ConfigCommandType.Set && string.IsNullOrWhiteSpace(configuration.ConfigCommand.ConfigValue)) throw new ApplicationException("When specifying the subcommand '{0}', you must also specify --value by option or position.".FormatWith(configuration.ConfigCommand.Command.ToStringSafe().ToLower())); + if (configuration.ConfigCommand.Command != ConfigCommandType.List && string.IsNullOrWhiteSpace(configuration.ConfigCommand.Name)) + { + throw new ApplicationException("When specifying the subcommand '{0}', you must also specify --name by option or position.".FormatWith(configuration.ConfigCommand.Command.ToStringSafe().ToLower())); + } + + if (configuration.ConfigCommand.Command == ConfigCommandType.Set && string.IsNullOrWhiteSpace(configuration.ConfigCommand.ConfigValue)) + { + throw new ApplicationException("When specifying the subcommand '{0}', you must also specify --value by option or position.".FormatWith(configuration.ConfigCommand.Command.ToStringSafe().ToLower())); + } } public virtual void HelpMessage(ChocolateyConfiguration configuration) @@ -167,7 +181,10 @@ public virtual void Run(ChocolateyConfiguration configuration) public virtual bool MayRequireAdminAccess() { var config = Config.GetConfigurationSettings(); - if (config == null) return true; + if (config == null) + { + return true; + } return config.ConfigCommand.Command != ConfigCommandType.List; } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs index 9df151432e..036995b6db 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs @@ -59,7 +59,11 @@ public virtual void ParseAdditionalArguments(IList unparsedArguments, Ch Enum.TryParse(unparsedCommand, true, out command); if (command == FeatureCommandType.Unknown) { - if (!string.IsNullOrWhiteSpace(unparsedCommand)) this.Log().Warn("Unknown command {0}. Setting to list.".FormatWith(unparsedCommand)); + if (!string.IsNullOrWhiteSpace(unparsedCommand)) + { + this.Log().Warn("Unknown command {0}. Setting to list.".FormatWith(unparsedCommand)); + } + command = FeatureCommandType.List; } @@ -157,7 +161,10 @@ public virtual void Run(ChocolateyConfiguration configuration) public virtual bool MayRequireAdminAccess() { var config = Config.GetConfigurationSettings(); - if (config == null) return true; + if (config == null) + { + return true; + } return config.FeatureCommand.Command != FeatureCommandType.List; } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs index bcd42ec666..fad1080df9 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs @@ -109,19 +109,28 @@ public virtual void ConfigureArgumentParser(OptionSet optionSet, ChocolateyConfi "IgnoreChecksums - Ignore checksums provided by the package. Overrides the default feature '{0}' set to '{1}'.".FormatWith(ApplicationParameters.Features.ChecksumFiles, configuration.Features.ChecksumFiles.ToStringSafe()), option => { - if (option != null) configuration.Features.ChecksumFiles = false; + if (option != null) + { + configuration.Features.ChecksumFiles = false; + } }) .Add("allowemptychecksum|allowemptychecksums|allow-empty-checksums", "Allow Empty Checksums - Allow packages to have empty/missing checksums for downloaded resources from non-secure locations (HTTP, FTP). Use this switch is not recommended if using sources that download resources from the internet. Overrides the default feature '{0}' set to '{1}'.".FormatWith(ApplicationParameters.Features.AllowEmptyChecksums, configuration.Features.AllowEmptyChecksums.ToStringSafe()), option => { - if (option != null) configuration.Features.AllowEmptyChecksums = true; + if (option != null) + { + configuration.Features.AllowEmptyChecksums = true; + } }) .Add("allowemptychecksumsecure|allowemptychecksumssecure|allow-empty-checksums-secure", "Allow Empty Checksums Secure - Allow packages to have empty checksums for downloaded resources from secure locations (HTTPS). Overrides the default feature '{0}' set to '{1}'.".FormatWith(ApplicationParameters.Features.AllowEmptyChecksumsSecure, configuration.Features.AllowEmptyChecksumsSecure.ToStringSafe()), option => { - if (option != null) configuration.Features.AllowEmptyChecksumsSecure = true; + if (option != null) + { + configuration.Features.AllowEmptyChecksumsSecure = true; + } }) .Add("requirechecksum|requirechecksums|require-checksums", "Require Checksums - Requires packages to have checksums for downloaded resources (both non-secure and secure). Overrides the default feature '{0}' set to '{1}' and '{2}' set to '{3}'.".FormatWith(ApplicationParameters.Features.AllowEmptyChecksums, configuration.Features.AllowEmptyChecksums.ToStringSafe(), ApplicationParameters.Features.AllowEmptyChecksumsSecure, configuration.Features.AllowEmptyChecksumsSecure.ToStringSafe()), diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs index 6b55dc389c..ca2ec3d134 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs @@ -74,7 +74,11 @@ public virtual void ParseAdditionalArguments(IList unparsedArguments, Ch if (command == PinCommandType.Unknown) { - if (!string.IsNullOrWhiteSpace(unparsedCommand)) this.Log().Warn("Unknown command {0}. Setting to list.".FormatWith(unparsedCommand)); + if (!string.IsNullOrWhiteSpace(unparsedCommand)) + { + this.Log().Warn("Unknown command {0}. Setting to list.".FormatWith(unparsedCommand)); + } + command = PinCommandType.List; } @@ -224,7 +228,10 @@ public virtual void SetPin(ChocolateyConfiguration config) public virtual bool MayRequireAdminAccess() { var config = Config.GetConfigurationSettings(); - if (config == null) return true; + if (config == null) + { + return true; + } return config.PinCommand.Command != PinCommandType.List; } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs index a9d43047c3..a489c23eee 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs @@ -92,7 +92,11 @@ public virtual void ParseAdditionalArguments(IList unparsedArguments, Ch Enum.TryParse(unparsedCommand, true, out command); if (command == SourceCommandType.Unknown) { - if (!string.IsNullOrWhiteSpace(unparsedCommand)) this.Log().Warn("Unknown command {0}. Setting to list.".FormatWith(unparsedCommand)); + if (!string.IsNullOrWhiteSpace(unparsedCommand)) + { + this.Log().Warn("Unknown command {0}. Setting to list.".FormatWith(unparsedCommand)); + } + command = SourceCommandType.List; } @@ -210,7 +214,10 @@ public virtual int Count(ChocolateyConfiguration config) public virtual bool MayRequireAdminAccess() { var config = Config.GetConfigurationSettings(); - if (config == null) return true; + if (config == null) + { + return true; + } return config.SourceCommand.Command != SourceCommandType.List; } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyTemplateCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyTemplateCommand.cs index 7904fa0553..3fb8e21788 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyTemplateCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyTemplateCommand.cs @@ -64,7 +64,11 @@ public virtual void ParseAdditionalArguments(IList unparsedArguments, Ch if (command == TemplateCommandType.Unknown) { - if (!string.IsNullOrWhiteSpace(unparsedCommand)) this.Log().Warn("Unknown command {0}. Setting to list.".FormatWith(unparsedCommand)); + if (!string.IsNullOrWhiteSpace(unparsedCommand)) + { + this.Log().Warn("Unknown command {0}. Setting to list.".FormatWith(unparsedCommand)); + } + command = TemplateCommandType.List; } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs index 12f0c06ccf..dfeca84055 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs @@ -115,19 +115,28 @@ public virtual void ConfigureArgumentParser(OptionSet optionSet, ChocolateyConfi "IgnoreChecksums - Ignore checksums provided by the package. Overrides the default feature '{0}' set to '{1}'.".FormatWith(ApplicationParameters.Features.ChecksumFiles, configuration.Features.ChecksumFiles.ToStringSafe()), option => { - if (option != null) configuration.Features.ChecksumFiles = false; + if (option != null) + { + configuration.Features.ChecksumFiles = false; + } }) .Add("allowemptychecksum|allowemptychecksums|allow-empty-checksums", "Allow Empty Checksums - Allow packages to have empty/missing checksums for downloaded resources from non-secure locations (HTTP, FTP). Use this switch is not recommended if using sources that download resources from the internet. Overrides the default feature '{0}' set to '{1}'.".FormatWith(ApplicationParameters.Features.AllowEmptyChecksums, configuration.Features.AllowEmptyChecksums.ToStringSafe()), option => { - if (option != null) configuration.Features.AllowEmptyChecksums = true; + if (option != null) + { + configuration.Features.AllowEmptyChecksums = true; + } }) .Add("allowemptychecksumsecure|allowemptychecksumssecure|allow-empty-checksums-secure", "Allow Empty Checksums Secure - Allow packages to have empty checksums for downloaded resources from secure locations (HTTPS). Overrides the default feature '{0}' set to '{1}'.".FormatWith(ApplicationParameters.Features.AllowEmptyChecksumsSecure, configuration.Features.AllowEmptyChecksumsSecure.ToStringSafe()), option => { - if (option != null) configuration.Features.AllowEmptyChecksumsSecure = true; + if (option != null) + { + configuration.Features.AllowEmptyChecksumsSecure = true; + } }) .Add("requirechecksum|requirechecksums|require-checksums", "Require Checksums - Requires packages to have checksums for downloaded resources (both non-secure and secure). Overrides the default feature '{0}' set to '{1}' and '{2}' set to '{3}'.".FormatWith(ApplicationParameters.Features.AllowEmptyChecksums, configuration.Features.AllowEmptyChecksums.ToStringSafe(), ApplicationParameters.Features.AllowEmptyChecksumsSecure, configuration.Features.AllowEmptyChecksumsSecure.ToStringSafe()), @@ -194,13 +203,19 @@ public virtual void ConfigureArgumentParser(OptionSet optionSet, ChocolateyConfi "Use Remembered Options for Upgrade - use the arguments and options used during install for upgrade. Does not override arguments being passed at runtime. Overrides the default feature '{0}' set to '{1}'.".FormatWith(ApplicationParameters.Features.UseRememberedArgumentsForUpgrades, configuration.Features.UseRememberedArgumentsForUpgrades.ToStringSafe()), option => { - if (option != null) configuration.Features.UseRememberedArgumentsForUpgrades = true; + if (option != null) + { + configuration.Features.UseRememberedArgumentsForUpgrades = true; + } }) .Add("ignorerememberedargs|ignorerememberedarguments|ignorerememberedoptions|ignore-remembered-args|ignore-remembered-arguments|ignore-remembered-options", "Ignore Remembered Options for Upgrade - ignore the arguments and options used during install for upgrade. Overrides the default feature '{0}' set to '{1}'.".FormatWith(ApplicationParameters.Features.UseRememberedArgumentsForUpgrades, configuration.Features.UseRememberedArgumentsForUpgrades.ToStringSafe()), option => { - if (option != null) configuration.Features.UseRememberedArgumentsForUpgrades = false; + if (option != null) + { + configuration.Features.UseRememberedArgumentsForUpgrades = false; + } }) .Add("exitwhenrebootdetected|exit-when-reboot-detected", "Exit When Reboot Detected - Stop running install, upgrade, or uninstall when a reboot request is detected. Requires '{0}' feature to be turned on. Will exit with either {1} or {2}. Overrides the default feature '{3}' set to '{4}'.".FormatWith diff --git a/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs b/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs index f7b729c278..7237738977 100644 --- a/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs +++ b/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs @@ -86,11 +86,30 @@ public static void SetEnvironmentVariables(ChocolateyConfiguration config) Environment.SetEnvironmentVariable("TEMP", config.CacheLocation); Environment.SetEnvironmentVariable("TMP", config.CacheLocation); - if (config.Debug) Environment.SetEnvironmentVariable("ChocolateyEnvironmentDebug", "true"); - if (config.Verbose) Environment.SetEnvironmentVariable("ChocolateyEnvironmentVerbose", "true"); - if (!config.Features.ChecksumFiles) Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyIgnoreChecksums, "true"); - if (config.Features.AllowEmptyChecksums) Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyAllowEmptyChecksums, "true"); - if (config.Features.AllowEmptyChecksumsSecure) Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyAllowEmptyChecksumsSecure, "true"); + if (config.Debug) + { + Environment.SetEnvironmentVariable("ChocolateyEnvironmentDebug", "true"); + } + + if (config.Verbose) + { + Environment.SetEnvironmentVariable("ChocolateyEnvironmentVerbose", "true"); + } + + if (!config.Features.ChecksumFiles) + { + Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyIgnoreChecksums, "true"); + } + + if (config.Features.AllowEmptyChecksums) + { + Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyAllowEmptyChecksums, "true"); + } + + if (config.Features.AllowEmptyChecksumsSecure) + { + Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyAllowEmptyChecksumsSecure, "true"); + } Environment.SetEnvironmentVariable("chocolateyRequestTimeout", config.WebRequestTimeoutSeconds.ToStringSafe() + "000"); @@ -123,12 +142,27 @@ public static void SetEnvironmentVariables(ChocolateyConfiguration config) } - if (config.Proxy.BypassOnLocal) Environment.SetEnvironmentVariable("chocolateyProxyBypassOnLocal", "true"); + if (config.Proxy.BypassOnLocal) + { + Environment.SetEnvironmentVariable("chocolateyProxyBypassOnLocal", "true"); + } + } + + if (config.Features.UsePowerShellHost) + { + Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyPowerShellHost, "true"); + } + + if (config.Force) + { + Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyForce, "true"); + } + + if (config.Features.ExitOnRebootDetected) + { + Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyExitOnRebootDetected, "true"); } - if (config.Features.UsePowerShellHost) Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyPowerShellHost, "true"); - if (config.Force) Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyForce, "true"); - if (config.Features.ExitOnRebootDetected) Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyExitOnRebootDetected, "true"); SetLicensedEnvironment(config); } @@ -149,9 +183,13 @@ private static void SetLicensedEnvironment(ChocolateyConfiguration config) if (licensedEnvironmentSettings == null) { - if (config.RegularOutput) "chocolatey".Log().Warn( + if (config.RegularOutput) + { + "chocolatey".Log().Warn( ChocolateyLoggers.Important, @"Unable to set licensed environment settings. Please upgrade to a newer licensed version (choco upgrade chocolatey.extension)."); + } + return; } try @@ -169,7 +207,11 @@ private static void SetLicensedEnvironment(ChocolateyConfiguration config) catch (Exception ex) { var isDebug = ApplicationParameters.IsDebugModeCliPrimitive(); - if (config.Debug) isDebug = true; + if (config.Debug) + { + isDebug = true; + } + var message = isDebug ? ex.ToString() : ex.Message; if (isDebug && ex.InnerException != null) @@ -234,11 +276,21 @@ public static void UpdateEnvironmentVariables() "chocolatey".Log().Debug("Unable to determine current user to determine if LocalSystem account (to skip user env vars).{0} Reported error: {1}".FormatWith(Environment.NewLine, ex.Message)); } - if (setUserEnvironmentVariables) RefreshEnvironmentVariables(userVariables); + if (setUserEnvironmentVariables) + { + RefreshEnvironmentVariables(userVariables); + } // restore process overridden variables - if (originalEnvironmentVariables.Contains(ApplicationParameters.Environment.Username)) Environment.SetEnvironmentVariable(ApplicationParameters.Environment.Username, userName); - if (originalEnvironmentVariables.Contains(ApplicationParameters.Environment.ProcessorArchitecture)) Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ProcessorArchitecture, architecture); + if (originalEnvironmentVariables.Contains(ApplicationParameters.Environment.Username)) + { + Environment.SetEnvironmentVariable(ApplicationParameters.Environment.Username, userName); + } + + if (originalEnvironmentVariables.Contains(ApplicationParameters.Environment.ProcessorArchitecture)) + { + Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ProcessorArchitecture, architecture); + } // combine environment values that append together var updatedPath = "{0};{1};".FormatWith( @@ -281,7 +333,10 @@ public static void UpdateEnvironmentVariables() private static IDictionary ConvertToCaseInsensitiveDictionary(IDictionary originalDictionary) { - if (originalDictionary == null) return new Hashtable(new Dictionary(), StringComparer.OrdinalIgnoreCase); + if (originalDictionary == null) + { + return new Hashtable(new Dictionary(), StringComparer.OrdinalIgnoreCase); + } return new Hashtable(originalDictionary, StringComparer.OrdinalIgnoreCase); } diff --git a/src/chocolatey/infrastructure.app/domain/GenericRegistryValue.cs b/src/chocolatey/infrastructure.app/domain/GenericRegistryValue.cs index b428968ad1..89c16cc802 100644 --- a/src/chocolatey/infrastructure.app/domain/GenericRegistryValue.cs +++ b/src/chocolatey/infrastructure.app/domain/GenericRegistryValue.cs @@ -40,7 +40,10 @@ public override bool Equals(object obj) bool IEquatable.Equals(GenericRegistryValue other) { - if (other == null) return false; + if (other == null) + { + return false; + } return ParentKeyName.IsEqualTo(other.ParentKeyName) && Name.IsEqualTo(other.Name) diff --git a/src/chocolatey/infrastructure.app/domain/RegistryApplicationKey.cs b/src/chocolatey/infrastructure.app/domain/RegistryApplicationKey.cs index 89b6cdb22f..b28ac469c8 100644 --- a/src/chocolatey/infrastructure.app/domain/RegistryApplicationKey.cs +++ b/src/chocolatey/infrastructure.app/domain/RegistryApplicationKey.cs @@ -107,14 +107,20 @@ public override int GetHashCode() public override bool Equals(object obj) { - if (ReferenceEquals(this, obj)) return true; + if (ReferenceEquals(this, obj)) + { + return true; + } return Equals(obj as RegistryApplicationKey); } bool IEquatable.Equals(RegistryApplicationKey other) { - if (ReferenceEquals(other, null)) return false; + if (ReferenceEquals(other, null)) + { + return false; + } return DisplayName.ToStringSafe().IsEqualTo(other.DisplayName) && DisplayVersion.IsEqualTo(other.DisplayVersion) diff --git a/src/chocolatey/infrastructure.app/domain/RegistryValueExtensions.cs b/src/chocolatey/infrastructure.app/domain/RegistryValueExtensions.cs index 8440ef6ab9..78306b515f 100644 --- a/src/chocolatey/infrastructure.app/domain/RegistryValueExtensions.cs +++ b/src/chocolatey/infrastructure.app/domain/RegistryValueExtensions.cs @@ -24,7 +24,10 @@ public static class RegistryValueExtensions { public static string AsXmlSafeString(this RegistryKey key, string name) { - if (key == null) return string.Empty; + if (key == null) + { + return string.Empty; + } // Since it is possible that registry keys contain characters that are not valid // in XML files, ensure that all content is escaped, prior to serialization diff --git a/src/chocolatey/infrastructure.app/domain/installers/CustomInstaller.cs b/src/chocolatey/infrastructure.app/domain/installers/CustomInstaller.cs index be9c4c351d..b29e7a5180 100644 --- a/src/chocolatey/infrastructure.app/domain/installers/CustomInstaller.cs +++ b/src/chocolatey/infrastructure.app/domain/installers/CustomInstaller.cs @@ -44,8 +44,15 @@ public override InstallerType InstallerType public override string BuildInstallCommandArguments(bool logFile, bool customInstallLocation, bool languageRequested) { - if (customInstallLocation) this.Log().Warn("CustomInstaller doesn't support custom install locations."); - if (languageRequested) this.Log().Warn("CustomInstaller doesn't support custom language options."); + if (customInstallLocation) + { + this.Log().Warn("CustomInstaller doesn't support custom install locations."); + } + + if (languageRequested) + { + this.Log().Warn("CustomInstaller doesn't support custom language options."); + } return string.Empty; } diff --git a/src/chocolatey/infrastructure.app/domain/installers/InstallerBase.cs b/src/chocolatey/infrastructure.app/domain/installers/InstallerBase.cs index 70cef15d36..ef6a193380 100644 --- a/src/chocolatey/infrastructure.app/domain/installers/InstallerBase.cs +++ b/src/chocolatey/infrastructure.app/domain/installers/InstallerBase.cs @@ -41,11 +41,20 @@ public virtual string BuildInstallCommandArguments(bool logFile, bool customInst { var args = new StringBuilder(); args.Append("{0} {1} {2}".FormatWith(SilentInstall, NoReboot, OtherInstallOptions).TrimSafe()); - if (languageRequested) args.AppendFormat(" {0}", Language); + if (languageRequested) + { + args.AppendFormat(" {0}", Language); + } //MSI may have issues with 1622 - opening a log file location - if (logFile) args.AppendFormat(" {0}", LogFile); + if (logFile) + { + args.AppendFormat(" {0}", LogFile); + } // custom install location must be last for NSIS - if (customInstallLocation) args.AppendFormat(" {0}", CustomInstallLocation); + if (customInstallLocation) + { + args.AppendFormat(" {0}", CustomInstallLocation); + } return args.ToString(); } diff --git a/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs b/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs index ceae03e53e..35390a963c 100644 --- a/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs +++ b/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs @@ -164,7 +164,10 @@ public static IEnumerable GetRemoteRepositories(ChocolateyConf if (machineSource != null) { bypassProxy = machineSource.BypassProxy; - if (bypassProxy) "chocolatey".Log().Debug("Source '{0}' is configured to bypass proxies.".FormatWith(source)); + if (bypassProxy) + { + "chocolatey".Log().Debug("Source '{0}' is configured to bypass proxies.".FormatWith(source)); + } if (!string.IsNullOrWhiteSpace(machineSource.Certificate)) { @@ -290,7 +293,10 @@ public static void GetLocalPackageDependencies(PackageIdentity package, ISet dependencyInfos ) { - if (dependencyInfos.Contains(package)) return; + if (dependencyInfos.Contains(package)) + { + return; + } var metadata = allLocalPackages .FirstOrDefault(p => p.PackageMetadata.Id.Equals(package.Id, StringComparison.OrdinalIgnoreCase) && p.PackageMetadata.Version.Equals(package.Version)) @@ -340,7 +346,11 @@ ISet dependencyInfos null, null); - if (dependencyInfos.Contains(result)) return; + if (dependencyInfos.Contains(result)) + { + return; + } + dependencyInfos.Add(result); foreach (var dependency in dependencies) @@ -359,7 +369,10 @@ public static async Task GetPackageDependencies(PackageIdentity package, ISet dependencyCache, ChocolateyConfiguration configuration) { - if (availablePackages.Contains(package)) return; + if (availablePackages.Contains(package)) + { + return; + } var dependencyInfoResources = resources.DependencyInfoResources(); @@ -381,12 +394,19 @@ public static async Task GetPackageDependencies(PackageIdentity package, "chocolatey".Log().Warn(ex.InnerException.Message); } - if (dependencyInfo == null) continue; + if (dependencyInfo == null) + { + continue; + } availablePackages.Add(dependencyInfo); foreach (var dependency in dependencyInfo.Dependencies) { - if (dependencyCache.Contains(dependency)) continue; + if (dependencyCache.Contains(dependency)) + { + continue; + } + dependencyCache.Add(dependency); await GetPackageDependencies( dependency.Id, framework, cacheContext, logger, resources, availablePackages, dependencyCache, configuration); @@ -425,12 +445,19 @@ public static async Task GetPackageDependencies(string packageId, "chocolatey".Log().Warn(ex.InnerException.Message); } - if (!dependencyInfos.Any()) continue; + if (!dependencyInfos.Any()) + { + continue; + } availablePackages.AddRange(dependencyInfos); foreach (var dependency in dependencyInfos.SelectMany(p => p.Dependencies)) { - if (dependencyCache.Contains(dependency)) continue; + if (dependencyCache.Contains(dependency)) + { + continue; + } + dependencyCache.Add(dependency); // Recursion is fun, kids @@ -446,7 +473,11 @@ public static async Task GetPackageParents(string packageId, { foreach (var package in locallyInstalledPackages.Where(p => !parentPackages.Contains(p))) { - if (parentPackages.Contains(package)) continue; + if (parentPackages.Contains(package)) + { + continue; + } + if (package.Dependencies.Any(p => p.Id.Equals(packageId, StringComparison.OrdinalIgnoreCase))) { parentPackages.Add(package); diff --git a/src/chocolatey/infrastructure.app/nuget/NugetList.cs b/src/chocolatey/infrastructure.app/nuget/NugetList.cs index ebf0564e83..d57cd4b56f 100644 --- a/src/chocolatey/infrastructure.app/nuget/NugetList.cs +++ b/src/chocolatey/infrastructure.app/nuget/NugetList.cs @@ -246,7 +246,10 @@ private async static Task> SearchPackagesAsyn { var exactPackage = FindPackage(searchTermLower, configuration, nugetLogger, cacheContext, packageRepositoryResources, version); - if (exactPackage == null) return new List().AsQueryable(); + if (exactPackage == null) + { + return new List().AsQueryable(); + } return new List() { diff --git a/src/chocolatey/infrastructure.app/runners/ConsoleApplication.cs b/src/chocolatey/infrastructure.app/runners/ConsoleApplication.cs index 0a6b8b2d4c..772dbb3a68 100644 --- a/src/chocolatey/infrastructure.app/runners/ConsoleApplication.cs +++ b/src/chocolatey/infrastructure.app/runners/ConsoleApplication.cs @@ -70,7 +70,10 @@ public void Run(string[] args, ChocolateyConfiguration config, Container contain // if debug is bundled with local options, it may not get picked up when global // options are parsed. Attempt to set it again once local options are set. // This does mean some output from debug will be missed (but not much) - if (config.Debug) Log4NetAppenderConfiguration.EnableDebugLoggingIf(config.Debug, "{0}LoggingColoredConsoleAppender".FormatWith(ChocolateyLoggers.Verbose.ToStringSafe()), "{0}LoggingColoredConsoleAppender".FormatWith(ChocolateyLoggers.Trace.ToStringSafe())); + if (config.Debug) + { + Log4NetAppenderConfiguration.EnableDebugLoggingIf(config.Debug, "{0}LoggingColoredConsoleAppender".FormatWith(ChocolateyLoggers.Verbose.ToStringSafe()), "{0}LoggingColoredConsoleAppender".FormatWith(ChocolateyLoggers.Trace.ToStringSafe())); + } command.ParseAdditionalArguments(unparsedArgs, config); diff --git a/src/chocolatey/infrastructure.app/runners/GenericRunner.cs b/src/chocolatey/infrastructure.app/runners/GenericRunner.cs index 3c6c0720db..2ad5c34a54 100644 --- a/src/chocolatey/infrastructure.app/runners/GenericRunner.cs +++ b/src/chocolatey/infrastructure.app/runners/GenericRunner.cs @@ -57,7 +57,10 @@ private ICommand FindCommand(ChocolateyConfiguration config, Container container Try choco -? for command reference/help.".FormatWith(config.CommandName)); } - if (isConsole) Environment.ExitCode = 1; + if (isConsole) + { + Environment.ExitCode = 1; + } } else { @@ -132,9 +135,15 @@ public void FailOnMissingOrInvalidLicenseIfFeatureSet(ChocolateyConfiguration co if (!config.Features.FailOnInvalidOrMissingLicense || config.CommandName.TrimSafe().IsEqualTo("feature") || config.CommandName.TrimSafe().IsEqualTo("features") - ) return; + ) + { + return; + } - if (!config.Information.IsLicensedVersion) throw new ApplicationException("License is missing or invalid."); + if (!config.Information.IsLicensedVersion) + { + throw new ApplicationException("License is missing or invalid."); + } } public void Run(ChocolateyConfiguration config, Container container, bool isConsole, Action parseArgs) @@ -286,10 +295,16 @@ public int Count(ChocolateyConfiguration config, Container container, bool isCon public void WarnIfAdminAndNeedsElevation(ChocolateyConfiguration config) { - if (config.HelpRequested) return; + if (config.HelpRequested) + { + return; + } // skip when commands will set or for background mode - if (!config.Features.ShowNonElevatedWarnings) return; + if (!config.Features.ShowNonElevatedWarnings) + { + return; + } var shouldWarn = (!config.Information.IsProcessElevated && config.Information.IsUserAdministrator) || (!config.Information.IsUserAdministrator && ApplicationParameters.InstallLocation.IsEqualTo(ApplicationParameters.CommonAppDataChocolatey)); diff --git a/src/chocolatey/infrastructure.app/services/AutomaticUninstallerService.cs b/src/chocolatey/infrastructure.app/services/AutomaticUninstallerService.cs index e412914342..ea97fdc821 100644 --- a/src/chocolatey/infrastructure.app/services/AutomaticUninstallerService.cs +++ b/src/chocolatey/infrastructure.app/services/AutomaticUninstallerService.cs @@ -119,7 +119,10 @@ public void Remove(RegistryApplicationKey key, ChocolateyConfiguration config, P userProvidedUninstallArguments = config.InstallArguments; userOverrideUninstallArguments = config.OverrideArguments; - if (!string.IsNullOrWhiteSpace(userProvidedUninstallArguments)) this.Log().Debug(ChocolateyLoggers.Verbose, " Using user passed {2}uninstaller args for {0}:'{1}'".FormatWith(package.Id, userProvidedUninstallArguments.EscapeCurlyBraces(), userOverrideUninstallArguments ? "overriding " : string.Empty)); + if (!string.IsNullOrWhiteSpace(userProvidedUninstallArguments)) + { + this.Log().Debug(ChocolateyLoggers.Verbose, " Using user passed {2}uninstaller args for {0}:'{1}'".FormatWith(package.Id, userProvidedUninstallArguments.EscapeCurlyBraces(), userOverrideUninstallArguments ? "overriding " : string.Empty)); + } } } @@ -237,7 +240,10 @@ Automatic Uninstaller due to licensed enhancements and Package shortPrompt: true, timeoutInSeconds: timeout ); - if (selection.IsEqualTo("yes")) skipUninstaller = false; + if (selection.IsEqualTo("yes")) + { + skipUninstaller = false; + } if (skipUninstaller) { @@ -253,12 +259,20 @@ Automatic Uninstaller due to licensed enhancements and Package config.CommandExecutionTimeoutSeconds, (s, e) => { - if (e == null || string.IsNullOrWhiteSpace(e.Data)) return; + if (e == null || string.IsNullOrWhiteSpace(e.Data)) + { + return; + } + this.Log().Info(() => " [AutoUninstaller] {0}".FormatWith(e.Data.EscapeCurlyBraces())); }, (s, e) => { - if (e == null || string.IsNullOrWhiteSpace(e.Data)) return; + if (e == null || string.IsNullOrWhiteSpace(e.Data)) + { + return; + } + this.Log().Error(() => " [AutoUninstaller] {0}".FormatWith(e.Data.EscapeCurlyBraces())); }, updateProcessPath: false); diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyConfigSettingsService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyConfigSettingsService.cs index 42df1f4966..138a3c95d1 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyConfigSettingsService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyConfigSettingsService.cs @@ -65,7 +65,10 @@ public virtual IEnumerable ListSources(ChocolateyConfiguration var list = new List(); foreach (var source in ConfigFileSettings.Sources.OrEmpty().OrderBy(s => s.Id)) { - if (SkipSource(source, configuration)) continue; + if (SkipSource(source, configuration)) + { + continue; + } if (!configuration.QuietOutput) { @@ -133,7 +136,10 @@ public void AddSource(ChocolateyConfiguration configuration) ConfigFileSettings.Sources.Add(source); _xmlService.Serialize(ConfigFileSettings, ApplicationParameters.GlobalConfigFileLocation); - if (!configuration.QuietOutput) this.Log().Warn(() => "Added {0} - {1} (Priority {2})".FormatWith(source.Id, source.Value, source.Priority)); + if (!configuration.QuietOutput) + { + this.Log().Warn(() => "Added {0} - {1} (Priority {2})".FormatWith(source.Id, source.Value, source.Priority)); + } } else { @@ -150,7 +156,10 @@ public void AddSource(ChocolateyConfiguration configuration) configuration.SourceCommand.VisibleToAdminsOnly == source.VisibleToAdminsOnly ) { - if (!configuration.QuietOutput) this.Log().Warn(NoChangeMessage); + if (!configuration.QuietOutput) + { + this.Log().Warn(NoChangeMessage); + } } else { @@ -165,7 +174,10 @@ public void AddSource(ChocolateyConfiguration configuration) source.VisibleToAdminsOnly = configuration.SourceCommand.VisibleToAdminsOnly; _xmlService.Serialize(ConfigFileSettings, ApplicationParameters.GlobalConfigFileLocation); - if (!configuration.QuietOutput) this.Log().Warn(() => "Updated {0} - {1} (Priority {2})".FormatWith(source.Id, source.Value, source.Priority)); + if (!configuration.QuietOutput) + { + this.Log().Warn(() => "Updated {0} - {1} (Priority {2})".FormatWith(source.Id, source.Value, source.Priority)); + } } } } @@ -178,11 +190,17 @@ public void RemoveSource(ChocolateyConfiguration configuration) ConfigFileSettings.Sources.Remove(source); _xmlService.Serialize(ConfigFileSettings, ApplicationParameters.GlobalConfigFileLocation); - if (!configuration.QuietOutput) this.Log().Warn(() => "Removed {0}".FormatWith(source.Id)); + if (!configuration.QuietOutput) + { + this.Log().Warn(() => "Removed {0}".FormatWith(source.Id)); + } } else { - if (!configuration.QuietOutput) this.Log().Warn(NoChangeMessage); + if (!configuration.QuietOutput) + { + this.Log().Warn(NoChangeMessage); + } } } @@ -193,11 +211,17 @@ public void DisableSource(ChocolateyConfiguration configuration) { source.Disabled = true; _xmlService.Serialize(ConfigFileSettings, ApplicationParameters.GlobalConfigFileLocation); - if (!configuration.QuietOutput) this.Log().Warn(() => "Disabled {0}".FormatWith(source.Id)); + if (!configuration.QuietOutput) + { + this.Log().Warn(() => "Disabled {0}".FormatWith(source.Id)); + } } else { - if (!configuration.QuietOutput) this.Log().Warn(NoChangeMessage); + if (!configuration.QuietOutput) + { + this.Log().Warn(NoChangeMessage); + } } } @@ -208,11 +232,17 @@ public void EnableSource(ChocolateyConfiguration configuration) { source.Disabled = false; _xmlService.Serialize(ConfigFileSettings, ApplicationParameters.GlobalConfigFileLocation); - if (!configuration.QuietOutput) this.Log().Warn(() => "Enabled {0}".FormatWith(source.Id)); + if (!configuration.QuietOutput) + { + this.Log().Warn(() => "Enabled {0}".FormatWith(source.Id)); + } } else { - if (!configuration.QuietOutput) this.Log().Warn(NoChangeMessage); + if (!configuration.QuietOutput) + { + this.Log().Warn(NoChangeMessage); + } } } @@ -363,7 +393,10 @@ public void SetApiKey(ChocolateyConfiguration configuration) _xmlService.Serialize(ConfigFileSettings, ApplicationParameters.GlobalConfigFileLocation); this.Log().Info(() => "Updated API key for {0}".FormatWith(configuration.Sources)); } - else this.Log().Warn(NoChangeMessage); + else + { + this.Log().Warn(NoChangeMessage); + } } } @@ -404,14 +437,21 @@ public void ListConfig(ChocolateyConfiguration configuration) public void GetConfig(ChocolateyConfiguration configuration) { var config = GetConfigValue(configuration.ConfigCommand.Name); - if (config == null) throw new ApplicationException("No configuration value by the name '{0}'".FormatWith(configuration.ConfigCommand.Name)); + if (config == null) + { + throw new ApplicationException("No configuration value by the name '{0}'".FormatWith(configuration.ConfigCommand.Name)); + } + this.Log().Info("{0}".FormatWith(config.Value)); } public ConfigFileConfigSetting GetConfigValue(string configKeyName) { var config = ConfigFileSettings.ConfigSettings.FirstOrDefault(p => p.Key.IsEqualTo(configKeyName)); - if (config == null) return null; + if (config == null) + { + return null; + } return config; } diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs index 15d99994b9..51b54d9640 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs @@ -100,7 +100,10 @@ focus exclusively in the string values not surrounded by CData. Once { if (_fileSystem.FileExists(_fileSystem.CombinePaths(pkgStorePath, RegistrySnapshotBadFile))) { - if (_config.RegularOutput) this.Log().Warn(deserializationErrorMessage); + if (_config.RegularOutput) + { + this.Log().Warn(deserializationErrorMessage); + } } else { @@ -109,16 +112,22 @@ focus exclusively in the string values not surrounded by CData. Once } catch (Exception e) { - if (_config.RegularOutput) this.Log().Warn(@"A .registry file at '{0}' + if (_config.RegularOutput) + { + this.Log().Warn(@"A .registry file at '{0}' has errored attempting to read it. This file will be renamed to '{1}' The error: {2} ".FormatWith(_fileSystem.CombinePaths(pkgStorePath, RegistrySnapshotFile), _fileSystem.CombinePaths(pkgStorePath, RegistrySnapshotBadFile), e.ToString())); + } FaultTolerance.TryCatchWithLoggingException( () => { - if (_config.RegularOutput) this.Log().Warn(deserializationErrorMessage); + if (_config.RegularOutput) + { + this.Log().Warn(deserializationErrorMessage); + } // rename the bad registry file so that it isn't processed again _fileSystem.MoveFile(_fileSystem.CombinePaths(pkgStorePath, RegistrySnapshotFile), _fileSystem.CombinePaths(pkgStorePath, RegistrySnapshotBadFile)); @@ -144,9 +153,16 @@ has errored attempting to read it. This file will be renamed to packageInformation.HasSilentUninstall = _fileSystem.FileExists(_fileSystem.CombinePaths(pkgStorePath, SilentUninstallerFile)); packageInformation.IsPinned = _fileSystem.FileExists(_fileSystem.CombinePaths(pkgStorePath, PinFile)); var argsFile = _fileSystem.CombinePaths(pkgStorePath, ArgsFile); - if (_fileSystem.FileExists(argsFile)) packageInformation.Arguments = _fileSystem.ReadFile(argsFile); + if (_fileSystem.FileExists(argsFile)) + { + packageInformation.Arguments = _fileSystem.ReadFile(argsFile); + } + var extraInfoFile = _fileSystem.CombinePaths(pkgStorePath, ExtraFile); - if (_fileSystem.FileExists(extraInfoFile)) packageInformation.ExtraInformation = _fileSystem.ReadFile(extraInfoFile); + if (_fileSystem.FileExists(extraInfoFile)) + { + packageInformation.ExtraInformation = _fileSystem.ReadFile(extraInfoFile); + } var versionOverrideFile = _fileSystem.CombinePaths(pkgStorePath, VersionOverrideFile); if (_fileSystem.FileExists(versionOverrideFile)) @@ -173,7 +189,11 @@ public void Save(ChocolateyPackageInformation packageInformation) if (packageInformation.Package == null) { - if (_config.RegularOutput) this.Log().Debug("No package information to save as package is null."); + if (_config.RegularOutput) + { + this.Log().Debug("No package information to save as package is null."); + } + return; } @@ -202,7 +222,11 @@ public void Save(ChocolateyPackageInformation packageInformation) if (!string.IsNullOrWhiteSpace(packageInformation.Arguments)) { var argsFile = _fileSystem.CombinePaths(pkgStorePath, ArgsFile); - if (_fileSystem.FileExists(argsFile)) _fileSystem.DeleteFile(argsFile); + if (_fileSystem.FileExists(argsFile)) + { + _fileSystem.DeleteFile(argsFile); + } + _fileSystem.WriteFile(argsFile, packageInformation.Arguments); } else @@ -213,7 +237,11 @@ public void Save(ChocolateyPackageInformation packageInformation) if (!string.IsNullOrWhiteSpace(packageInformation.ExtraInformation)) { var extraFile = _fileSystem.CombinePaths(pkgStorePath, ExtraFile); - if (_fileSystem.FileExists(extraFile)) _fileSystem.DeleteFile(extraFile); + if (_fileSystem.FileExists(extraFile)) + { + _fileSystem.DeleteFile(extraFile); + } + _fileSystem.WriteFile(extraFile, packageInformation.ExtraInformation); } else @@ -224,7 +252,11 @@ public void Save(ChocolateyPackageInformation packageInformation) if (packageInformation.VersionOverride != null) { var versionOverrideFile = _fileSystem.CombinePaths(pkgStorePath, VersionOverrideFile); - if (_fileSystem.FileExists(versionOverrideFile)) _fileSystem.DeleteFile(versionOverrideFile); + if (_fileSystem.FileExists(versionOverrideFile)) + { + _fileSystem.DeleteFile(versionOverrideFile); + } + _fileSystem.WriteFile(versionOverrideFile, packageInformation.VersionOverride.ToNormalizedStringChecked()); } else @@ -253,7 +285,11 @@ public void Save(ChocolateyPackageInformation packageInformation) public void Remove(IPackageMetadata package) { var pkgStorePath = GetStorePath(_fileSystem, package.Id, package.Version); - if (_config.RegularOutput) this.Log().Info("Removing Package Information for {0}".FormatWith(pkgStorePath)); + if (_config.RegularOutput) + { + this.Log().Info("Removing Package Information for {0}".FormatWith(pkgStorePath)); + } + _fileSystem.DeleteDirectoryChecked(pkgStorePath, recursive: true); } diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs index 0449429fa7..dccab927af 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs @@ -255,7 +255,10 @@ public virtual IEnumerable List(ChocolateyConfiguration config) yield break; } - if (config.RegularOutput) this.Log().Debug(() => "Searching for package information"); + if (config.RegularOutput) + { + this.Log().Debug(() => "Searching for package information"); + } var packages = new List(); @@ -326,7 +329,10 @@ private IEnumerable ReportRegistryPrograms(ChocolateyConfiguratio if (config.RegularOutput) { this.Log().Info("{0}|{1}".FormatWith(key.DisplayName, key.DisplayVersion)); - if (config.Verbose) this.Log().Info(" InstallLocation: {0}{1} Uninstall:{2}".FormatWith(key.InstallLocation.ToStringSafe().EscapeCurlyBraces(), Environment.NewLine, key.UninstallString.ToStringSafe().EscapeCurlyBraces())); + if (config.Verbose) + { + this.Log().Info(" InstallLocation: {0}{1} Uninstall:{2}".FormatWith(key.InstallLocation.ToStringSafe().EscapeCurlyBraces(), Environment.NewLine, key.UninstallString.ToStringSafe().EscapeCurlyBraces())); + } } count++; @@ -432,7 +438,11 @@ public void RandomlyNotifyAboutLicensedFeatures(ChocolateyConfiguration config, // doesn't like to grab the max value. var messageCount = _proBusinessMessages.Count; var chosenMessage = new Random().Next(0, messageCount); - if (chosenMessage >= messageCount) chosenMessage = messageCount - 1; + if (chosenMessage >= messageCount) + { + chosenMessage = messageCount - 1; + } + message = _proBusinessMessages[chosenMessage]; } @@ -466,7 +476,10 @@ public virtual void HandlePackageResult(PackageResult packageResult, ChocolateyC if (powerShellRan) { // we don't care about the exit code - if (config.Information.PlatformType == PlatformType.Windows) CommandExecutor.ExecuteStatic(_shutdownExe, "/a", config.CommandExecutionTimeoutSeconds, _fileSystem.GetCurrentDirectory(), (s, e) => { }, (s, e) => { }, false, false); + if (config.Information.PlatformType == PlatformType.Windows) + { + CommandExecutor.ExecuteStatic(_shutdownExe, "/a", config.CommandExecutionTimeoutSeconds, _fileSystem.GetCurrentDirectory(), (s, e) => { }, (s, e) => { }, false, false); + } } var installersDifferences = _registryService.GetInstallerKeysChanged(installersBefore, _registryService.GetInstallerKeys()); @@ -501,11 +514,18 @@ public virtual void HandlePackageResult(PackageResult packageResult, ChocolateyC var is32Bit = !config.Information.Is64BitProcess || config.ForceX86; CreateExecutableIgnoreFiles(packageResult.InstallLocation, !is32Bit); - if (packageResult.Success) _shimgenService.Install(config, packageResult); + if (packageResult.Success) + { + _shimgenService.Install(config, packageResult); + } } else { - if (config.Information.PlatformType != PlatformType.Windows) this.Log().Info(ChocolateyLoggers.Important, () => " Skipping PowerShell and shimgen portions of the install due to non-Windows."); + if (config.Information.PlatformType != PlatformType.Windows) + { + this.Log().Info(ChocolateyLoggers.Important, () => " Skipping PowerShell and shimgen portions of the install due to non-Windows."); + } + if (packageResult.Success) { _configTransformService.Run(packageResult, config); @@ -540,7 +560,10 @@ public virtual void HandlePackageResult(PackageResult packageResult, ChocolateyC if (pkgInfo.RegistrySnapshot != null && pkgInfo.RegistrySnapshot.RegistryKeys.Any(k => !string.IsNullOrWhiteSpace(k.InstallLocation))) { var key = pkgInfo.RegistrySnapshot.RegistryKeys.FirstOrDefault(k => !string.IsNullOrWhiteSpace(k.InstallLocation)); - if (key != null) Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyPackageInstallLocation, key.InstallLocation, EnvironmentVariableTarget.Process); + if (key != null) + { + Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyPackageInstallLocation, key.InstallLocation, EnvironmentVariableTarget.Process); + } } UpdatePackageInformation(pkgInfo); @@ -636,27 +659,74 @@ private string CaptureArguments(ChocolateyConfiguration config, PackageResult pa //bug:sources are unable to be used - it's late in the process when a package is known //arguments.Append(" --source=\"'{0}'\"".format_with(config.Sources)); - if (config.Prerelease) arguments.Append(" --prerelease"); - if (config.IgnoreDependencies) arguments.Append(" --ignore-dependencies"); - if (config.ForceX86) arguments.Append(" --forcex86"); + if (config.Prerelease) + { + arguments.Append(" --prerelease"); + } + + if (config.IgnoreDependencies) + { + arguments.Append(" --ignore-dependencies"); + } + + if (config.ForceX86) + { + arguments.Append(" --forcex86"); + } + + if (!string.IsNullOrWhiteSpace(config.InstallArguments)) + { + arguments.Append(" --install-arguments=\"'{0}'\"".FormatWith(config.InstallArguments)); + } + + if (config.OverrideArguments) + { + arguments.Append(" --override-arguments"); + } + + if (config.ApplyInstallArgumentsToDependencies) + { + arguments.Append(" --apply-install-arguments-to-dependencies"); + } - if (!string.IsNullOrWhiteSpace(config.InstallArguments)) arguments.Append(" --install-arguments=\"'{0}'\"".FormatWith(config.InstallArguments)); - if (config.OverrideArguments) arguments.Append(" --override-arguments"); - if (config.ApplyInstallArgumentsToDependencies) arguments.Append(" --apply-install-arguments-to-dependencies"); + if (!string.IsNullOrWhiteSpace(config.PackageParameters)) + { + arguments.Append(" --package-parameters=\"'{0}'\"".FormatWith(config.PackageParameters)); + } - if (!string.IsNullOrWhiteSpace(config.PackageParameters)) arguments.Append(" --package-parameters=\"'{0}'\"".FormatWith(config.PackageParameters)); - if (config.ApplyPackageParametersToDependencies) arguments.Append(" --apply-package-parameters-to-dependencies"); + if (config.ApplyPackageParametersToDependencies) + { + arguments.Append(" --apply-package-parameters-to-dependencies"); + } - if (config.AllowDowngrade) arguments.Append(" --allow-downgrade"); + if (config.AllowDowngrade) + { + arguments.Append(" --allow-downgrade"); + } // most times folks won't want to skip automation scripts on upgrade //if (config.SkipPackageInstallProvider) arguments.Append(" --skip-automation-scripts"); //if (config.UpgradeCommand.FailOnUnfound) arguments.Append(" --fail-on-unfound"); - if (!string.IsNullOrWhiteSpace(config.SourceCommand.Username)) arguments.Append(" --user=\"'{0}'\"".FormatWith(config.SourceCommand.Username)); - if (!string.IsNullOrWhiteSpace(config.SourceCommand.Password)) arguments.Append(" --password=\"'{0}'\"".FormatWith(config.SourceCommand.Password)); - if (!string.IsNullOrWhiteSpace(config.SourceCommand.Certificate)) arguments.Append(" --cert=\"'{0}'\"".FormatWith(config.SourceCommand.Certificate)); - if (!string.IsNullOrWhiteSpace(config.SourceCommand.CertificatePassword)) arguments.Append(" --certpassword=\"'{0}'\"".FormatWith(config.SourceCommand.CertificatePassword)); + if (!string.IsNullOrWhiteSpace(config.SourceCommand.Username)) + { + arguments.Append(" --user=\"'{0}'\"".FormatWith(config.SourceCommand.Username)); + } + + if (!string.IsNullOrWhiteSpace(config.SourceCommand.Password)) + { + arguments.Append(" --password=\"'{0}'\"".FormatWith(config.SourceCommand.Password)); + } + + if (!string.IsNullOrWhiteSpace(config.SourceCommand.Certificate)) + { + arguments.Append(" --cert=\"'{0}'\"".FormatWith(config.SourceCommand.Certificate)); + } + + if (!string.IsNullOrWhiteSpace(config.SourceCommand.CertificatePassword)) + { + arguments.Append(" --certpassword=\"'{0}'\"".FormatWith(config.SourceCommand.CertificatePassword)); + } // this should likely be limited //if (!config.Features.ChecksumFiles) arguments.Append(" --ignore-checksums"); @@ -670,9 +740,20 @@ private string CaptureArguments(ChocolateyConfiguration config, PackageResult pa arguments.Append(" --execution-timeout=\"'{0}'\"".FormatWith(config.CommandExecutionTimeoutSeconds)); } - if (!string.IsNullOrWhiteSpace(config.CacheLocation)) arguments.Append(" --cache-location=\"'{0}'\"".FormatWith(config.CacheLocation)); - if (config.Features.FailOnStandardError) arguments.Append(" --fail-on-standard-error"); - if (!config.Features.UsePowerShellHost) arguments.Append(" --use-system-powershell"); + if (!string.IsNullOrWhiteSpace(config.CacheLocation)) + { + arguments.Append(" --cache-location=\"'{0}'\"".FormatWith(config.CacheLocation)); + } + + if (config.Features.FailOnStandardError) + { + arguments.Append(" --fail-on-standard-error"); + } + + if (!config.Features.UsePowerShellHost) + { + arguments.Append(" --use-system-powershell"); + } return NugetEncryptionUtility.EncryptString(arguments.ToStringSafe()); } @@ -758,9 +839,12 @@ public virtual void Outdated(ChocolateyConfiguration config) return; } - if (config.RegularOutput) this.Log().Info(ChocolateyLoggers.Important, @"Outdated Packages + if (config.RegularOutput) + { + this.Log().Info(ChocolateyLoggers.Important, @"Outdated Packages Output is package name | current version | available version | pinned? "); + } config.PackageNames = ApplicationParameters.AllPackages; config.UpgradeCommand.NotifyOnlyAvailableUpgrades = true; @@ -847,32 +931,91 @@ private IEnumerable GetPackagesFromConfigFile(string pa packageConfig.Version = pkgSettings.Version; packageConfig.InstallArguments = string.IsNullOrWhiteSpace(pkgSettings.InstallArguments) ? packageConfig.InstallArguments : pkgSettings.InstallArguments; packageConfig.PackageParameters = string.IsNullOrWhiteSpace(pkgSettings.PackageParameters) ? packageConfig.PackageParameters : pkgSettings.PackageParameters; - if (pkgSettings.ForceX86) packageConfig.ForceX86 = true; - if (pkgSettings.IgnoreDependencies) packageConfig.IgnoreDependencies = true; - if (pkgSettings.ApplyInstallArgumentsToDependencies) packageConfig.ApplyInstallArgumentsToDependencies = true; - if (pkgSettings.ApplyPackageParametersToDependencies) packageConfig.ApplyPackageParametersToDependencies = true; + if (pkgSettings.ForceX86) + { + packageConfig.ForceX86 = true; + } + + if (pkgSettings.IgnoreDependencies) + { + packageConfig.IgnoreDependencies = true; + } + + if (pkgSettings.ApplyInstallArgumentsToDependencies) + { + packageConfig.ApplyInstallArgumentsToDependencies = true; + } + + if (pkgSettings.ApplyPackageParametersToDependencies) + { + packageConfig.ApplyPackageParametersToDependencies = true; + } if (!string.IsNullOrWhiteSpace(pkgSettings.Source) && HasSourceType(pkgSettings.Source, alternativeSourceRunners)) { packageConfig.SourceType = pkgSettings.Source; } - if (pkgSettings.PinPackage) packageConfig.PinPackage = true; - if (pkgSettings.Force) packageConfig.Force = true; + if (pkgSettings.PinPackage) + { + packageConfig.PinPackage = true; + } + + if (pkgSettings.Force) + { + packageConfig.Force = true; + } + packageConfig.CommandExecutionTimeoutSeconds = pkgSettings.ExecutionTimeout == -1 ? packageConfig.CommandExecutionTimeoutSeconds : pkgSettings.ExecutionTimeout; - if (pkgSettings.Prerelease) packageConfig.Prerelease = true; - if (pkgSettings.OverrideArguments) packageConfig.OverrideArguments = true; - if (pkgSettings.NotSilent) packageConfig.NotSilent = true; - if (pkgSettings.AllowDowngrade) packageConfig.AllowDowngrade = true; - if (pkgSettings.ForceDependencies) packageConfig.ForceDependencies = true; - if (pkgSettings.SkipAutomationScripts) packageConfig.SkipPackageInstallProvider = true; + if (pkgSettings.Prerelease) + { + packageConfig.Prerelease = true; + } + + if (pkgSettings.OverrideArguments) + { + packageConfig.OverrideArguments = true; + } + + if (pkgSettings.NotSilent) + { + packageConfig.NotSilent = true; + } + + if (pkgSettings.AllowDowngrade) + { + packageConfig.AllowDowngrade = true; + } + + if (pkgSettings.ForceDependencies) + { + packageConfig.ForceDependencies = true; + } + + if (pkgSettings.SkipAutomationScripts) + { + packageConfig.SkipPackageInstallProvider = true; + } + packageConfig.SourceCommand.Username = string.IsNullOrWhiteSpace(pkgSettings.User) ? packageConfig.SourceCommand.Username : pkgSettings.User; packageConfig.SourceCommand.Password = string.IsNullOrWhiteSpace(pkgSettings.Password) ? packageConfig.SourceCommand.Password : pkgSettings.Password; packageConfig.SourceCommand.Certificate = string.IsNullOrWhiteSpace(pkgSettings.Cert) ? packageConfig.SourceCommand.Certificate : pkgSettings.Cert; packageConfig.SourceCommand.CertificatePassword = string.IsNullOrWhiteSpace(pkgSettings.CertPassword) ? packageConfig.SourceCommand.CertificatePassword : pkgSettings.CertPassword; - if (pkgSettings.IgnoreChecksums) packageConfig.Features.ChecksumFiles = false; - if (pkgSettings.AllowEmptyChecksums) packageConfig.Features.AllowEmptyChecksums = true; - if (pkgSettings.AllowEmptyChecksumsSecure) packageConfig.Features.AllowEmptyChecksumsSecure = true; + if (pkgSettings.IgnoreChecksums) + { + packageConfig.Features.ChecksumFiles = false; + } + + if (pkgSettings.AllowEmptyChecksums) + { + packageConfig.Features.AllowEmptyChecksums = true; + } + + if (pkgSettings.AllowEmptyChecksumsSecure) + { + packageConfig.Features.AllowEmptyChecksumsSecure = true; + } + if (pkgSettings.RequireChecksums) { packageConfig.Features.AllowEmptyChecksums = false; @@ -882,23 +1025,66 @@ private IEnumerable GetPackagesFromConfigFile(string pa packageConfig.DownloadChecksum64 = string.IsNullOrWhiteSpace(pkgSettings.DownloadChecksum64) ? packageConfig.DownloadChecksum64 : pkgSettings.DownloadChecksum64; packageConfig.DownloadChecksumType = string.IsNullOrWhiteSpace(pkgSettings.DownloadChecksumType) ? packageConfig.DownloadChecksumType : pkgSettings.DownloadChecksumType; packageConfig.DownloadChecksumType64 = string.IsNullOrWhiteSpace(pkgSettings.DownloadChecksumType64) ? packageConfig.DownloadChecksumType : pkgSettings.DownloadChecksumType64; - if (pkgSettings.IgnorePackageExitCodes) packageConfig.Features.UsePackageExitCodes = false; - if (pkgSettings.UsePackageExitCodes) packageConfig.Features.UsePackageExitCodes = true; - if (pkgSettings.StopOnFirstFailure) packageConfig.Features.StopOnFirstPackageFailure = true; - if (pkgSettings.ExitWhenRebootDetected) packageConfig.Features.ExitOnRebootDetected = true; - if (pkgSettings.IgnoreDetectedReboot) packageConfig.Features.ExitOnRebootDetected = false; - if (pkgSettings.DisableRepositoryOptimizations) packageConfig.Features.UsePackageRepositoryOptimizations = false; - if (pkgSettings.AcceptLicense) packageConfig.AcceptLicense = true; + if (pkgSettings.IgnorePackageExitCodes) + { + packageConfig.Features.UsePackageExitCodes = false; + } + + if (pkgSettings.UsePackageExitCodes) + { + packageConfig.Features.UsePackageExitCodes = true; + } + + if (pkgSettings.StopOnFirstFailure) + { + packageConfig.Features.StopOnFirstPackageFailure = true; + } + + if (pkgSettings.ExitWhenRebootDetected) + { + packageConfig.Features.ExitOnRebootDetected = true; + } + + if (pkgSettings.IgnoreDetectedReboot) + { + packageConfig.Features.ExitOnRebootDetected = false; + } + + if (pkgSettings.DisableRepositoryOptimizations) + { + packageConfig.Features.UsePackageRepositoryOptimizations = false; + } + + if (pkgSettings.AcceptLicense) + { + packageConfig.AcceptLicense = true; + } + if (pkgSettings.Confirm) { packageConfig.PromptForConfirmation = false; packageConfig.AcceptLicense = true; } - if (pkgSettings.LimitOutput) packageConfig.RegularOutput = false; + if (pkgSettings.LimitOutput) + { + packageConfig.RegularOutput = false; + } + packageConfig.CacheLocation = string.IsNullOrWhiteSpace(pkgSettings.CacheLocation) ? packageConfig.CacheLocation : pkgSettings.CacheLocation; - if (pkgSettings.FailOnStderr) packageConfig.Features.FailOnStandardError = true; - if (pkgSettings.UseSystemPowershell) packageConfig.Features.UsePowerShellHost = false; - if (pkgSettings.NoProgress) packageConfig.Features.ShowDownloadProgress = false; + if (pkgSettings.FailOnStderr) + { + packageConfig.Features.FailOnStandardError = true; + } + + if (pkgSettings.UseSystemPowershell) + { + packageConfig.Features.UsePowerShellHost = false; + } + + if (pkgSettings.NoProgress) + { + packageConfig.Features.ShowDownloadProgress = false; + } this.Log().Info(ChocolateyLoggers.Important, @"{0}".FormatWith(packageConfig.PackageNames)); packageConfigs.Add(packageConfig); @@ -1011,7 +1197,10 @@ private void BeforeModifyAction(PackageResult packageResult, ChocolateyConfigura } else { - if (config.Information.PlatformType != PlatformType.Windows) this.Log().Info(ChocolateyLoggers.Important, () => " Skipping beforemodify PowerShell script due to non-Windows."); + if (config.Information.PlatformType != PlatformType.Windows) + { + this.Log().Info(ChocolateyLoggers.Important, () => " Skipping beforemodify PowerShell script due to non-Windows."); + } } } @@ -1369,7 +1558,10 @@ public virtual void HandlePackageUninstall(PackageResult packageResult, Chocolat private void UninstallCleanup(ChocolateyConfiguration config, PackageResult packageResult) { - if (config.Features.RemovePackageInformationOnUninstall) _packageInfoService.Remove(packageResult.PackageMetadata); + if (config.Features.RemovePackageInformationOnUninstall) + { + _packageInfoService.Remove(packageResult.PackageMetadata); + } EnsureBadPackagesPathIsClean(config, packageResult); RemoveBackupIfExists(packageResult); @@ -1381,7 +1573,10 @@ private void UninstallCleanup(ChocolateyConfiguration config, PackageResult pack { var packageDirectory = packageResult.InstallLocation; - if (string.IsNullOrWhiteSpace(packageDirectory) || !_fileSystem.DirectoryExists(packageDirectory)) return; + if (string.IsNullOrWhiteSpace(packageDirectory) || !_fileSystem.DirectoryExists(packageDirectory)) + { + return; + } if (packageDirectory.IsEqualTo(ApplicationParameters.InstallLocation) || packageDirectory.IsEqualTo(ApplicationParameters.PackagesLocation)) { @@ -1404,8 +1599,15 @@ private void UninstallCleanup(ChocolateyConfiguration config, PackageResult pack // This should probably be split into install(/upgrade)/uninstall methods with shared logic placed in helper method(s). private void HandleExtensionPackages(ChocolateyConfiguration config, PackageResult packageResult) { - if (packageResult == null) return; - if (!packageResult.Name.ToLowerSafe().EndsWith(".extension") && !packageResult.Name.ToLowerSafe().EndsWith(".extensions")) return; + if (packageResult == null) + { + return; + } + + if (!packageResult.Name.ToLowerSafe().EndsWith(".extension") && !packageResult.Name.ToLowerSafe().EndsWith(".extensions")) + { + return; + } _fileSystem.EnsureDirectoryExists(ApplicationParameters.ExtensionsLocation); var extensionsFolderName = packageResult.Name.ToLowerSafe().Replace(".extensions", string.Empty).Replace(".extension", string.Empty); @@ -1418,7 +1620,10 @@ private void HandleExtensionPackages(ChocolateyConfiguration config, PackageResu if (!config.CommandName.IsEqualTo(CommandNameType.Uninstall.ToStringSafe())) { - if (packageResult.InstallLocation == null) return; + if (packageResult.InstallLocation == null) + { + return; + } _fileSystem.EnsureDirectoryExists(packageExtensionsInstallDirectory); var extensionsFolder = _fileSystem.CombinePaths(packageResult.InstallLocation, "extensions"); @@ -1444,7 +1649,10 @@ private void HandleExtensionPackages(ChocolateyConfiguration config, PackageResu private void RemoveExtensionFolder(string packageExtensionsDirectory) { - if (!_fileSystem.DirectoryExists(packageExtensionsDirectory)) return; + if (!_fileSystem.DirectoryExists(packageExtensionsDirectory)) + { + return; + } // remove old dll files files foreach (var oldDllFile in _fileSystem.GetFiles(packageExtensionsDirectory, "*.dll.old", SearchOption.AllDirectories).OrEmpty()) @@ -1484,8 +1692,15 @@ private void RemoveExtensionFolder(string packageExtensionsDirectory) // This should probably be split into install(/upgrade)/uninstall methods with shared logic placed in helper method(s). private void HandleTemplatePackages(ChocolateyConfiguration config, PackageResult packageResult) { - if (packageResult == null) return; - if (!packageResult.Name.ToLowerSafe().EndsWith(".template")) return; + if (packageResult == null) + { + return; + } + + if (!packageResult.Name.ToLowerSafe().EndsWith(".template")) + { + return; + } _fileSystem.EnsureDirectoryExists(ApplicationParameters.TemplatesLocation); var templateFolderName = packageResult.Name.ToLowerSafe().Replace(".template", string.Empty); @@ -1497,7 +1712,10 @@ private void HandleTemplatePackages(ChocolateyConfiguration config, PackageResul if (!config.CommandName.IsEqualTo(CommandNameType.Uninstall.ToStringSafe())) { - if (packageResult.InstallLocation == null) return; + if (packageResult.InstallLocation == null) + { + return; + } _fileSystem.EnsureDirectoryExists(installTemplatePath); var templatesPath = _fileSystem.CombinePaths(packageResult.InstallLocation, "templates"); @@ -1530,7 +1748,10 @@ private void HandleTemplatePackages(ChocolateyConfiguration config, PackageResul private void EnsureBadPackagesPathIsClean(ChocolateyConfiguration config, PackageResult packageResult) { - if (packageResult.InstallLocation == null) return; + if (packageResult.InstallLocation == null) + { + return; + } FaultTolerance.TryCatchWithLoggingException( () => @@ -1546,7 +1767,10 @@ private void EnsureBadPackagesPathIsClean(ChocolateyConfiguration config, Packag private void HandleFailedOperation(ChocolateyConfiguration config, PackageResult packageResult, bool movePackageToFailureLocation, bool attemptRollback) { - if (Environment.ExitCode == 0) Environment.ExitCode = 1; + if (Environment.ExitCode == 0) + { + Environment.ExitCode = 1; + } foreach (var message in packageResult.Messages.Where(m => m.MessageType == ResultType.Error)) { @@ -1570,9 +1794,15 @@ rollback the previous version. Erroneous install location captured as } else { - if (movePackageToFailureLocation) MovePackageToFailedPackagesLocation(packageResult); + if (movePackageToFailureLocation) + { + MovePackageToFailedPackagesLocation(packageResult); + } - if (attemptRollback) RestorePreviousPackageVersion(config, packageResult); + if (attemptRollback) + { + RestorePreviousPackageVersion(config, packageResult); + } } } } @@ -1600,7 +1830,10 @@ private void MovePackageToFailedPackagesLocation(PackageResult packageResult) private void RestorePreviousPackageVersion(ChocolateyConfiguration config, PackageResult packageResult) { - if (packageResult.InstallLocation == null) return; + if (packageResult.InstallLocation == null) + { + return; + } var normalizedVersion = new NuGetVersion(packageResult.Version).ToNormalizedStringChecked(); @@ -1625,8 +1858,15 @@ private void RestorePreviousPackageVersion(ChocolateyConfiguration config, Packa rollbackDirectory = _fileSystem.GetFullPath(rollbackDirectory); - if (string.IsNullOrWhiteSpace(rollbackDirectory) || !_fileSystem.DirectoryExists(rollbackDirectory)) return; - if (!rollbackDirectory.StartsWith(ApplicationParameters.PackageBackupLocation) || rollbackDirectory.IsEqualTo(ApplicationParameters.PackageBackupLocation)) return; + if (string.IsNullOrWhiteSpace(rollbackDirectory) || !_fileSystem.DirectoryExists(rollbackDirectory)) + { + return; + } + + if (!rollbackDirectory.StartsWith(ApplicationParameters.PackageBackupLocation) || rollbackDirectory.IsEqualTo(ApplicationParameters.PackageBackupLocation)) + { + return; + } this.Log().Debug("Attempting rollback"); @@ -1651,7 +1891,10 @@ private void RestorePreviousPackageVersion(ChocolateyConfiguration config, Packa allowShortAnswer: true, shortPrompt: true ); - if (selection.IsEqualTo("no")) rollback = false; + if (selection.IsEqualTo("no")) + { + rollback = false; + } } if (rollback) @@ -1671,7 +1914,11 @@ private void RemoveBackupIfExists(PackageResult packageResult) public virtual void MarkPackagePending(PackageResult packageResult, ChocolateyConfiguration config) { var packageDirectory = packageResult.InstallLocation; - if (string.IsNullOrWhiteSpace(packageDirectory)) return; + if (string.IsNullOrWhiteSpace(packageDirectory)) + { + return; + } + if (packageDirectory.IsEqualTo(ApplicationParameters.InstallLocation) || packageDirectory.IsEqualTo(ApplicationParameters.PackagesLocation)) { packageResult.Messages.Add( @@ -1695,7 +1942,11 @@ public virtual void MarkPackagePending(PackageResult packageResult, ChocolateyCo public virtual void UnmarkPackagePending(PackageResult packageResult, ChocolateyConfiguration config) { var packageDirectory = packageResult.InstallLocation; - if (string.IsNullOrWhiteSpace(packageDirectory)) return; + if (string.IsNullOrWhiteSpace(packageDirectory)) + { + return; + } + if (packageDirectory.IsEqualTo(ApplicationParameters.InstallLocation) || packageDirectory.IsEqualTo(ApplicationParameters.PackagesLocation)) { packageResult.Messages.Add( @@ -1718,12 +1969,19 @@ public virtual void UnmarkPackagePending(PackageResult packageResult, Chocolatey fileLock.Dispose(); } - if (packageResult.Success && _fileSystem.FileExists(pendingFile)) _fileSystem.DeleteFile(pendingFile); + if (packageResult.Success && _fileSystem.FileExists(pendingFile)) + { + _fileSystem.DeleteFile(pendingFile); + } } private IEnumerable GetInitialEnvironment(ChocolateyConfiguration config, bool allowLogging = true) { - if (config.Information.PlatformType != PlatformType.Windows) return Enumerable.Empty(); + if (config.Information.PlatformType != PlatformType.Windows) + { + return Enumerable.Empty(); + } + var environmentBefore = _registryService.GetEnvironmentValues(); if (allowLogging && config.Features.LogEnvironmentValues) @@ -1804,8 +2062,15 @@ private TSourceRunner GetSourceRunner(string sourceType, IEnumera // This should probably be split into install(/upgrade)/uninstall methods with shared logic placed in helper method(s). private void HandleHookPackages(ChocolateyConfiguration config, PackageResult packageResult) { - if (packageResult == null) return; - if (!packageResult.Name.ToLowerSafe().EndsWith(ApplicationParameters.HookPackageIdExtension)) return; + if (packageResult == null) + { + return; + } + + if (!packageResult.Name.ToLowerSafe().EndsWith(ApplicationParameters.HookPackageIdExtension)) + { + return; + } _fileSystem.EnsureDirectoryExists(ApplicationParameters.HooksLocation); var hookFolderName = packageResult.Name.ToLowerSafe().Replace(ApplicationParameters.HookPackageIdExtension, string.Empty); @@ -1820,7 +2085,10 @@ private void HandleHookPackages(ChocolateyConfiguration config, PackageResult pa if (!config.CommandName.IsEqualTo(CommandNameType.Uninstall.ToStringSafe())) { - if (packageResult.InstallLocation == null) return; + if (packageResult.InstallLocation == null) + { + return; + } _fileSystem.EnsureDirectoryExists(installHookPath); var hookPath = _fileSystem.CombinePaths(packageResult.InstallLocation, "hook"); diff --git a/src/chocolatey/infrastructure.app/services/ConfigTransformService.cs b/src/chocolatey/infrastructure.app/services/ConfigTransformService.cs index e547cc9b20..96c29895a5 100644 --- a/src/chocolatey/infrastructure.app/services/ConfigTransformService.cs +++ b/src/chocolatey/infrastructure.app/services/ConfigTransformService.cs @@ -43,7 +43,11 @@ public void Run(PackageResult packageResult, ChocolateyConfiguration config) if (string.IsNullOrWhiteSpace(installDirectory) || installDirectory.IsEqualTo(ApplicationParameters.InstallLocation) || installDirectory.IsEqualTo(ApplicationParameters.PackagesLocation)) { var logMessage = "Install location is not specific enough, cannot capture files:{0} Erroneous install location captured as '{1}'".FormatWith(Environment.NewLine, installDirectory); - if (packageResult != null) packageResult.Messages.Add(new ResultMessage(ResultType.Warn, logMessage)); + if (packageResult != null) + { + packageResult.Messages.Add(new ResultMessage(ResultType.Warn, logMessage)); + } + this.Log().Error(logMessage); return; } diff --git a/src/chocolatey/infrastructure.app/services/CygwinService.cs b/src/chocolatey/infrastructure.app/services/CygwinService.cs index 9269b9e7c5..8583fe024e 100644 --- a/src/chocolatey/infrastructure.app/services/CygwinService.cs +++ b/src/chocolatey/infrastructure.app/services/CygwinService.cs @@ -140,7 +140,10 @@ public string SourceType public void EnsureSourceAppInstalled(ChocolateyConfiguration config, Action ensureAction) { - if (Platform.GetPlatform() != PlatformType.Windows) throw new NotImplementedException("This source is not supported on non-Windows systems"); + if (Platform.GetPlatform() != PlatformType.Windows) + { + throw new NotImplementedException("This source is not supported on non-Windows systems"); + } var runnerConfig = new ChocolateyConfiguration { @@ -180,7 +183,10 @@ private string GetRootDirectory() } var binRoot = Environment.GetEnvironmentVariable("ChocolateyBinRoot"); - if (string.IsNullOrWhiteSpace(binRoot)) binRoot = "c:\\tools"; + if (string.IsNullOrWhiteSpace(binRoot)) + { + binRoot = "c:\\tools"; + } return _fileSystem.CombinePaths(binRoot, "cygwin"); } @@ -227,7 +233,11 @@ public ConcurrentDictionary Install(ChocolateyConfigurati (s, e) => { var logMessage = e.Data; - if (string.IsNullOrWhiteSpace(logMessage)) return; + if (string.IsNullOrWhiteSpace(logMessage)) + { + return; + } + this.Log().Info(() => " [{0}] {1}".FormatWith(AppName, logMessage.EscapeCurlyBraces())); if (_installedRegex.IsMatch(logMessage)) @@ -241,7 +251,11 @@ public ConcurrentDictionary Install(ChocolateyConfigurati (s, e) => { var logMessage = e.Data; - if (string.IsNullOrWhiteSpace(logMessage)) return; + if (string.IsNullOrWhiteSpace(logMessage)) + { + return; + } + this.Log().Error("[{0}] {1}".FormatWith(AppName, logMessage.EscapeCurlyBraces())); }, updateProcessPath: false, diff --git a/src/chocolatey/infrastructure.app/services/FilesService.cs b/src/chocolatey/infrastructure.app/services/FilesService.cs index 17ca7ad152..7974e23c2c 100644 --- a/src/chocolatey/infrastructure.app/services/FilesService.cs +++ b/src/chocolatey/infrastructure.app/services/FilesService.cs @@ -43,14 +43,20 @@ public FilesService(IXmlService xmlService, IFileSystem fileSystem, IHashProvide public PackageFiles ReadPackageSnapshot(string filePath) { - if (!_fileSystem.FileExists(filePath)) return null; + if (!_fileSystem.FileExists(filePath)) + { + return null; + } return _xmlService.Deserialize(filePath); } private string GetPackageInstallDirectory(PackageResult packageResult) { - if (packageResult == null) return null; + if (packageResult == null) + { + return null; + } var installDirectory = packageResult.InstallLocation; return PackageInstallDirectoryIsCorrect(installDirectory, logMessage => packageResult.Messages.Add(new ResultMessage(ResultType.Warn, logMessage))) ? installDirectory : null; @@ -58,12 +64,19 @@ private string GetPackageInstallDirectory(PackageResult packageResult) private bool PackageInstallDirectoryIsCorrect(string directory, Action errorAction = null) { - if (directory.ToStringSafe().IsEqualTo(string.Empty)) return false; + if (directory.ToStringSafe().IsEqualTo(string.Empty)) + { + return false; + } if (directory.IsEqualTo(ApplicationParameters.InstallLocation) || directory.IsEqualTo(ApplicationParameters.PackagesLocation)) { var logMessage = "Install location is not specific enough:{0} Erroneous install location captured as '{1}'".FormatWith(Environment.NewLine, directory); - if (errorAction != null) errorAction.Invoke(logMessage); + if (errorAction != null) + { + errorAction.Invoke(logMessage); + } + this.Log().Error(logMessage); return false; } @@ -73,40 +86,71 @@ private bool PackageInstallDirectoryIsCorrect(string directory, Action e public void SavePackageSnapshot(PackageFiles snapshot, string filePath) { - if (snapshot == null) return; + if (snapshot == null) + { + return; + } _xmlService.Serialize(snapshot, filePath); } public void EnsureCompatibleFileAttributes(PackageResult packageResult, ChocolateyConfiguration config) { - if (packageResult == null) return; + if (packageResult == null) + { + return; + } + var installDirectory = GetPackageInstallDirectory(packageResult); - if (installDirectory == null) return; + if (installDirectory == null) + { + return; + } EnsureCompatibleFileAttributes(installDirectory, config); } public void EnsureCompatibleFileAttributes(string directory, ChocolateyConfiguration config) { - if (!PackageInstallDirectoryIsCorrect(directory)) return; + if (!PackageInstallDirectoryIsCorrect(directory)) + { + return; + } foreach (var file in _fileSystem.GetFiles(directory, "*.*", SearchOption.AllDirectories)) { var filePath = _fileSystem.GetFullPath(file); var fileInfo = _fileSystem.GetFileInfoFor(filePath); - if (_fileSystem.IsSystemFile(fileInfo)) _fileSystem.EnsureFileAttributeRemoved(filePath, FileAttributes.System); - if (_fileSystem.IsReadOnlyFile(fileInfo)) _fileSystem.EnsureFileAttributeRemoved(filePath, FileAttributes.ReadOnly); - if (_fileSystem.IsHiddenFile(fileInfo)) _fileSystem.EnsureFileAttributeRemoved(filePath, FileAttributes.Hidden); + if (_fileSystem.IsSystemFile(fileInfo)) + { + _fileSystem.EnsureFileAttributeRemoved(filePath, FileAttributes.System); + } + + if (_fileSystem.IsReadOnlyFile(fileInfo)) + { + _fileSystem.EnsureFileAttributeRemoved(filePath, FileAttributes.ReadOnly); + } + + if (_fileSystem.IsHiddenFile(fileInfo)) + { + _fileSystem.EnsureFileAttributeRemoved(filePath, FileAttributes.Hidden); + } } } public PackageFiles CaptureSnapshot(PackageResult packageResult, ChocolateyConfiguration config) { - if (packageResult == null) return new PackageFiles(); + if (packageResult == null) + { + return new PackageFiles(); + } + var installDirectory = GetPackageInstallDirectory(packageResult); - if (installDirectory == null) return null; + if (installDirectory == null) + { + return null; + } return CaptureSnapshot(installDirectory, config); } @@ -115,7 +159,10 @@ public PackageFiles CaptureSnapshot(string directory, ChocolateyConfiguration co { var packageFiles = new PackageFiles(); - if (!PackageInstallDirectoryIsCorrect(directory)) return packageFiles; + if (!PackageInstallDirectoryIsCorrect(directory)) + { + return packageFiles; + } this.Log().Debug(() => "Capturing package files in '{0}'".FormatWith(directory)); //gather all files in the folder diff --git a/src/chocolatey/infrastructure.app/services/NugetService.cs b/src/chocolatey/infrastructure.app/services/NugetService.cs index 4a1963dc17..20c630c9eb 100644 --- a/src/chocolatey/infrastructure.app/services/NugetService.cs +++ b/src/chocolatey/infrastructure.app/services/NugetService.cs @@ -178,8 +178,16 @@ it is possible that incomplete package lists are returned from a command that uses these options."); } - if (config.RegularOutput) this.Log().Debug(() => "Running list with the following filter = '{0}'".FormatWith(config.Input)); - if (config.RegularOutput) this.Log().Debug(ChocolateyLoggers.Verbose, () => "--- Start of List ---"); + if (config.RegularOutput) + { + this.Log().Debug(() => "Running list with the following filter = '{0}'".FormatWith(config.Input)); + } + + if (config.RegularOutput) + { + this.Log().Debug(ChocolateyLoggers.Verbose, () => "--- Start of List ---"); + } + foreach (var pkg in NugetList.GetPackages(config, _nugetLogger, _fileSystem)) { var package = pkg; // for lamda access @@ -223,7 +231,9 @@ it is possible that incomplete package lists are returned from a command )) ); - if (config.Verbose && !config.ListCommand.IdOnly) this.Log().Info(() => + if (config.Verbose && !config.ListCommand.IdOnly) + { + this.Log().Info(() => @" Title: {0} | Published: {1}{2}{3} Number of Downloads: {4} | Downloads for this version: {5} Package url{6} @@ -267,8 +277,7 @@ Package url{6} package.Description.EscapeCurlyBraces().Replace("\n ", "\n").Replace("\n", "\n "), !string.IsNullOrWhiteSpace(package.ReleaseNotes.ToStringSafe()) ? "{0} Release Notes: {1}".FormatWith(Environment.NewLine, package.ReleaseNotes.EscapeCurlyBraces().Replace("\n ", "\n").Replace("\n", "\n ")) : string.Empty )); - - + } } else { @@ -291,7 +300,11 @@ Package url{6} } } - if (config.RegularOutput) this.Log().Debug(ChocolateyLoggers.Verbose, () => "--- End of List ---"); + if (config.RegularOutput) + { + this.Log().Debug(ChocolateyLoggers.Verbose, () => "--- End of List ---"); + } + if (config.RegularOutput && !config.QuietOutput) { this.Log().Warn(() => @"{0} packages {1}.".FormatWith(count, config.ListCommand.LocalOnly ? "installed" : "found")); @@ -349,7 +362,10 @@ public virtual void Pack(ChocolateyConfiguration config) ValidateNuspec(nuspecFilePath, config); var nuspecDirectory = _fileSystem.GetFullPath(_fileSystem.GetDirectoryName(nuspecFilePath)); - if (string.IsNullOrWhiteSpace(nuspecDirectory)) nuspecDirectory = _fileSystem.GetCurrentDirectory(); + if (string.IsNullOrWhiteSpace(nuspecDirectory)) + { + nuspecDirectory = _fileSystem.GetCurrentDirectory(); + } // Use case-insensitive properties like "nuget pack". var properties = new Dictionary(StringComparer.OrdinalIgnoreCase); @@ -420,7 +436,10 @@ public virtual void Push(ChocolateyConfiguration config) { string nupkgFilePath = GetPackageFileOrThrow(config, NuGetConstants.PackageExtension); string nupkgFileName = _fileSystem.GetFileName(nupkgFilePath); - if (config.RegularOutput) this.Log().Info(() => "Attempting to push {0} to {1}".FormatWith(nupkgFileName, config.Sources)); + if (config.RegularOutput) + { + this.Log().Info(() => "Attempting to push {0} to {1}".FormatWith(nupkgFileName, config.Sources)); + } var sourceCacheContext = new ChocolateySourceCacheContext(config); NugetPush.PushPackage(config, _fileSystem.GetFullPath(nupkgFilePath), _nugetLogger, nupkgFileName, _fileSystem, sourceCacheContext); @@ -485,7 +504,10 @@ public virtual ConcurrentDictionary Install(ChocolateyCon //todo: #23 handle all NuGetVersion version = !string.IsNullOrWhiteSpace(config.Version) ? NuGetVersion.Parse(config.Version) : null; - if (config.Force) config.AllowDowngrade = true; + if (config.Force) + { + config.AllowDowngrade = true; + } var sourceCacheContext = new ChocolateySourceCacheContext(config); var remoteRepositories = NugetCommon.GetRemoteRepositories(config, _nugetLogger, _fileSystem); @@ -788,7 +810,10 @@ Version was specified as '{0}'. It is possible that version this.Log().Warn(logMessage); forcedResult.Messages.Add(new ResultMessage(ResultType.Inconclusive, logMessage)); forcedResult.Messages.Add(new ResultMessage(ResultType.Error, logMessage)); - if (continueAction != null) continueAction.Invoke(forcedResult, config); + if (continueAction != null) + { + continueAction.Invoke(forcedResult, config); + } continue; } @@ -839,7 +864,11 @@ Version was specified as '{0}'. It is possible that version )); var packageResult = packageResultsToReturn.GetOrAdd(packageDependencyInfo.Id.ToLowerSafe(), new PackageResult(packageMetadata, packageRemoteMetadata, installedPath)); - if (shouldAddForcedResultMessage) packageResult.Messages.Add(new ResultMessage(ResultType.Note, "Backing up and removing old version")); + if (shouldAddForcedResultMessage) + { + packageResult.Messages.Add(new ResultMessage(ResultType.Note, "Backing up and removing old version")); + } + packageResult.InstallLocation = installedPath; packageResult.Messages.Add(new ResultMessage(ResultType.Debug, ApplicationParameters.Messages.ContinueChocolateyAction)); @@ -855,8 +884,10 @@ Version was specified as '{0}'. It is possible that version packageResult.Messages.Add(new ResultMessage(ResultType.Warn, message)); } - if (continueAction != null) continueAction.Invoke(packageResult, config); - + if (continueAction != null) + { + continueAction.Invoke(packageResult, config); + } } catch (Exception ex) { @@ -865,15 +896,25 @@ Version was specified as '{0}'. It is possible that version if (webException != null) { var response = webException.Response as HttpWebResponse; - if (response != null && !string.IsNullOrWhiteSpace(response.StatusDescription)) message += " {0}".FormatWith(response.StatusDescription); + if (response != null && !string.IsNullOrWhiteSpace(response.StatusDescription)) + { + message += " {0}".FormatWith(response.StatusDescription); + } } var logMessage = "{0} not installed. An error occurred during installation:{1} {2}".FormatWith(packageDependencyInfo.Id, Environment.NewLine, message); this.Log().Error(ChocolateyLoggers.Important, logMessage); var errorResult = packageResultsToReturn.GetOrAdd(packageDependencyInfo.Id, new PackageResult(packageDependencyInfo.Id, version.ToFullStringChecked(), null)); errorResult.Messages.Add(new ResultMessage(ResultType.Error, logMessage)); - if (errorResult.ExitCode == 0) errorResult.ExitCode = 1; - if (continueAction != null) continueAction.Invoke(errorResult, config); + if (errorResult.ExitCode == 0) + { + errorResult.ExitCode = 1; + } + + if (continueAction != null) + { + continueAction.Invoke(errorResult, config); + } } } } @@ -934,8 +975,15 @@ public virtual void EnsureBackupDirectoryRemoved(string packageName) rollbackDirectory = _fileSystem.GetFullPath(rollbackDirectory); } - if (string.IsNullOrWhiteSpace(rollbackDirectory) || !_fileSystem.DirectoryExists(rollbackDirectory)) return; - if (!rollbackDirectory.StartsWith(ApplicationParameters.PackageBackupLocation) || rollbackDirectory.IsEqualTo(ApplicationParameters.PackageBackupLocation)) return; + if (string.IsNullOrWhiteSpace(rollbackDirectory) || !_fileSystem.DirectoryExists(rollbackDirectory)) + { + return; + } + + if (!rollbackDirectory.StartsWith(ApplicationParameters.PackageBackupLocation) || rollbackDirectory.IsEqualTo(ApplicationParameters.PackageBackupLocation)) + { + return; + } FaultTolerance.TryCatchWithLoggingException( () => _fileSystem.DeleteDirectoryChecked(rollbackDirectory, recursive: true), @@ -961,7 +1009,10 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon NuGetVersion version = !string.IsNullOrWhiteSpace(config.Version) ? NuGetVersion.Parse(config.Version) : null; - if (config.Force) config.AllowDowngrade = true; + if (config.Force) + { + config.AllowDowngrade = true; + } var sourceCacheContext = new ChocolateySourceCacheContext(config); var remoteRepositories = NugetCommon.GetRemoteRepositories(config, _nugetLogger, _fileSystem); @@ -1003,7 +1054,10 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon string failLogMessage = "{0} is not installed. Cannot upgrade a non-existent package.".FormatWith(packageName); var result = packageResultsToReturn.GetOrAdd(packageName, new PackageResult(packageName, null, null)); result.Messages.Add(new ResultMessage(ResultType.Error, failLogMessage)); - if (config.RegularOutput) this.Log().Error(ChocolateyLoggers.Important, failLogMessage); + if (config.RegularOutput) + { + this.Log().Error(ChocolateyLoggers.Important, failLogMessage); + } continue; } @@ -1013,7 +1067,10 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon string warnLogMessage = "{0} is not installed and skip non-installed option selected. Skipping...".FormatWith(packageName); var result = packageResultsToReturn.GetOrAdd(packageName, new PackageResult(packageName, null, null)); result.Messages.Add(new ResultMessage(ResultType.Warn, warnLogMessage)); - if (config.RegularOutput) this.Log().Warn(ChocolateyLoggers.Important, warnLogMessage); + if (config.RegularOutput) + { + this.Log().Warn(ChocolateyLoggers.Important, warnLogMessage); + } continue; } @@ -1021,7 +1078,10 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon string logMessage = @"{0} is not installed. Installing...".FormatWith(packageName); localPackageListValid = false; - if (config.RegularOutput) this.Log().Warn(ChocolateyLoggers.Important, logMessage); + if (config.RegularOutput) + { + this.Log().Warn(ChocolateyLoggers.Important, logMessage); + } var packageNames = config.PackageNames; config.PackageNames = packageName; @@ -1076,7 +1136,10 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon if (availablePackage == null) { - if (config.Features.IgnoreUnfoundPackagesOnUpgradeOutdated) continue; + if (config.Features.IgnoreUnfoundPackagesOnUpgradeOutdated) + { + continue; + } string logMessage = "{0} was not found with the source(s) listed.{1} If you specified a particular version and are receiving this message, it is possible that the package name exists but the version does not.{1} Version: \"{2}\"; Source(s): \"{3}\"".FormatWith(packageName, Environment.NewLine, config.Version, config.Sources); var unfoundResult = packageResultsToReturn.GetOrAdd(packageName, new PackageResult(packageName, version.ToFullStringChecked(), null)); @@ -1084,7 +1147,10 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon if (config.UpgradeCommand.FailOnUnfound) { unfoundResult.Messages.Add(new ResultMessage(ResultType.Error, logMessage)); - if (config.RegularOutput) this.Log().Error(ChocolateyLoggers.Important, "{0}{1}".FormatWith(Environment.NewLine, logMessage)); + if (config.RegularOutput) + { + this.Log().Error(ChocolateyLoggers.Important, "{0}{1}".FormatWith(Environment.NewLine, logMessage)); + } } else { @@ -1152,7 +1218,10 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon } packageResult.Messages.Add(new ResultMessage(ResultType.Note, logMessage)); - if (config.RegularOutput) this.Log().Info(logMessage); + if (config.RegularOutput) + { + this.Log().Info(logMessage); + } } if ((availablePackage.Identity.Version > installedPackage.PackageMetadata.Version) || config.Force || (availablePackage.Identity.Version < installedPackage.PackageMetadata.Version && config.AllowDowngrade)) @@ -1177,7 +1246,10 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon string logMessage = "{0} is pinned. Skipping pinned package.".FormatWith(packageName); packageResult.Messages.Add(new ResultMessage(ResultType.Warn, logMessage)); packageResult.Messages.Add(new ResultMessage(ResultType.Inconclusive, logMessage)); - if (config.RegularOutput) this.Log().Warn(ChocolateyLoggers.Important, logMessage); + if (config.RegularOutput) + { + this.Log().Warn(ChocolateyLoggers.Important, logMessage); + } continue; } @@ -1470,7 +1542,10 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon this.Log().Warn(logMessage); //forcedResult.Messages.Add(new ResultMessage(ResultType.Inconclusive, logMessage)); forcedResult.Messages.Add(new ResultMessage(ResultType.Error, logMessage)); - if (continueAction != null) continueAction.Invoke(forcedResult, config); + if (continueAction != null) + { + continueAction.Invoke(forcedResult, config); + } continue; } @@ -1539,7 +1614,10 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon packageResult.Messages.Add(new ResultMessage(ResultType.Warn, message)); } - if (continueAction != null) continueAction.Invoke(upgradePackageResult, config); + if (continueAction != null) + { + continueAction.Invoke(upgradePackageResult, config); + } if (packageToUninstall != null) { @@ -1559,15 +1637,25 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon if (webException != null) { var response = webException.Response as HttpWebResponse; - if (response != null && !string.IsNullOrWhiteSpace(response.StatusDescription)) message += " {0}".FormatWith(response.StatusDescription); + if (response != null && !string.IsNullOrWhiteSpace(response.StatusDescription)) + { + message += " {0}".FormatWith(response.StatusDescription); + } } var logMessage = "{0} not upgraded. An error occurred during installation:{1} {2}".FormatWith(packageName, Environment.NewLine, message); this.Log().Error(ChocolateyLoggers.Important, logMessage); var errorResult = packageResultsToReturn.GetOrAdd(packageDependencyInfo.Id, new PackageResult(packageDependencyInfo.Id, version.ToFullStringChecked(), null)); errorResult.Messages.Add(new ResultMessage(ResultType.Error, logMessage)); - if (errorResult.ExitCode == 0) errorResult.ExitCode = 1; - if (continueAction != null) continueAction.Invoke(errorResult, config); + if (errorResult.ExitCode == 0) + { + errorResult.ExitCode = 1; + } + + if (continueAction != null) + { + continueAction.Invoke(errorResult, config); + } } } } @@ -1629,7 +1717,10 @@ public virtual ConcurrentDictionary GetOutdated(Chocolate if (latestPackage == null) { - if (config.Features.IgnoreUnfoundPackagesOnUpgradeOutdated) continue; + if (config.Features.IgnoreUnfoundPackagesOnUpgradeOutdated) + { + continue; + } string unfoundLogMessage = "{0} was not found with the source(s) listed.{1} Source(s): \"{2}\"".FormatWith(packageName, Environment.NewLine, config.Sources); var unfoundResult = outdatedPackages.GetOrAdd(packageName, new PackageResult(installedPackage.PackageMetadata, pathResolver.GetInstallPath(installedPackage.PackageMetadata.Id))); @@ -1640,7 +1731,10 @@ public virtual ConcurrentDictionary GetOutdated(Chocolate continue; } - if (latestPackage.Identity.Version <= installedPackage.PackageMetadata.Version) continue; + if (latestPackage.Identity.Version <= installedPackage.PackageMetadata.Version) + { + continue; + } var packageResult = outdatedPackages.GetOrAdd(packageName, new PackageResult(latestPackage, pathResolver.GetInstallPath(latestPackage.Identity))); @@ -1666,7 +1760,10 @@ public virtual ConcurrentDictionary GetOutdated(Chocolate /// The original unmodified configuration, so it can be reset after upgrade protected virtual ChocolateyConfiguration SetConfigFromRememberedArguments(ChocolateyConfiguration config, ChocolateyPackageInformation packageInfo) { - if (!config.Features.UseRememberedArgumentsForUpgrades || string.IsNullOrWhiteSpace(packageInfo.Arguments)) return config; + if (!config.Features.UseRememberedArgumentsForUpgrades || string.IsNullOrWhiteSpace(packageInfo.Arguments)) + { + return config; + } var packageArgumentsUnencrypted = packageInfo.Arguments.ContainsSafe(" --") && packageInfo.Arguments.ToStringSafe().Length > 4 ? packageInfo.Arguments : NugetEncryptionUtility.DecryptString(packageInfo.Arguments); @@ -1687,7 +1784,10 @@ protected virtual ChocolateyConfiguration SetConfigFromRememberedArguments(Choco if (packageArgumentSplit.Length == 2) { optionValue = packageArgumentSplit[1].ToStringSafe().UnquoteSafe(); - if (optionValue.StartsWith("'")) optionValue.UnquoteSafe(); + if (optionValue.StartsWith("'")) + { + optionValue.UnquoteSafe(); + } } if (sensitiveArgs) @@ -1702,10 +1802,25 @@ protected virtual ChocolateyConfiguration SetConfigFromRememberedArguments(Choco ConfigurationOptions.OptionSet.Parse(packageArguments); // there may be overrides from the user running upgrade - if (!string.IsNullOrWhiteSpace(originalConfig.SourceCommand.Username)) config.SourceCommand.Username = originalConfig.SourceCommand.Username; - if (!string.IsNullOrWhiteSpace(originalConfig.SourceCommand.Password)) config.SourceCommand.Password = originalConfig.SourceCommand.Password; - if (!string.IsNullOrWhiteSpace(originalConfig.SourceCommand.Certificate)) config.SourceCommand.Certificate = originalConfig.SourceCommand.Certificate; - if (!string.IsNullOrWhiteSpace(originalConfig.SourceCommand.CertificatePassword)) config.SourceCommand.CertificatePassword = originalConfig.SourceCommand.CertificatePassword; + if (!string.IsNullOrWhiteSpace(originalConfig.SourceCommand.Username)) + { + config.SourceCommand.Username = originalConfig.SourceCommand.Username; + } + + if (!string.IsNullOrWhiteSpace(originalConfig.SourceCommand.Password)) + { + config.SourceCommand.Password = originalConfig.SourceCommand.Password; + } + + if (!string.IsNullOrWhiteSpace(originalConfig.SourceCommand.Certificate)) + { + config.SourceCommand.Certificate = originalConfig.SourceCommand.Certificate; + } + + if (!string.IsNullOrWhiteSpace(originalConfig.SourceCommand.CertificatePassword)) + { + config.SourceCommand.CertificatePassword = originalConfig.SourceCommand.CertificatePassword; + } return originalConfig; } @@ -1889,7 +2004,10 @@ private string GetInstallDirectory(IPackageMetadata installedPackage) protected virtual void EnsurePackageFilesHaveCompatibleAttributes(ChocolateyConfiguration config, IPackageMetadata installedPackage) { var installDirectory = GetInstallDirectory(installedPackage); - if (!_fileSystem.DirectoryExists(installDirectory)) return; + if (!_fileSystem.DirectoryExists(installDirectory)) + { + return; + } _filesService.EnsureCompatibleFileAttributes(installDirectory, config); } @@ -1941,7 +2059,10 @@ public virtual void RemoveOldPackageScriptsBeforeUpgrade(string directoryPath, s public virtual void BackupChangedFiles(string packageInstallPath, ChocolateyConfiguration config, ChocolateyPackageInformation packageInfo) { - if (packageInfo == null || packageInfo.Package == null) return; + if (packageInfo == null || packageInfo.Package == null) + { + return; + } var version = packageInfo.Package.Version.ToNormalizedStringChecked(); @@ -1968,7 +2089,10 @@ public virtual void BackupChangedFiles(string packageInstallPath, ChocolateyConf if (!currentFile.Checksum.IsEqualTo(installedFile.Checksum)) { // skip nupkgs if they are different - if (_fileSystem.GetFileExtension(currentFile.Path).IsEqualTo(".nupkg")) continue; + if (_fileSystem.GetFileExtension(currentFile.Path).IsEqualTo(".nupkg")) + { + continue; + } var backupName = "{0}.{1}".FormatWith(_fileSystem.GetFileName(currentFile.Path), version); FaultTolerance.TryCatchWithLoggingException( @@ -2010,7 +2134,10 @@ private void RemovePackageFromCache(ChocolateyConfiguration config, IPackageMeta this.Log().Debug(ChocolateyLoggers.Verbose, "Ensuring removal of package cache files."); var cacheDirectory = _fileSystem.CombinePaths(config.CacheLocation, installedPackage.Id, installedPackage.Version.ToNormalizedStringChecked()); - if (!_fileSystem.DirectoryExists(cacheDirectory)) return; + if (!_fileSystem.DirectoryExists(cacheDirectory)) + { + return; + } FaultTolerance.TryCatchWithLoggingException( () => _fileSystem.DeleteDirectoryChecked(cacheDirectory, recursive: true), @@ -2066,7 +2193,10 @@ public void UninstallDryRun(ChocolateyConfiguration config, Action Uninstall(ChocolateyC var missingResult = packageResultsToReturn.GetOrAdd(packageName, new PackageResult(packageName, null, null)); missingResult.Messages.Add(new ResultMessage(ResultType.Error, logMessage)); - if (config.RegularOutput) this.Log().Error(ChocolateyLoggers.Important, logMessage); + if (config.RegularOutput) + { + this.Log().Error(ChocolateyLoggers.Important, logMessage); + } + continue; } @@ -2208,18 +2342,32 @@ public virtual ConcurrentDictionary Uninstall(ChocolateyC requireAnswer: true, allowShortAnswer: false); - if (string.IsNullOrWhiteSpace(selection)) continue; - if (selection.IsEqualTo(abortChoice)) continue; + if (string.IsNullOrWhiteSpace(selection)) + { + continue; + } + + if (selection.IsEqualTo(abortChoice)) + { + continue; + } + if (selection.IsEqualTo(allVersionsChoice)) { packageVersionsToRemove.AddRange(installedPackageVersions.ToList()); - if (config.RegularOutput) this.Log().Info(() => "You selected to remove all versions of {0}".FormatWith(packageName)); + if (config.RegularOutput) + { + this.Log().Info(() => "You selected to remove all versions of {0}".FormatWith(packageName)); + } } else { PackageResult pkg = installedPackageVersions.FirstOrDefault((p) => p.Version.IsEqualTo(selection)); packageVersionsToRemove.Add(pkg); - if (config.RegularOutput) this.Log().Info(() => "You selected {0} v{1}".FormatWith(pkg.Name, pkg.Version)); + if (config.RegularOutput) + { + this.Log().Info(() => "You selected {0} v{1}".FormatWith(pkg.Name, pkg.Version)); + } } } } @@ -2241,7 +2389,11 @@ public virtual ConcurrentDictionary Uninstall(ChocolateyC var pinnedResult = packageResultsToReturn.GetOrAdd(installedPackage.Name, new PackageResult(installedPackage.Name, null, null)); pinnedResult.Messages.Add(new ResultMessage(ResultType.Warn, logMessage)); pinnedResult.Messages.Add(new ResultMessage(ResultType.Inconclusive, logMessage)); - if (config.RegularOutput) this.Log().Warn(ChocolateyLoggers.Important, logMessage); + if (config.RegularOutput) + { + this.Log().Warn(ChocolateyLoggers.Important, logMessage); + } + continue; } @@ -2314,7 +2466,10 @@ public virtual ConcurrentDictionary Uninstall(ChocolateyC var logMessage = "{0}{1} v{2}{3}".FormatWith(Environment.NewLine, packageToUninstall.Name, packageToUninstall.Version.ToStringSafe(), config.Force ? " (forced)" : string.Empty); packageResult.Messages.Add(new ResultMessage(ResultType.Debug, ApplicationParameters.Messages.ContinueChocolateyAction)); - if (continueAction != null) continueAction.Invoke(packageResult, config); + if (continueAction != null) + { + continueAction.Invoke(packageResult, config); + } if (packageToUninstall != null) { @@ -2356,7 +2511,10 @@ public virtual ConcurrentDictionary Uninstall(ChocolateyC this.Log().Error(ChocolateyLoggers.Important, logMessage); var result = packageResultsToReturn.GetOrAdd(packageToUninstall.Name + "." + packageToUninstall.Version.ToStringSafe(), new PackageResult(packageToUninstall.PackageMetadata, pathResolver.GetInstallPath(packageToUninstall.PackageMetadata.Id))); result.Messages.Add(new ResultMessage(ResultType.Error, logMessage)); - if (result.ExitCode == 0) result.ExitCode = 1; + if (result.ExitCode == 0) + { + result.ExitCode = 1; + } if (config.Features.StopOnFirstPackageFailure) { @@ -2370,7 +2528,10 @@ public virtual ConcurrentDictionary Uninstall(ChocolateyC { // continue action won't be found b/c we are not actually uninstalling (this is noop) var result = packageResultsToReturn.GetOrAdd(installedPackage.Name + "." + installedPackage.Version.ToStringSafe(), new PackageResult(installedPackage.PackageMetadata, pathResolver.GetInstallPath(installedPackage.PackageMetadata.Id))); - if (continueAction != null) continueAction.Invoke(result, config); + if (continueAction != null) + { + continueAction.Invoke(result, config); + } } } @@ -2522,7 +2683,10 @@ private void EnsureNupkgRemoved(IPackageMetadata removedPackage, bool throwError var installDir = _fileSystem.CombinePaths(ApplicationParameters.PackagesLocation, removedPackage.Id); var nupkg = _fileSystem.CombinePaths(installDir, nupkgFile); - if (!_fileSystem.FileExists(nupkg)) return; + if (!_fileSystem.FileExists(nupkg)) + { + return; + } FaultTolerance.TryCatchWithLoggingException( () => _fileSystem.DeleteFile(nupkg), @@ -2532,7 +2696,11 @@ private void EnsureNupkgRemoved(IPackageMetadata removedPackage, bool throwError protected void NormalizeNuspecCasing(IPackageSearchMetadata packageMetadata, string packageLocation) { - if (Platform.GetPlatform() == PlatformType.Windows) return; + if (Platform.GetPlatform() == PlatformType.Windows) + { + return; + } + this.Log().Debug(ChocolateyLoggers.Verbose, "Fixing nuspec casing if required"); var expectedNuspec = _fileSystem.CombinePaths(packageLocation, "{0}{1}" @@ -2561,7 +2729,10 @@ public virtual void RemoveInstallationFilesUnsafe(IPackageMetadata removedPackag foreach (var file in _fileSystem.GetFiles(installDir, "*.*", SearchOption.AllDirectories).OrEmpty()) { var fileSnapshot = pkgInfo.FilesSnapshot.Files.FirstOrDefault(f => f.Path.IsEqualTo(file)); - if (fileSnapshot == null) continue; + if (fileSnapshot == null) + { + continue; + } var filesystemFileChecksum = _filesService.GetPackageFile(file).Checksum; @@ -2573,7 +2744,10 @@ public virtual void RemoveInstallationFilesUnsafe(IPackageMetadata removedPackag if (fileSnapshot.Checksum == filesystemFileChecksum) { - if (!_fileSystem.FileExists(file)) continue; + if (!_fileSystem.FileExists(file)) + { + continue; + } try { @@ -2612,11 +2786,17 @@ public virtual void RemoveInstallationFiles(IPackageMetadata removedPackage, Cho foreach (var file in _fileSystem.GetFiles(installDir, "*.*", SearchOption.AllDirectories).OrEmpty()) { var fileSnapshot = pkgInfo.FilesSnapshot.Files.FirstOrDefault(f => f.Path.IsEqualTo(file)); - if (fileSnapshot == null) continue; + if (fileSnapshot == null) + { + continue; + } if (fileSnapshot.Checksum == _filesService.GetPackageFile(file).Checksum) { - if (!_fileSystem.FileExists(file)) continue; + if (!_fileSystem.FileExists(file)) + { + continue; + } FaultTolerance.TryCatchWithLoggingException( () => _fileSystem.DeleteFile(file), @@ -2724,7 +2904,10 @@ private IEnumerable SetPackageNamesIfAllSpecified(ChocolateyConfi config.PackageNames = packagesToUpdate.Join(ApplicationParameters.PackageNamesSeparator); - if (customAction != null) customAction.Invoke(); + if (customAction != null) + { + customAction.Invoke(); + } } return allPackages; diff --git a/src/chocolatey/infrastructure.app/services/PowershellService.cs b/src/chocolatey/infrastructure.app/services/PowershellService.cs index a2868e4b7b..28f12bcef9 100644 --- a/src/chocolatey/infrastructure.app/services/PowershellService.cs +++ b/src/chocolatey/infrastructure.app/services/PowershellService.cs @@ -91,10 +91,16 @@ private IEnumerable GetHookScripts(ChocolateyConfiguration configuration List hookScriptPaths = new List(); // If skipping hook scripts, return an empty list - if (configuration.SkipHookScripts) return hookScriptPaths; + if (configuration.SkipHookScripts) + { + return hookScriptPaths; + } // If hooks directory doesn't exist, return an empty list to prevent directory not exist warnings - if (!_fileSystem.DirectoryExists(ApplicationParameters.HooksLocation)) return hookScriptPaths; + if (!_fileSystem.DirectoryExists(ApplicationParameters.HooksLocation)) + { + return hookScriptPaths; + } string filenameBase; @@ -294,7 +300,11 @@ public bool RunAction(ChocolateyConfiguration configuration, PackageResult packa ); } - if (selection.IsEqualTo("yes")) shouldRun = true; + if (selection.IsEqualTo("yes")) + { + shouldRun = true; + } + if (selection.IsEqualTo("all - yes to all")) { configuration.PromptForConfirmation = false; @@ -404,7 +414,10 @@ private PowerShellExecutionResults RunExternalPowerShell(ChocolateyConfiguration configuration.CommandExecutionTimeoutSeconds, (s, e) => { - if (string.IsNullOrWhiteSpace(e.Data)) return; + if (string.IsNullOrWhiteSpace(e.Data)) + { + return; + } //inspect for different streams if (e.Data.StartsWith("DEBUG:")) { @@ -425,7 +438,11 @@ private PowerShellExecutionResults RunExternalPowerShell(ChocolateyConfiguration }, (s, e) => { - if (string.IsNullOrWhiteSpace(e.Data)) return; + if (string.IsNullOrWhiteSpace(e.Data)) + { + return; + } + result.StandardErrorWritten = true; this.Log().Error(() => " " + e.Data.EscapeCurlyBraces()); }); @@ -435,7 +452,10 @@ private PowerShellExecutionResults RunExternalPowerShell(ChocolateyConfiguration public void PreparePowerShellEnvironment(IPackageSearchMetadata package, ChocolateyConfiguration configuration, string packageDirectory) { - if (package == null) return; + if (package == null) + { + return; + } EnvironmentSettings.UpdateEnvironmentVariables(); EnvironmentSettings.SetEnvironmentVariables(configuration); @@ -561,8 +581,15 @@ private void AddAssemblyResolver() // we build against v1 - everything should update in a kosher manner to the newest, but it may not. var assembly = TryLoadVersionedAssembly(requestedAssembly, new Version(5, 0, 0, 0)) ?? TryLoadVersionedAssembly(requestedAssembly, new Version(4, 0, 0, 0)); - if (assembly == null) assembly = TryLoadVersionedAssembly(requestedAssembly, new Version(3, 0, 0, 0)); - if (assembly == null) assembly = TryLoadVersionedAssembly(requestedAssembly, new Version(1, 0, 0, 0)); + if (assembly == null) + { + assembly = TryLoadVersionedAssembly(requestedAssembly, new Version(3, 0, 0, 0)); + } + + if (assembly == null) + { + assembly = TryLoadVersionedAssembly(requestedAssembly, new Version(1, 0, 0, 0)); + } return assembly; }; @@ -572,7 +599,10 @@ private void AddAssemblyResolver() private System.Reflection.Assembly TryLoadVersionedAssembly(AssemblyName requestedAssembly, Version version) { - if (requestedAssembly == null) return null; + if (requestedAssembly == null) + { + return null; + } requestedAssembly.Version = version; @@ -587,7 +617,10 @@ private System.Reflection.Assembly TryLoadVersionedAssembly(AssemblyName request } catch (Exception ex) { - if (requestedAssembly.Name.EndsWith(".resources", StringComparison.OrdinalIgnoreCase)) return null; + if (requestedAssembly.Name.EndsWith(".resources", StringComparison.OrdinalIgnoreCase)) + { + return null; + } this.Log().Debug(ChocolateyLoggers.Verbose, "Attempting to load assembly {0} failed:{1} {2}".FormatWith(requestedAssembly.Name, Environment.NewLine, ex.Message.EscapeCurlyBraces())); @@ -697,7 +730,10 @@ public PowerShellExecutionResults RunHost(ChocolateyConfiguration config, string "; pipeline.Commands.Add(new Command(outputRedirectionFixScript, isScript: true, useLocalScope: false)); - if (additionalActionsBeforeScript != null) additionalActionsBeforeScript.Invoke(pipeline); + if (additionalActionsBeforeScript != null) + { + additionalActionsBeforeScript.Invoke(pipeline); + } pipeline.Commands.Add(new Command(commandToRun, isScript: true, useLocalScope: false)); @@ -717,7 +753,10 @@ public PowerShellExecutionResults RunHost(ChocolateyConfiguration config, string if (scriptStackTrace != null) { var scriptError = scriptStackTrace.GetValue(record, null).ToStringSafe(); - if (!string.IsNullOrWhiteSpace(scriptError)) errorStackTrace = scriptError; + if (!string.IsNullOrWhiteSpace(scriptError)) + { + errorStackTrace = scriptError; + } } } this.Log().Error("ERROR: {0}{1}".FormatWith(ex.Message.EscapeCurlyBraces(), !config.Debug ? string.Empty : "{0} {1}".FormatWith(Environment.NewLine, errorStackTrace.EscapeCurlyBraces()))); @@ -739,12 +778,20 @@ public PowerShellExecutionResults RunHost(ChocolateyConfiguration config, string case PipelineState.Failed: case PipelineState.Stopping: case PipelineState.Stopped: - if (host.ExitCode == 0) host.SetShouldExit(1); + if (host.ExitCode == 0) + { + host.SetShouldExit(1); + } + host.HostException = pipeline.PipelineStateInfo.Reason; break; case PipelineState.Completed: - if (host.ExitCode == -1) host.SetShouldExit(0); + if (host.ExitCode == -1) + { + host.SetShouldExit(0); + } + break; } } diff --git a/src/chocolatey/infrastructure.app/services/PythonService.cs b/src/chocolatey/infrastructure.app/services/PythonService.cs index be511611de..71ca71c38e 100644 --- a/src/chocolatey/infrastructure.app/services/PythonService.cs +++ b/src/chocolatey/infrastructure.app/services/PythonService.cs @@ -172,7 +172,10 @@ public string SourceType public void EnsureSourceAppInstalled(ChocolateyConfiguration config, Action ensureAction) { - if (Platform.GetPlatform() != PlatformType.Windows) throw new NotImplementedException("This source is not supported on non-Windows systems"); + if (Platform.GetPlatform() != PlatformType.Windows) + { + throw new NotImplementedException("This source is not supported on non-Windows systems"); + } //ensure at least python 2.7.9 is installed var python = _fileSystem.GetExecutablePath("python"); @@ -212,7 +215,10 @@ public void EnsureSourceAppInstalled(ChocolateyConfiguration config, Action argsDictionary) @@ -302,7 +314,11 @@ public IEnumerable List(ChocolateyConfiguration config) stdOutAction: (s, e) => { var logMessage = e.Data; - if (string.IsNullOrWhiteSpace(logMessage)) return; + if (string.IsNullOrWhiteSpace(logMessage)) + { + return; + } + if (!config.QuietOutput) { this.Log().Info(logMessage.EscapeCurlyBraces()); @@ -314,7 +330,11 @@ public IEnumerable List(ChocolateyConfiguration config) }, stdErrAction: (s, e) => { - if (string.IsNullOrWhiteSpace(e.Data)) return; + if (string.IsNullOrWhiteSpace(e.Data)) + { + return; + } + this.Log().Error(() => "{0}".FormatWith(e.Data.EscapeCurlyBraces())); }, updateProcessPath: false, @@ -359,7 +379,11 @@ public ConcurrentDictionary Install(ChocolateyConfigurati (s, e) => { var logMessage = e.Data; - if (string.IsNullOrWhiteSpace(logMessage)) return; + if (string.IsNullOrWhiteSpace(logMessage)) + { + return; + } + this.Log().Info(() => " [{0}] {1}".FormatWith(AppName, logMessage.EscapeCurlyBraces())); if (_errorRegex.IsMatch(logMessage) || _errorNotFoundRegex.IsMatch(logMessage)) @@ -379,7 +403,11 @@ public ConcurrentDictionary Install(ChocolateyConfigurati (s, e) => { var logMessage = e.Data; - if (string.IsNullOrWhiteSpace(logMessage)) return; + if (string.IsNullOrWhiteSpace(logMessage)) + { + return; + } + this.Log().Error("[{0}] {1}".FormatWith(AppName, logMessage.EscapeCurlyBraces())); if (_errorRegex.IsMatch(logMessage) || _errorNotFoundRegex.IsMatch(logMessage)) @@ -438,7 +466,11 @@ public ConcurrentDictionary Upgrade(ChocolateyConfigurati (s, e) => { var logMessage = e.Data; - if (string.IsNullOrWhiteSpace(logMessage)) return; + if (string.IsNullOrWhiteSpace(logMessage)) + { + return; + } + this.Log().Info(() => " [{0}] {1}".FormatWith(AppName, logMessage.EscapeCurlyBraces())); if (_errorRegex.IsMatch(logMessage) || _errorNotFoundRegex.IsMatch(logMessage)) @@ -458,7 +490,11 @@ public ConcurrentDictionary Upgrade(ChocolateyConfigurati (s, e) => { var logMessage = e.Data; - if (string.IsNullOrWhiteSpace(logMessage)) return; + if (string.IsNullOrWhiteSpace(logMessage)) + { + return; + } + this.Log().Error("[{0}] {1}".FormatWith(AppName, logMessage.EscapeCurlyBraces())); if (_errorRegex.IsMatch(logMessage) || _errorNotFoundRegex.IsMatch(logMessage)) @@ -505,7 +541,11 @@ public ConcurrentDictionary Uninstall(ChocolateyConfigura (s, e) => { var logMessage = e.Data; - if (string.IsNullOrWhiteSpace(logMessage)) return; + if (string.IsNullOrWhiteSpace(logMessage)) + { + return; + } + this.Log().Info(() => " [{0}] {1}".FormatWith(AppName, logMessage.EscapeCurlyBraces())); if (_errorRegex.IsMatch(logMessage) || _errorNotFoundRegex.IsMatch(logMessage)) @@ -525,7 +565,11 @@ public ConcurrentDictionary Uninstall(ChocolateyConfigura (s, e) => { var logMessage = e.Data; - if (string.IsNullOrWhiteSpace(logMessage)) return; + if (string.IsNullOrWhiteSpace(logMessage)) + { + return; + } + this.Log().Error("[{0}] {1}".FormatWith(AppName, logMessage.EscapeCurlyBraces())); if (_errorRegex.IsMatch(logMessage) || _errorNotFoundRegex.IsMatch(logMessage)) diff --git a/src/chocolatey/infrastructure.app/services/RegistryService.cs b/src/chocolatey/infrastructure.app/services/RegistryService.cs index 07813b36b2..9238a7ad65 100644 --- a/src/chocolatey/infrastructure.app/services/RegistryService.cs +++ b/src/chocolatey/infrastructure.app/services/RegistryService.cs @@ -64,14 +64,20 @@ private RegistryKey OpenKey(RegistryHive hive, RegistryView view) private void AddKey(IList keys, RegistryHive hive, RegistryView view) { var key = OpenKey(hive, view); - if (key != null) keys.Add(key); + if (key != null) + { + keys.Add(key); + } } public Registry GetInstallerKeys() { var snapshot = new Registry(); var windowsIdentity = WindowsIdentity.GetCurrent(); - if (windowsIdentity != null) snapshot.User = windowsIdentity.User.ToStringSafe(); + if (windowsIdentity != null) + { + snapshot.User = windowsIdentity.User.ToStringSafe(); + } IList keys = new List(); if (Environment.Is64BitOperatingSystem) @@ -120,7 +126,10 @@ public Registry GetInstallerKeys() /// The snapshot. public void UpdateSnapshot(RegistryKey key, Registry snapshot) { - if (key == null) return; + if (key == null) + { + return; + } FaultTolerance.TryCatchWithLoggingException( () => @@ -251,7 +260,10 @@ public void UpdateSnapshot(RegistryKey key, Registry snapshot) private void GetMsiInformation(RegistryApplicationKey appKey, RegistryKey key) { var userDataProductKeyId = GetMsiUserDataKey(key.Name); - if (string.IsNullOrWhiteSpace(userDataProductKeyId)) return; + if (string.IsNullOrWhiteSpace(userDataProductKeyId)) + { + return; + } var hklm = OpenKey(RegistryHive.LocalMachine, RegistryView.Default); if (Environment.Is64BitOperatingSystem) @@ -263,7 +275,10 @@ private void GetMsiInformation(RegistryApplicationKey appKey, RegistryKey key) () => { var msiRegistryKey = hklm.OpenSubKey(UninstallerMsiMachineKeyName, RegistryKeyPermissionCheck.ReadSubTree, RegistryRights.ReadKey); - if (msiRegistryKey == null) return; + if (msiRegistryKey == null) + { + return; + } foreach (var subKeyName in msiRegistryKey.GetSubKeyNames()) { @@ -271,7 +286,10 @@ private void GetMsiInformation(RegistryApplicationKey appKey, RegistryKey key) () => msiRegistryKey.OpenSubKey("{0}\\Products\\{1}\\InstallProperties".FormatWith(subKeyName, userDataProductKeyId), RegistryKeyPermissionCheck.ReadSubTree, RegistryRights.ReadKey), "Failed to open subkey named '{0}' for '{1}', likely due to permissions".FormatWith(subKeyName, msiRegistryKey.Name), logWarningInsteadOfError: true); - if (msiProductKey == null) continue; + if (msiProductKey == null) + { + continue; + } appKey.InstallLocation = SetIfEmpty(appKey.InstallLocation, msiProductKey.AsXmlSafeString("InstallLocation")); // informational @@ -322,7 +340,10 @@ private void GetMsiInformation(RegistryApplicationKey appKey, RegistryKey key) private string SetIfEmpty(string current, string proposed) { - if (string.IsNullOrWhiteSpace(current)) return proposed; + if (string.IsNullOrWhiteSpace(current)) + { + return proposed; + } return current; } @@ -335,7 +356,10 @@ private string GetMsiUserDataKey(string name) { _userDataKey.Clear(); var match = _guidRegex.Match(name); - if (!match.Success) return string.Empty; + if (!match.Success) + { + return string.Empty; + } for (int i = 0; i < 3; i++) { @@ -508,7 +532,10 @@ public static GenericRegistryValue GetRegistryValue(RegistryHiveType hive, strin "Could not get registry value '{0}' from key '{1}'".FormatWith(registryValue, key.Name), logWarningInsteadOfError: true); - if (value != null) break; + if (value != null) + { + break; + } } } } diff --git a/src/chocolatey/infrastructure.app/services/RubyGemsService.cs b/src/chocolatey/infrastructure.app/services/RubyGemsService.cs index 9b4c8fdfa9..76d8dfcca3 100644 --- a/src/chocolatey/infrastructure.app/services/RubyGemsService.cs +++ b/src/chocolatey/infrastructure.app/services/RubyGemsService.cs @@ -116,7 +116,10 @@ public string SourceType public void EnsureSourceAppInstalled(ChocolateyConfiguration config, Action ensureAction) { - if (Platform.GetPlatform() != PlatformType.Windows) throw new NotImplementedException("This source is not supported on non-Windows systems"); + if (Platform.GetPlatform() != PlatformType.Windows) + { + throw new NotImplementedException("This source is not supported on non-Windows systems"); + } var runnerConfig = new ChocolateyConfiguration { @@ -165,7 +168,11 @@ public IEnumerable List(ChocolateyConfiguration config) stdOutAction: (s, e) => { var logMessage = e.Data; - if (string.IsNullOrWhiteSpace(logMessage)) return; + if (string.IsNullOrWhiteSpace(logMessage)) + { + return; + } + if (!config.QuietOutput) { this.Log().Info(logMessage.EscapeCurlyBraces()); @@ -177,7 +184,11 @@ public IEnumerable List(ChocolateyConfiguration config) }, stdErrAction: (s, e) => { - if (string.IsNullOrWhiteSpace(e.Data)) return; + if (string.IsNullOrWhiteSpace(e.Data)) + { + return; + } + this.Log().Error(() => "{0}".FormatWith(e.Data.EscapeCurlyBraces())); }, updateProcessPath: false @@ -213,7 +224,11 @@ public ConcurrentDictionary Install(ChocolateyConfigurati (s, e) => { var logMessage = e.Data; - if (string.IsNullOrWhiteSpace(logMessage)) return; + if (string.IsNullOrWhiteSpace(logMessage)) + { + return; + } + this.Log().Info(() => " [{0}] {1}".FormatWith(AppName, logMessage.EscapeCurlyBraces())); if (_installingRegex.IsMatch(logMessage)) @@ -238,7 +253,11 @@ public ConcurrentDictionary Install(ChocolateyConfigurati (s, e) => { var logMessage = e.Data; - if (string.IsNullOrWhiteSpace(logMessage)) return; + if (string.IsNullOrWhiteSpace(logMessage)) + { + return; + } + this.Log().Error("[{0}] {1}".FormatWith(AppName, logMessage.EscapeCurlyBraces())); var packageName = GetValueFromOutput(logMessage, _packageNameErrorRegex, PackageNameGroup); diff --git a/src/chocolatey/infrastructure.app/services/ShimGenerationService.cs b/src/chocolatey/infrastructure.app/services/ShimGenerationService.cs index fcc388d7c3..42a8c8404c 100644 --- a/src/chocolatey/infrastructure.app/services/ShimGenerationService.cs +++ b/src/chocolatey/infrastructure.app/services/ShimGenerationService.cs @@ -91,7 +91,11 @@ public void Install(ChocolateyConfiguration configuration, PackageResult package var exeFiles = _fileSystem.GetFiles(packageResult.InstallLocation, pattern: "*.exe", option: SearchOption.AllDirectories); foreach (string file in exeFiles.OrEmpty()) { - if (_fileSystem.FileExists(file + ".ignore")) continue; + if (_fileSystem.FileExists(file + ".ignore")) + { + continue; + } + bool isGui = _fileSystem.FileExists(file + ".gui"); //todo: #2586 v2 be able to determine gui automatically @@ -107,12 +111,20 @@ public void Install(ChocolateyConfiguration configuration, PackageResult package _shimGenExePath, argsForPackage, configuration.CommandExecutionTimeoutSeconds, (s, e) => { - if (string.IsNullOrWhiteSpace(e.Data)) return; + if (string.IsNullOrWhiteSpace(e.Data)) + { + return; + } + this.Log().Debug(() => " [ShimGen] {0}".FormatWith(e.Data.EscapeCurlyBraces())); }, (s, e) => { - if (string.IsNullOrWhiteSpace(e.Data)) return; + if (string.IsNullOrWhiteSpace(e.Data)) + { + return; + } + this.Log().Error(() => " [ShimGen] {0}".FormatWith(e.Data.EscapeCurlyBraces())); }, updateProcessPath: true @@ -136,7 +148,10 @@ public void Uninstall(ChocolateyConfiguration configuration, PackageResult packa var exeFiles = _fileSystem.GetFiles(packageResult.InstallLocation, pattern: "*.exe", option: SearchOption.AllDirectories); foreach (string file in exeFiles.OrEmpty()) { - if (_fileSystem.FileExists(file + ".ignore")) continue; + if (_fileSystem.FileExists(file + ".ignore")) + { + continue; + } var shimLocation = _fileSystem.CombinePaths(ApplicationParameters.ShimsLocation, _fileSystem.GetFileName(file)); this.Log().Debug(() => "Removing shim for {0} at '{1}".FormatWith(_fileSystem.GetFileName(file), shimLocation)); diff --git a/src/chocolatey/infrastructure.app/services/TemplateService.cs b/src/chocolatey/infrastructure.app/services/TemplateService.cs index 5a88c9d377..f8e7ca080a 100644 --- a/src/chocolatey/infrastructure.app/services/TemplateService.cs +++ b/src/chocolatey/infrastructure.app/services/TemplateService.cs @@ -65,7 +65,10 @@ public void GenerateDryRun(ChocolateyConfiguration configuration) public void Generate(ChocolateyConfiguration configuration) { var logger = ChocolateyLoggers.Normal; - if (configuration.QuietOutput) logger = ChocolateyLoggers.LogFileOnly; + if (configuration.QuietOutput) + { + logger = ChocolateyLoggers.LogFileOnly; + } var packageLocation = _fileSystem.CombinePaths(configuration.OutputDirectory ?? _fileSystem.GetCurrentDirectory(), configuration.NewCommand.Name); if (_fileSystem.DirectoryExists(packageLocation) && !configuration.Force) @@ -74,21 +77,31 @@ public void Generate(ChocolateyConfiguration configuration) "The location for the template already exists. You can:{0} 1. Remove '{1}'{0} 2. Use --force{0} 3. Specify a different name".FormatWith(Environment.NewLine, packageLocation)); } - if (configuration.RegularOutput) this.Log().Info(logger, () => "Creating a new package specification at {0}".FormatWith(packageLocation)); + if (configuration.RegularOutput) + { + this.Log().Info(logger, () => "Creating a new package specification at {0}".FormatWith(packageLocation)); + } + try { _fileSystem.DeleteDirectoryChecked(packageLocation, recursive: true); } catch (Exception ex) { - if (configuration.RegularOutput) this.Log().Warn(() => "{0}".FormatWith(ex.Message)); + if (configuration.RegularOutput) + { + this.Log().Warn(() => "{0}".FormatWith(ex.Message)); + } } _fileSystem.EnsureDirectoryExists(packageLocation); var packageToolsLocation = _fileSystem.CombinePaths(packageLocation, "tools"); _fileSystem.EnsureDirectoryExists(packageToolsLocation); var tokens = new TemplateValues(); - if (configuration.NewCommand.AutomaticPackage) tokens.SetAutomatic(); + if (configuration.NewCommand.AutomaticPackage) + { + tokens.SetAutomatic(); + } // now override those values foreach (var property in configuration.NewCommand.TemplateProperties) @@ -100,7 +113,11 @@ public void Generate(ChocolateyConfiguration configuration) } catch (Exception) { - if (configuration.RegularOutput) this.Log().Debug("Property {0} will be added to additional properties.".FormatWith(property.Key)); + if (configuration.RegularOutput) + { + this.Log().Debug("Property {0} will be added to additional properties.".FormatWith(property.Key)); + } + tokens.AdditionalProperties.Add(property.Key, property.Value); } } @@ -154,7 +171,10 @@ public void Generate(ChocolateyConfiguration configuration) var templatePath = _fileSystem.CombinePaths(ApplicationParameters.TemplatesLocation, configuration.NewCommand.TemplateName); var templateParameterCachePath = _fileSystem.CombinePaths(templatePath, _templateParameterCacheFilename); - if (!_fileSystem.DirectoryExists(templatePath)) throw new ApplicationException("Unable to find path to requested template '{0}'. Path should be '{1}'".FormatWith(configuration.NewCommand.TemplateName, templatePath)); + if (!_fileSystem.DirectoryExists(templatePath)) + { + throw new ApplicationException("Unable to find path to requested template '{0}'. Path should be '{1}'".FormatWith(configuration.NewCommand.TemplateName, templatePath)); + } this.Log().Info(configuration.QuietOutput ? logger : ChocolateyLoggers.Important, "Generating package from custom template at '{0}'.".FormatWith(templatePath)); @@ -201,7 +221,11 @@ public void GenerateFileFromTemplate(ChocolateyConfiguration configuration, Temp template = TokenReplacer.ReplaceTokens(tokens, template); template = TokenReplacer.ReplaceTokens(tokens.AdditionalProperties, template); - if (configuration.RegularOutput) this.Log().Info(() => "Generating template to a file{0} at '{1}'".FormatWith(Environment.NewLine, fileLocation)); + if (configuration.RegularOutput) + { + this.Log().Info(() => "Generating template to a file{0} at '{1}'".FormatWith(Environment.NewLine, fileLocation)); + } + this.Log().Debug(() => "{0}".FormatWith(template)); _fileSystem.EnsureDirectoryExists(_fileSystem.GetDirectoryName(fileLocation)); _fileSystem.WriteFile(fileLocation, template, encoding); diff --git a/src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs b/src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs index 5aed4c7033..a531400aac 100644 --- a/src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs +++ b/src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs @@ -158,14 +158,20 @@ public string SourceType public void EnsureSourceAppInstalled(ChocolateyConfiguration config, Action ensureAction) { - if (Platform.GetPlatform() != PlatformType.Windows) throw new NotImplementedException("This source is not supported on non-Windows systems"); + if (Platform.GetPlatform() != PlatformType.Windows) + { + throw new NotImplementedException("This source is not supported on non-Windows systems"); + } EnsureExecutablePathSet(); } private void EnsureExecutablePathSet() { - if (!string.IsNullOrWhiteSpace(_exePath)) return; + if (!string.IsNullOrWhiteSpace(_exePath)) + { + return; + } foreach (var location in _exeLocations) { @@ -176,7 +182,10 @@ private void EnsureExecutablePathSet() } } - if (string.IsNullOrWhiteSpace(_exePath)) throw new FileNotFoundException("Unable to find suitable location for the executable. Searched the following locations: '{0}'".FormatWith(string.Join("; ", _exeLocations))); + if (string.IsNullOrWhiteSpace(_exePath)) + { + throw new FileNotFoundException("Unable to find suitable location for the executable. Searched the following locations: '{0}'".FormatWith(string.Join("; ", _exeLocations))); + } } public void ListDryRun(ChocolateyConfiguration config) @@ -200,7 +209,11 @@ public IEnumerable List(ChocolateyConfiguration config) stdOutAction: (s, e) => { var logMessage = e.Data; - if (string.IsNullOrWhiteSpace(logMessage)) return; + if (string.IsNullOrWhiteSpace(logMessage)) + { + return; + } + if (!config.QuietOutput) { this.Log().Info(logMessage.EscapeCurlyBraces()); @@ -212,7 +225,11 @@ public IEnumerable List(ChocolateyConfiguration config) }, stdErrAction: (s, e) => { - if (string.IsNullOrWhiteSpace(e.Data)) return; + if (string.IsNullOrWhiteSpace(e.Data)) + { + return; + } + this.Log().Error(() => "{0}".FormatWith(e.Data.EscapeCurlyBraces())); }, updateProcessPath: false, @@ -297,7 +314,11 @@ public ConcurrentDictionary Install(ChocolateyConfigurati (s, e) => { var logMessage = e.Data; - if (string.IsNullOrWhiteSpace(logMessage)) return; + if (string.IsNullOrWhiteSpace(logMessage)) + { + return; + } + this.Log().Info(() => " [{0}] {1}".FormatWith(AppName, logMessage.EscapeCurlyBraces())); if (_errorRegex.IsMatch(logMessage) || _errorNotFoundRegex.IsMatch(logMessage)) @@ -314,7 +335,11 @@ public ConcurrentDictionary Install(ChocolateyConfigurati (s, e) => { var logMessage = e.Data; - if (string.IsNullOrWhiteSpace(logMessage)) return; + if (string.IsNullOrWhiteSpace(logMessage)) + { + return; + } + this.Log().Error("[{0}] {1}".FormatWith(AppName, logMessage.EscapeCurlyBraces())); results.Messages.Add(new ResultMessage(ResultType.Error, logMessage)); @@ -368,7 +393,11 @@ public ConcurrentDictionary Uninstall(ChocolateyConfigura (s, e) => { var logMessage = e.Data; - if (string.IsNullOrWhiteSpace(logMessage)) return; + if (string.IsNullOrWhiteSpace(logMessage)) + { + return; + } + this.Log().Info(() => " [{0}] {1}".FormatWith(AppName, logMessage.EscapeCurlyBraces())); if (_errorRegex.IsMatch(logMessage) || _errorNotFoundRegex.IsMatch(logMessage)) @@ -385,7 +414,11 @@ public ConcurrentDictionary Uninstall(ChocolateyConfigura (s, e) => { var logMessage = e.Data; - if (string.IsNullOrWhiteSpace(logMessage)) return; + if (string.IsNullOrWhiteSpace(logMessage)) + { + return; + } + this.Log().Error("[{0}] {1}".FormatWith(AppName, logMessage.EscapeCurlyBraces())); results.Messages.Add(new ResultMessage(ResultType.Error, logMessage)); diff --git a/src/chocolatey/infrastructure.app/tasks/RemovePendingPackagesTask.cs b/src/chocolatey/infrastructure.app/tasks/RemovePendingPackagesTask.cs index 259d6ec796..95ca978a16 100644 --- a/src/chocolatey/infrastructure.app/tasks/RemovePendingPackagesTask.cs +++ b/src/chocolatey/infrastructure.app/tasks/RemovePendingPackagesTask.cs @@ -53,7 +53,10 @@ public void Initialize() public void Shutdown() { - if (_subscription != null) _subscription.Dispose(); + if (_subscription != null) + { + _subscription.Dispose(); + } } private void HandleMessage(PreRunMessage message) diff --git a/src/chocolatey/infrastructure.app/utility/PackageUtility.cs b/src/chocolatey/infrastructure.app/utility/PackageUtility.cs index 87dbf23af0..fdbbe23ec0 100644 --- a/src/chocolatey/infrastructure.app/utility/PackageUtility.cs +++ b/src/chocolatey/infrastructure.app/utility/PackageUtility.cs @@ -30,8 +30,15 @@ public class PackageUtility /// true if the package is a dependency, false if the package is the one specified or a virtual/semi-virtual public static bool PackageIdHasDependencySuffix(ChocolateyConfiguration config, string packageName) { - if (string.IsNullOrWhiteSpace(config.PackageNames)) return true; - if (string.IsNullOrWhiteSpace(packageName)) return true; + if (string.IsNullOrWhiteSpace(config.PackageNames)) + { + return true; + } + + if (string.IsNullOrWhiteSpace(packageName)) + { + return true; + } foreach (var package in config.PackageNames.Split(new[] { ApplicationParameters.PackageNamesSeparator }, StringSplitOptions.RemoveEmptyEntries).OrEmpty()) { diff --git a/src/chocolatey/infrastructure/adapters/Console.cs b/src/chocolatey/infrastructure/adapters/Console.cs index 413a963346..90bc8802a6 100644 --- a/src/chocolatey/infrastructure/adapters/Console.cs +++ b/src/chocolatey/infrastructure/adapters/Console.cs @@ -30,28 +30,40 @@ public sealed class Console : IConsole { public string ReadLine() { - if (!ApplicationParameters.AllowPrompts) return string.Empty; + if (!ApplicationParameters.AllowPrompts) + { + return string.Empty; + } return System.Console.ReadLine(); } public string ReadLine(int timeoutMilliseconds) { - if (!ApplicationParameters.AllowPrompts) return string.Empty; + if (!ApplicationParameters.AllowPrompts) + { + return string.Empty; + } return ReadLineTimeout.Read(timeoutMilliseconds); } public System.ConsoleKeyInfo ReadKey(bool intercept) { - if (!ApplicationParameters.AllowPrompts) return new System.ConsoleKeyInfo('\0', ConsoleKey.Enter, false, false, false); + if (!ApplicationParameters.AllowPrompts) + { + return new System.ConsoleKeyInfo('\0', ConsoleKey.Enter, false, false, false); + } return System.Console.ReadKey(intercept); } public System.ConsoleKeyInfo ReadKey(int timeoutMilliseconds) { - if (!ApplicationParameters.AllowPrompts) return new System.ConsoleKeyInfo('\0', ConsoleKey.Enter, false, false, false); + if (!ApplicationParameters.AllowPrompts) + { + return new System.ConsoleKeyInfo('\0', ConsoleKey.Enter, false, false, false); + } return ReadKeyTimeout.ReadKey(timeoutMilliseconds); } @@ -79,13 +91,19 @@ public System.ConsoleColor BackgroundColor { get { - if (!IsOutputRedirected) return System.Console.BackgroundColor; + if (!IsOutputRedirected) + { + return System.Console.BackgroundColor; + } return System.ConsoleColor.Black; } set { - if (!IsOutputRedirected) System.Console.BackgroundColor = value; + if (!IsOutputRedirected) + { + System.Console.BackgroundColor = value; + } } } @@ -93,13 +111,19 @@ public System.ConsoleColor ForegroundColor { get { - if (!IsOutputRedirected) return System.Console.ForegroundColor; + if (!IsOutputRedirected) + { + return System.Console.ForegroundColor; + } return System.ConsoleColor.Gray; } set { - if (!IsOutputRedirected) System.Console.ForegroundColor = value; + if (!IsOutputRedirected) + { + System.Console.ForegroundColor = value; + } } } @@ -107,13 +131,19 @@ public int BufferWidth { get { - if (!IsOutputRedirected) return System.Console.BufferWidth; + if (!IsOutputRedirected) + { + return System.Console.BufferWidth; + } return GetConsoleBuffer().dwSize.X; //the current console window width } set { - if (!IsOutputRedirected) System.Console.BufferWidth = value; + if (!IsOutputRedirected) + { + System.Console.BufferWidth = value; + } } } @@ -121,32 +151,47 @@ public int BufferHeight { get { - if (!IsOutputRedirected) return System.Console.BufferHeight; + if (!IsOutputRedirected) + { + return System.Console.BufferHeight; + } return GetConsoleBuffer().dwSize.Y; //the current console window height } set { - if (!IsOutputRedirected) System.Console.BufferHeight = value; + if (!IsOutputRedirected) + { + System.Console.BufferHeight = value; + } } } public void SetBufferSize(int width, int height) { - if (!IsOutputRedirected) System.Console.SetBufferSize(width, height); + if (!IsOutputRedirected) + { + System.Console.SetBufferSize(width, height); + } } public string Title { get { - if (!IsOutputRedirected) return System.Console.Title; + if (!IsOutputRedirected) + { + return System.Console.Title; + } return string.Empty; } set { - if (!IsOutputRedirected) System.Console.Title = value; + if (!IsOutputRedirected) + { + System.Console.Title = value; + } } } @@ -154,7 +199,10 @@ public bool KeyAvailable { get { - if (!IsOutputRedirected) return System.Console.KeyAvailable; + if (!IsOutputRedirected) + { + return System.Console.KeyAvailable; + } return false; } @@ -164,13 +212,19 @@ public int CursorSize { get { - if (!IsOutputRedirected) return System.Console.CursorSize; + if (!IsOutputRedirected) + { + return System.Console.CursorSize; + } return GetConsoleBuffer().dwCursorPosition.Y; } set { - if (!IsOutputRedirected) System.Console.CursorSize = value; + if (!IsOutputRedirected) + { + System.Console.CursorSize = value; + } } } @@ -178,7 +232,10 @@ public int LargestWindowWidth { get { - if (!IsOutputRedirected) return System.Console.LargestWindowWidth; + if (!IsOutputRedirected) + { + return System.Console.LargestWindowWidth; + } return GetConsoleBuffer().dwMaximumWindowSize.X; //the max console window width } @@ -188,7 +245,10 @@ public int LargestWindowHeight { get { - if (!IsOutputRedirected) return System.Console.LargestWindowHeight; + if (!IsOutputRedirected) + { + return System.Console.LargestWindowHeight; + } return GetConsoleBuffer().dwMaximumWindowSize.Y; //the max console window height } @@ -198,13 +258,19 @@ public int WindowWidth { get { - if (!IsOutputRedirected) return System.Console.WindowWidth; + if (!IsOutputRedirected) + { + return System.Console.WindowWidth; + } return GetConsoleBuffer().dwSize.X; //the current console window width } set { - if (!IsOutputRedirected) System.Console.WindowWidth = value; + if (!IsOutputRedirected) + { + System.Console.WindowWidth = value; + } } } @@ -212,32 +278,47 @@ public int WindowHeight { get { - if (!IsOutputRedirected) return System.Console.WindowHeight; + if (!IsOutputRedirected) + { + return System.Console.WindowHeight; + } return GetConsoleBuffer().dwSize.Y; //the current console window height } set { - if (!IsOutputRedirected) System.Console.WindowHeight = value; + if (!IsOutputRedirected) + { + System.Console.WindowHeight = value; + } } } public void SetWindowSize(int width, int height) { - if (!IsOutputRedirected) System.Console.SetWindowSize(width, height); + if (!IsOutputRedirected) + { + System.Console.SetWindowSize(width, height); + } } public int WindowLeft { get { - if (!IsOutputRedirected) return System.Console.WindowLeft; + if (!IsOutputRedirected) + { + return System.Console.WindowLeft; + } return GetConsoleBuffer().srWindow.Left; } set { - if (!IsOutputRedirected) System.Console.WindowLeft = value; + if (!IsOutputRedirected) + { + System.Console.WindowLeft = value; + } } } @@ -245,19 +326,28 @@ public int WindowTop { get { - if (!IsOutputRedirected) return System.Console.WindowTop; + if (!IsOutputRedirected) + { + return System.Console.WindowTop; + } return GetConsoleBuffer().srWindow.Top; } set { - if (!IsOutputRedirected) System.Console.WindowTop = value; + if (!IsOutputRedirected) + { + System.Console.WindowTop = value; + } } } public void SetWindowPosition(int width, int height) { - if (!IsOutputRedirected) System.Console.SetWindowPosition(width, height); + if (!IsOutputRedirected) + { + System.Console.SetWindowPosition(width, height); + } } /// @@ -267,7 +357,10 @@ public bool IsOutputRedirected { get { - if (!IsWindows()) return false; + if (!IsWindows()) + { + return false; + } return FileType.Char != GetFileType(GetStdHandle(StdHandle.StdOut)); } @@ -280,7 +373,10 @@ public bool IsErrorRedirected { get { - if (!IsWindows()) return false; + if (!IsWindows()) + { + return false; + } return FileType.Char != GetFileType(GetStdHandle(StdHandle.StdErr)); } @@ -293,7 +389,10 @@ public bool IsInputRedirected { get { - if (!IsWindows()) return false; + if (!IsWindows()) + { + return false; + } return FileType.Char != GetFileType(GetStdHandle(StdHandle.StdIn)); } @@ -315,7 +414,10 @@ private CONSOLE_SCREEN_BUFFER_INFO GetConsoleBuffer() wAttributes = 0, }; - if (!IsWindows()) return defaultConsoleBuffer; + if (!IsWindows()) + { + return defaultConsoleBuffer; + } CONSOLE_SCREEN_BUFFER_INFO csbi; if (GetConsoleScreenBufferInfo(GetStdHandle(StdHandle.StdOut), out csbi)) diff --git a/src/chocolatey/infrastructure/adapters/Environment.cs b/src/chocolatey/infrastructure/adapters/Environment.cs index 26df791377..5356f8f6e1 100644 --- a/src/chocolatey/infrastructure/adapters/Environment.cs +++ b/src/chocolatey/infrastructure/adapters/Environment.cs @@ -63,7 +63,10 @@ public string CurrentDirectory public string ExpandEnvironmentVariables(string name) { - if (string.IsNullOrWhiteSpace(name)) return name; + if (string.IsNullOrWhiteSpace(name)) + { + return name; + } return System.Environment.ExpandEnvironmentVariables(name); } diff --git a/src/chocolatey/infrastructure/commandline/ExitScenarioHandler.cs b/src/chocolatey/infrastructure/commandline/ExitScenarioHandler.cs index 641fa1afe2..037a548849 100644 --- a/src/chocolatey/infrastructure/commandline/ExitScenarioHandler.cs +++ b/src/chocolatey/infrastructure/commandline/ExitScenarioHandler.cs @@ -48,7 +48,10 @@ private enum SignalControlType public static void SetHandler() { - if (Platform.GetPlatform() != PlatformType.Windows) return; + if (Platform.GetPlatform() != PlatformType.Windows) + { + return; + } _handler += Handler; SetConsoleCtrlHandler(_handler, true); diff --git a/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs b/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs index 6d179255b5..a87abf30b9 100644 --- a/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs +++ b/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs @@ -43,7 +43,11 @@ private static IConsole Console public static string PromptForConfirmation(string prompt, IEnumerable choices, string defaultChoice, bool requireAnswer, bool allowShortAnswer = true, bool shortPrompt = false, int repeat = 10, int timeoutInSeconds = 0) { - if (repeat < 0) throw new ApplicationException("Too many bad attempts. Stopping before application crash."); + if (repeat < 0) + { + throw new ApplicationException("Too many bad attempts. Stopping before application crash."); + } + Ensure.That(() => prompt).NotNull(); Ensure.That(() => choices).NotNull(); Ensure @@ -106,7 +110,11 @@ public static string PromptForConfirmation(string prompt, IEnumerable ch "[{0}]{1}".FormatWith(choice.Substring(0,1).ToUpperInvariant(), choice.Substring(1, choice.Length - 1)) : choice; - if (counter != 1) Console.Write("/"); + if (counter != 1) + { + Console.Write("/"); + } + Console.Write(choicePrompt); } @@ -116,7 +124,10 @@ public static string PromptForConfirmation(string prompt, IEnumerable ch Console.Write(shortPrompt ? "): " : "> "); var selection = timeoutInSeconds == 0 ? Console.ReadLine() : Console.ReadLine(timeoutInSeconds * 1000); - if (shortPrompt) Console.WriteLine(); + if (shortPrompt) + { + Console.WriteLine(); + } if (string.IsNullOrWhiteSpace(selection) && !string.IsNullOrWhiteSpace(defaultChoice)) { @@ -189,7 +200,11 @@ public static string GetPassword(bool interactive) info = possibleNonInteractive ? Console.ReadKey(TimeoutInSeconds * 1000) : Console.ReadKey(true); } } - for (int i = 0; i < password.Length; i++) Console.Write("*"); + for (int i = 0; i < password.Length; i++) + { + Console.Write("*"); + } + System.Console.WriteLine(""); return password; diff --git a/src/chocolatey/infrastructure/commandline/ReadKeyTimeout.cs b/src/chocolatey/infrastructure/commandline/ReadKeyTimeout.cs index df8a7ffe02..0444d5b12f 100644 --- a/src/chocolatey/infrastructure/commandline/ReadKeyTimeout.cs +++ b/src/chocolatey/infrastructure/commandline/ReadKeyTimeout.cs @@ -69,7 +69,10 @@ public static ConsoleKeyInfo ReadKey(int timeoutMilliseconds) public void Dispose() { - if (_isDisposing) return; + if (_isDisposing) + { + return; + } _isDisposing = true; _responseThread.Abort(); diff --git a/src/chocolatey/infrastructure/commandline/ReadLineTimeout.cs b/src/chocolatey/infrastructure/commandline/ReadLineTimeout.cs index 02e3257089..8db9211e38 100644 --- a/src/chocolatey/infrastructure/commandline/ReadLineTimeout.cs +++ b/src/chocolatey/infrastructure/commandline/ReadLineTimeout.cs @@ -69,7 +69,10 @@ public static string Read(int timeoutMilliseconds) public void Dispose() { - if (_isDisposing) return; + if (_isDisposing) + { + return; + } _isDisposing = true; _responseThread.Abort(); diff --git a/src/chocolatey/infrastructure/commands/CommandExecutor.cs b/src/chocolatey/infrastructure/commands/CommandExecutor.cs index 371df94c36..c8e576537f 100644 --- a/src/chocolatey/infrastructure/commands/CommandExecutor.cs +++ b/src/chocolatey/infrastructure/commands/CommandExecutor.cs @@ -245,12 +245,18 @@ bool waitForExit private static void LogOutput(object sender, DataReceivedEventArgs e) { - if (e != null) "chocolatey".Log().Info(e.Data.EscapeCurlyBraces()); + if (e != null) + { + "chocolatey".Log().Info(e.Data.EscapeCurlyBraces()); + } } private static void LogError(object sender, DataReceivedEventArgs e) { - if (e != null) "chocolatey".Log().Error(e.Data.EscapeCurlyBraces()); + if (e != null) + { + "chocolatey".Log().Error(e.Data.EscapeCurlyBraces()); + } } diff --git a/src/chocolatey/infrastructure/commands/Execute.cs b/src/chocolatey/infrastructure/commands/Execute.cs index 819af1934f..77f01a5d68 100644 --- a/src/chocolatey/infrastructure/commands/Execute.cs +++ b/src/chocolatey/infrastructure/commands/Execute.cs @@ -62,7 +62,10 @@ private Execute(TimeSpan timespan) /// The results of the function if completes within timespan, otherwise returns the default value. public T Command(Func function, T timeoutDefaultValue) { - if (function == null) return timeoutDefaultValue; + if (function == null) + { + return timeoutDefaultValue; + } var cancelToken = new CancellationTokenSource(); cancelToken.Token.ThrowIfCancellationRequested(); @@ -78,7 +81,10 @@ public T Command(Func function, T timeoutDefaultValue) task.Wait(_timespan); } - if (task.IsCompleted) return task.Result; + if (task.IsCompleted) + { + return task.Result; + } cancelToken.Cancel(); this.Log().Warn(ChocolateyLoggers.Important,() => @"Chocolatey timed out waiting for the command to finish. The timeout @@ -104,7 +110,10 @@ public T Command(Func function, T timeoutDefaultValue) /// True if it finishes executing, false otherwise. public bool Command(Action action) { - if (action == null) return false; + if (action == null) + { + return false; + } var completed = false; diff --git a/src/chocolatey/infrastructure/commands/ExternalCommandArgsBuilder.cs b/src/chocolatey/infrastructure/commands/ExternalCommandArgsBuilder.cs index 4ce26c46b9..e2c3ff8210 100644 --- a/src/chocolatey/infrastructure/commands/ExternalCommandArgsBuilder.cs +++ b/src/chocolatey/infrastructure/commands/ExternalCommandArgsBuilder.cs @@ -62,7 +62,10 @@ public static string BuildArguments(object properties, IDictionary propertyValues foreach (var prop in properties.OrEmpty()) { //todo: #2587 need a better way of handling - if (prop.Name == "MachineSources") continue; + if (prop.Name == "MachineSources") + { + continue; + } if (prop.PropertyType.IsBuiltinType()) { diff --git a/src/chocolatey/infrastructure/commands/PowershellExecutor.cs b/src/chocolatey/infrastructure/commands/PowershellExecutor.cs index 2f1bf137c9..93cef52d15 100644 --- a/src/chocolatey/infrastructure/commands/PowershellExecutor.cs +++ b/src/chocolatey/infrastructure/commands/PowershellExecutor.cs @@ -53,7 +53,10 @@ public static int Execute( Action stdErrAction ) { - if (string.IsNullOrWhiteSpace(_powershell)) _powershell = GetPowerShellLocation(fileSystem); + if (string.IsNullOrWhiteSpace(_powershell)) + { + _powershell = GetPowerShellLocation(fileSystem); + } //-NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%DIR%chocolatey.ps1' %PS_ARGS%" string arguments = "-NoProfile -NoLogo -ExecutionPolicy Bypass -Command \"{0}\"".FormatWith(command); diff --git a/src/chocolatey/infrastructure/cryptography/CryptoHashProvider.cs b/src/chocolatey/infrastructure/cryptography/CryptoHashProvider.cs index 0d43aa50f2..2dbccd20a4 100644 --- a/src/chocolatey/infrastructure/cryptography/CryptoHashProvider.cs +++ b/src/chocolatey/infrastructure/cryptography/CryptoHashProvider.cs @@ -86,7 +86,10 @@ public CryptoHashProvider(IFileSystem fileSystem, IHashAlgorithm hashAlgorithm) public string ComputeFileHash(string filePath) { - if (!_fileSystem.FileExists(filePath)) return string.Empty; + if (!_fileSystem.FileExists(filePath)) + { + return string.Empty; + } try { @@ -136,9 +139,12 @@ private static bool IsFileLocked(Exception exception) public static string ComputeStringHash(string originalText, CryptoHashProviderType providerType) { IHashAlgorithm hashAlgorithm = GetHashAlgorithmStatic(providerType); - if (hashAlgorithm == null) return string.Empty; + if (hashAlgorithm == null) + { + return string.Empty; + } - var hash = hashAlgorithm.ComputeHash(Encoding.ASCII.GetBytes(originalText)); + var hash = hashAlgorithm.ComputeHash(Encoding.ASCII.GetBytes(originalText)); return BitConverter.ToString(hash).Replace("-", string.Empty); } diff --git a/src/chocolatey/infrastructure/cryptography/DefaultEncryptionUtility.cs b/src/chocolatey/infrastructure/cryptography/DefaultEncryptionUtility.cs index e50a65f159..e71872edab 100644 --- a/src/chocolatey/infrastructure/cryptography/DefaultEncryptionUtility.cs +++ b/src/chocolatey/infrastructure/cryptography/DefaultEncryptionUtility.cs @@ -28,7 +28,10 @@ public class DefaultEncryptionUtility : IEncryptionUtility public string EncryptString(string cleartextValue) { - if (string.IsNullOrWhiteSpace(cleartextValue)) return null; + if (string.IsNullOrWhiteSpace(cleartextValue)) + { + return null; + } var decryptedByteArray = Encoding.UTF8.GetBytes(cleartextValue); byte[] encryptedByteArray; diff --git a/src/chocolatey/infrastructure/extractors/AssemblyFileExtractor.cs b/src/chocolatey/infrastructure/extractors/AssemblyFileExtractor.cs index 927d46f4a8..2a736e65ad 100644 --- a/src/chocolatey/infrastructure/extractors/AssemblyFileExtractor.cs +++ b/src/chocolatey/infrastructure/extractors/AssemblyFileExtractor.cs @@ -113,7 +113,11 @@ public static void ExtractAssemblyResourcesToRelativeDirectory(IFileSystem fileS //var fileLocation = fileSystem.combine_paths("", resourceString.ToString().Split('.')) + resourceName.Substring(fileExtensionLocation); var filePath = fileSystem.CombinePaths(directoryPath, fileLocation); - if (logOutput) "chocolatey".Log().Debug("Unpacking {0} to '{1}'".FormatWith(fileLocation, filePath)); + if (logOutput) + { + "chocolatey".Log().Debug("Unpacking {0} to '{1}'".FormatWith(fileLocation, filePath)); + } + ExtractBinaryFileFromAssembly(fileSystem, assembly, resourceName, filePath, overwriteExisting, throwError); } } diff --git a/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs b/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs index b437ca704a..b313ed0044 100644 --- a/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs +++ b/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs @@ -75,14 +75,21 @@ public string CombinePaths(string leftItem, params string[] rightItems) { var methodName = string.Empty; var stackFrame = new System.Diagnostics.StackFrame(1); - if (stackFrame != null) methodName = stackFrame.GetMethod().Name; + if (stackFrame != null) + { + methodName = stackFrame.GetMethod().Name; + } + throw new ApplicationException("Path to combine cannot be empty. Tried to combine null with '{0}'.{1}".FormatWith(string.Join(",", rightItems), string.IsNullOrWhiteSpace(methodName) ? string.Empty : " Method called from '{0}'".FormatWith(methodName))); } var combinedPath = Platform.GetPlatform() == PlatformType.Windows ? leftItem : leftItem.Replace('\\', '/'); foreach (var rightItem in rightItems) { - if (rightItem.Contains(":")) throw new ApplicationException("Cannot combine a path with ':' attempted to combine '{0}' with '{1}'".FormatWith(rightItem, combinedPath)); + if (rightItem.Contains(":")) + { + throw new ApplicationException("Cannot combine a path with ':' attempted to combine '{0}' with '{1}'".FormatWith(rightItem, combinedPath)); + } var rightSide = Platform.GetPlatform() == PlatformType.Windows ? rightItem : rightItem.Replace('\\', '/'); if (rightSide.StartsWith(Path.DirectorySeparatorChar.ToStringSafe()) || rightSide.StartsWith(Path.AltDirectorySeparatorChar.ToStringSafe())) @@ -100,7 +107,10 @@ public string CombinePaths(string leftItem, params string[] rightItems) public string GetFullPath(string path) { - if (string.IsNullOrWhiteSpace(path)) return path; + if (string.IsNullOrWhiteSpace(path)) + { + return path; + } try { @@ -136,7 +146,10 @@ public char GetPathSeparator() public string GetExecutablePath(string executableName) { - if (string.IsNullOrWhiteSpace(executableName)) return string.Empty; + if (string.IsNullOrWhiteSpace(executableName)) + { + return string.Empty; + } var isWindows = Platform.GetPlatform() == PlatformType.Windows; IList extensions = new List(); @@ -166,7 +179,10 @@ public string GetExecutablePath(string executableName) foreach (var extension in extensions.OrEmpty()) { var possiblePath = CombinePaths(path, "{0}{1}".FormatWith(executableName, extension.ToLowerSafe())); - if (FileExists(possiblePath)) return possiblePath; + if (FileExists(possiblePath)) + { + return possiblePath; + } } } @@ -186,7 +202,11 @@ public string GetCurrentAssemblyPath() public IEnumerable GetFiles(string directoryPath, string pattern = "*.*", SearchOption option = SearchOption.TopDirectoryOnly) { - if (string.IsNullOrWhiteSpace(directoryPath)) return new List(); + if (string.IsNullOrWhiteSpace(directoryPath)) + { + return new List(); + } + if (!DirectoryExists(directoryPath)) { this.Log().Warn("Directory '{0}' does not exist.".FormatWith(directoryPath)); @@ -198,7 +218,10 @@ public IEnumerable GetFiles(string directoryPath, string pattern = "*.*" public IEnumerable GetFiles(string directoryPath, string[] extensions, SearchOption option = SearchOption.TopDirectoryOnly) { - if (string.IsNullOrWhiteSpace(directoryPath)) return new List(); + if (string.IsNullOrWhiteSpace(directoryPath)) + { + return new List(); + } return Directory.EnumerateFiles(directoryPath, "*.*", option) .Where(f => extensions.Any(x => f.EndsWith(x, StringComparison.OrdinalIgnoreCase))); @@ -223,14 +246,20 @@ public string GetFileName(string filePath) public string GetFilenameWithoutExtension(string filePath) { - if (Platform.GetPlatform() == PlatformType.Windows) return Path.GetFileNameWithoutExtension(filePath); + if (Platform.GetPlatform() == PlatformType.Windows) + { + return Path.GetFileNameWithoutExtension(filePath); + } return Path.GetFileNameWithoutExtension(filePath.Replace('\\', '/')); } public string GetFileExtension(string filePath) { - if (Platform.GetPlatform() == PlatformType.Windows) return Path.GetExtension(filePath); + if (Platform.GetPlatform() == PlatformType.Windows) + { + return Path.GetExtension(filePath); + } return Path.GetExtension(filePath.Replace('\\', '/')); } @@ -578,14 +607,20 @@ public string GetCurrentDirectory() public IEnumerable GetDirectories(string directoryPath) { - if (!DirectoryExists(directoryPath)) return new List(); + if (!DirectoryExists(directoryPath)) + { + return new List(); + } return Directory.EnumerateDirectories(directoryPath); } public IEnumerable GetDirectories(string directoryPath, string pattern, SearchOption option = SearchOption.TopDirectoryOnly) { - if (!DirectoryExists(directoryPath)) return new List(); + if (!DirectoryExists(directoryPath)) + { + return new List(); + } return Directory.EnumerateDirectories(directoryPath, pattern, option); } @@ -658,11 +693,17 @@ public void MoveDirectory(string directoryPath, string newDirectoryPath) public void MoveDirectory(string directoryPath, string newDirectoryPath, bool useFileMoveFallback, bool isSilent) { - if (string.IsNullOrWhiteSpace(directoryPath) || string.IsNullOrWhiteSpace(newDirectoryPath)) throw new ApplicationException("You must provide a directory to move from or to."); + if (string.IsNullOrWhiteSpace(directoryPath) || string.IsNullOrWhiteSpace(newDirectoryPath)) + { + throw new ApplicationException("You must provide a directory to move from or to."); + } // Linux / macOS do not have a SystemDrive environment variable, instead, everything is under "/" var systemDrive = Platform.GetPlatform() == PlatformType.Windows ? Environment.GetEnvironmentVariable("SystemDrive") : "/"; - if (CombinePaths(directoryPath, "").IsEqualTo(CombinePaths(systemDrive, ""))) throw new ApplicationException("Cannot move or delete the root of the system drive"); + if (CombinePaths(directoryPath, "").IsEqualTo(CombinePaths(systemDrive, ""))) + { + throw new ApplicationException("Cannot move or delete the root of the system drive"); + } try { @@ -694,7 +735,10 @@ public void MoveDirectory(string directoryPath, string newDirectoryPath, bool us foreach (var file in GetFiles(directoryPath, "*.*", SearchOption.AllDirectories).OrEmpty()) { var destinationFile = file.Replace(directoryPath, newDirectoryPath); - if (FileExists(destinationFile)) DeleteFile(destinationFile, isSilent); + if (FileExists(destinationFile)) + { + DeleteFile(destinationFile, isSilent); + } EnsureDirectoryExists(GetDirectoryName(destinationFile), ignoreError: true); this.Log().Debug(ChocolateyLoggers.Verbose, "Moving '{0}'{1} to '{2}'".FormatWith(file, Environment.NewLine, destinationFile)); @@ -903,11 +947,17 @@ public void DeleteDirectory(string directoryPath, bool recursive, bool overrideA public void DeleteDirectory(string directoryPath, bool recursive, bool overrideAttributes, bool isSilent) { - if (string.IsNullOrWhiteSpace(directoryPath)) throw new ApplicationException("You must provide a directory to delete."); + if (string.IsNullOrWhiteSpace(directoryPath)) + { + throw new ApplicationException("You must provide a directory to delete."); + } // Linux / macOS do not have a SystemDrive environment variable, instead, everything is under "/" var systemDrive = Platform.GetPlatform() == PlatformType.Windows ? Environment.GetEnvironmentVariable("SystemDrive") : "/"; - if (CombinePaths(directoryPath, "").IsEqualTo(CombinePaths(systemDrive, ""))) throw new ApplicationException("Cannot move or delete the root of the system drive"); + if (CombinePaths(directoryPath, "").IsEqualTo(CombinePaths(systemDrive, ""))) + { + throw new ApplicationException("Cannot move or delete the root of the system drive"); + } if (overrideAttributes) { @@ -916,13 +966,28 @@ public void DeleteDirectory(string directoryPath, bool recursive, bool overrideA var filePath = GetFullPath(file); var fileInfo = GetFileInfoFor(filePath); - if (IsSystemFile(fileInfo)) EnsureFileAttributeRemoved(filePath, FileAttributes.System); - if (IsReadOnlyFile(fileInfo)) EnsureFileAttributeRemoved(filePath, FileAttributes.ReadOnly); - if (IsHiddenFile(fileInfo)) EnsureFileAttributeRemoved(filePath, FileAttributes.Hidden); + if (IsSystemFile(fileInfo)) + { + EnsureFileAttributeRemoved(filePath, FileAttributes.System); + } + + if (IsReadOnlyFile(fileInfo)) + { + EnsureFileAttributeRemoved(filePath, FileAttributes.ReadOnly); + } + + if (IsHiddenFile(fileInfo)) + { + EnsureFileAttributeRemoved(filePath, FileAttributes.Hidden); + } } } - if (!isSilent) this.Log().Debug(ChocolateyLoggers.Verbose, () => "Attempting to delete directory \"{0}\".".FormatWith(GetFullPath(directoryPath))); + if (!isSilent) + { + this.Log().Debug(ChocolateyLoggers.Verbose, () => "Attempting to delete directory \"{0}\".".FormatWith(GetFullPath(directoryPath))); + } + AllowRetries( () => { @@ -1018,10 +1083,22 @@ public Encoding GetFileEncoding(string filePath) file.Read(buffer, 0, 5); file.Close(); - if (buffer[0] == 0xef && buffer[1] == 0xbb && buffer[2] == 0xbf) enc = Encoding.UTF8; - else if (buffer[0] == 0xfe && buffer[1] == 0xff) enc = Encoding.Unicode; - else if (buffer[0] == 0 && buffer[1] == 0 && buffer[2] == 0xfe && buffer[3] == 0xff) enc = Encoding.UTF32; - else if (buffer[0] == 0x2b && buffer[1] == 0x2f && buffer[2] == 0x76) enc = Encoding.UTF7; + if (buffer[0] == 0xef && buffer[1] == 0xbb && buffer[2] == 0xbf) + { + enc = Encoding.UTF8; + } + else if (buffer[0] == 0xfe && buffer[1] == 0xff) + { + enc = Encoding.Unicode; + } + else if (buffer[0] == 0 && buffer[1] == 0 && buffer[2] == 0xfe && buffer[3] == 0xff) + { + enc = Encoding.UTF32; + } + else if (buffer[0] == 0x2b && buffer[1] == 0x2f && buffer[2] == 0x76) + { + enc = Encoding.UTF7; + } //assume xml is utf8 //if (enc == Encoding.Default && get_file_extension(filePath).is_equal_to(".xml")) enc = Encoding.UTF8; diff --git a/src/chocolatey/infrastructure/guards/Ensure.cs b/src/chocolatey/infrastructure/guards/Ensure.cs index 2052f628a2..764a80288b 100644 --- a/src/chocolatey/infrastructure/guards/Ensure.cs +++ b/src/chocolatey/infrastructure/guards/Ensure.cs @@ -38,10 +38,14 @@ public static Ensure That(Expression(bool resetLoggers = true) where T : ILog, new() { _logType = typeof (T); - if (resetLoggers) LogExtensions.ResetLoggers(); + if (resetLoggers) + { + LogExtensions.ResetLoggers(); + } } /// @@ -47,7 +50,10 @@ public static void InitializeWith(ILog loggerType, bool resetLoggers = true) { _logType = loggerType.GetType(); _logger = loggerType; - if (resetLoggers) LogExtensions.ResetLoggers(); + if (resetLoggers) + { + LogExtensions.ResetLoggers(); + } } /// diff --git a/src/chocolatey/infrastructure/logging/Log4NetAppenderConfiguration.cs b/src/chocolatey/infrastructure/logging/Log4NetAppenderConfiguration.cs index 8597f35b47..0df9a9a504 100644 --- a/src/chocolatey/infrastructure/logging/Log4NetAppenderConfiguration.cs +++ b/src/chocolatey/infrastructure/logging/Log4NetAppenderConfiguration.cs @@ -208,7 +208,10 @@ private static void ConfigureLoggingInfoColors() /// Loggers, such as a trace logger, to exclude from file appender. private static void SetFileAppender(string outputDirectory, params string[] excludeLoggerNames) { - if (excludeLoggerNames == null) excludeLoggerNames = new string[] {}; + if (excludeLoggerNames == null) + { + excludeLoggerNames = new string[] {}; + } if (!_alreadyConfiguredFileAppender) { @@ -271,7 +274,10 @@ private static void SetFileAppender(string outputDirectory, params string[] excl /// Appenders, such as a verbose console appender, to exclude from debug. public static void EnableDebugLoggingIf(bool enableDebug, params string[] excludeAppenderNames) { - if (excludeAppenderNames == null) excludeAppenderNames = new string[] { }; + if (excludeAppenderNames == null) + { + excludeAppenderNames = new string[] { }; + } if (enableDebug) { @@ -350,7 +356,10 @@ public static void EnableTraceLoggingIf(bool enableTrace, string traceLoggerName appender.AddFilter(new log4net.Filter.LevelRangeFilter { LevelMin = minLevel, LevelMax = Level.Fatal }); } - if (appender != null && appender.GetType() == typeof(RollingFileAppender)) fileAppenders.Add(appender); + if (appender != null && appender.GetType() == typeof(RollingFileAppender)) + { + fileAppenders.Add(appender); + } } foreach (ILogger log in logRepository.GetCurrentLoggers().Where(l => l.Name.IsEqualTo("Trace")).OrEmpty()) @@ -384,11 +393,18 @@ public static void EnableTraceLoggingIf(bool enableTrace, string traceLoggerName public static void SetupAdditionalLogFile(string logFileLocation) { - if (string.IsNullOrWhiteSpace(logFileLocation)) return; + if (string.IsNullOrWhiteSpace(logFileLocation)) + { + return; + } var logDirectory = Path.GetDirectoryName(logFileLocation); var logFileName = Path.GetFileNameWithoutExtension(logFileLocation); - if (!string.IsNullOrWhiteSpace(logDirectory) && !Directory.Exists(logDirectory)) Directory.CreateDirectory(logDirectory); + if (!string.IsNullOrWhiteSpace(logDirectory) && !Directory.Exists(logDirectory)) + { + Directory.CreateDirectory(logDirectory); + } + var layout = new PatternLayout { ConversionPattern = "%date %property{pid} [%-5level] - %message%newline" diff --git a/src/chocolatey/infrastructure/logging/Log4NetLog.cs b/src/chocolatey/infrastructure/logging/Log4NetLog.cs index 70ee2cfce5..3b7708b0b6 100644 --- a/src/chocolatey/infrastructure/logging/Log4NetLog.cs +++ b/src/chocolatey/infrastructure/logging/Log4NetLog.cs @@ -43,37 +43,55 @@ public void InitializeFor(string loggerName) [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] public void Debug(string message, params object[] formatting) { - if (_logger.IsDebugEnabled) Log(Level.Debug, DecorateMessageWithAuditInformation(message), formatting); + if (_logger.IsDebugEnabled) + { + Log(Level.Debug, DecorateMessageWithAuditInformation(message), formatting); + } } [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] public void Debug(Func message) { - if (_logger.IsDebugEnabled) Log(Level.Debug, DecorateMessageWithAuditInformation(message.Invoke()).EscapeCurlyBraces()); + if (_logger.IsDebugEnabled) + { + Log(Level.Debug, DecorateMessageWithAuditInformation(message.Invoke()).EscapeCurlyBraces()); + } } [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] public void Info(string message, params object[] formatting) { - if (_logger.IsInfoEnabled) Log(Level.Info, DecorateMessageWithAuditInformation(message), formatting); + if (_logger.IsInfoEnabled) + { + Log(Level.Info, DecorateMessageWithAuditInformation(message), formatting); + } } [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] public void Info(Func message) { - if (_logger.IsInfoEnabled) Log(Level.Info, DecorateMessageWithAuditInformation(message.Invoke()).EscapeCurlyBraces()); + if (_logger.IsInfoEnabled) + { + Log(Level.Info, DecorateMessageWithAuditInformation(message.Invoke()).EscapeCurlyBraces()); + } } [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] public void Warn(string message, params object[] formatting) { - if (_logger.IsWarnEnabled) Log(Level.Warn, DecorateMessageWithAuditInformation(message), formatting); + if (_logger.IsWarnEnabled) + { + Log(Level.Warn, DecorateMessageWithAuditInformation(message), formatting); + } } [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] public void Warn(Func message) { - if (_logger.IsWarnEnabled) Log(Level.Warn, DecorateMessageWithAuditInformation(message.Invoke()).EscapeCurlyBraces()); + if (_logger.IsWarnEnabled) + { + Log(Level.Warn, DecorateMessageWithAuditInformation(message.Invoke()).EscapeCurlyBraces()); + } } [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] diff --git a/src/chocolatey/infrastructure/logging/TraceLog.cs b/src/chocolatey/infrastructure/logging/TraceLog.cs index 4e988086f1..dddcf47eb7 100644 --- a/src/chocolatey/infrastructure/logging/TraceLog.cs +++ b/src/chocolatey/infrastructure/logging/TraceLog.cs @@ -83,7 +83,10 @@ private void EnableNetworkLogging() EnableTraceSource("s_CacheTraceSource", logging, this); //System.Net.Cache var isEnabled = logging.GetField("s_LoggingEnabled", BindingFlags.NonPublic | BindingFlags.Static); - if (isEnabled !=null) isEnabled.SetValue(null, true); + if (isEnabled !=null) + { + isEnabled.SetValue(null, true); + } } private static void EnableTraceSource(string fieldName, Type logging, TraceListener listener) diff --git a/src/chocolatey/infrastructure/platforms/Platform.cs b/src/chocolatey/infrastructure/platforms/Platform.cs index 16f5c90ed5..f15e8109ed 100644 --- a/src/chocolatey/infrastructure/platforms/Platform.cs +++ b/src/chocolatey/infrastructure/platforms/Platform.cs @@ -65,9 +65,14 @@ public static PlatformType GetPlatform() & FileSystem.DirectoryExists("/System") & FileSystem.DirectoryExists("/Users") & FileSystem.DirectoryExists("/Volumes")) + { return PlatformType.Mac; + } else + { return PlatformType.Linux; + } + default: return PlatformType.Windows; } diff --git a/src/chocolatey/infrastructure/powershell/PoshHostUserInterface.cs b/src/chocolatey/infrastructure/powershell/PoshHostUserInterface.cs index 7f3ba385de..65c5425973 100644 --- a/src/chocolatey/infrastructure/powershell/PoshHostUserInterface.cs +++ b/src/chocolatey/infrastructure/powershell/PoshHostUserInterface.cs @@ -134,7 +134,10 @@ public override void WriteDebugLine(string message) private bool _hasLoggedStartProgress = false; public override void WriteProgress(long sourceId, ProgressRecord record) { - if (record.PercentComplete == -1) return; + if (record.PercentComplete == -1) + { + return; + } if (!_hasLoggedStartProgress) { @@ -165,7 +168,10 @@ public override Dictionary Prompt(string caption, string messa var results = new Dictionary(); foreach (FieldDescription field in descriptions) { - if (string.IsNullOrWhiteSpace(field.Label)) this.Log().Warn(field.Name.EscapeCurlyBraces()); + if (string.IsNullOrWhiteSpace(field.Label)) + { + this.Log().Warn(field.Name.EscapeCurlyBraces()); + } else { string[] label = GetHotkeyAndLabel(field.Label); @@ -183,7 +189,10 @@ public override Dictionary Prompt(string caption, string messa selection = ReadLine(); } - if (selection == null) return null; + if (selection == null) + { + return null; + } results[field.Name] = PSObject.AsPSObject(selection); } @@ -209,19 +218,32 @@ private static string[] GetHotkeyAndLabel(string input) string[] fragments = input.Split('&'); if (fragments.Length == 2) { - if (fragments[1].Length > 0) result[0] = fragments[1][0].ToStringSafe().ToUpper(CultureInfo.CurrentCulture); + if (fragments[1].Length > 0) + { + result[0] = fragments[1][0].ToStringSafe().ToUpper(CultureInfo.CurrentCulture); + } result[1] = (fragments[0] + fragments[1]).Trim(); } - else result[1] = input; + else + { + result[1] = input; + } return result; } public override int PromptForChoice(string caption, string message, Collection choices, int defaultChoice) { - if (!string.IsNullOrWhiteSpace(caption)) this.Log().Warn(caption.EscapeCurlyBraces()); - if (!string.IsNullOrWhiteSpace(message)) this.Log().Warn(ChocolateyLoggers.Important, message.EscapeCurlyBraces()); + if (!string.IsNullOrWhiteSpace(caption)) + { + this.Log().Warn(caption.EscapeCurlyBraces()); + } + + if (!string.IsNullOrWhiteSpace(message)) + { + this.Log().Warn(ChocolateyLoggers.Important, message.EscapeCurlyBraces()); + } string[,] promptData = BuildHotkeysAndLabels(choices); @@ -246,11 +268,17 @@ public override int PromptForChoice(string caption, string message, Collection(Event eventMessage) where Event : class, IMessage public IDisposable Subscribe(Action handleEvent, Action handleError, Func filter) where Event : class, IMessage { - if (filter == null) filter = (message) => true; - if (handleError == null) handleError = (ex) => { }; + if (filter == null) + { + filter = (message) => true; + } + + if (handleError == null) + { + handleError = (ex) => { }; + } var subscription = _subject.OfType().AsObservable() .Where(filter) diff --git a/src/chocolatey/infrastructure/synchronization/GlobalMutex.cs b/src/chocolatey/infrastructure/synchronization/GlobalMutex.cs index 4a785ed2fa..bbbe3863c0 100644 --- a/src/chocolatey/infrastructure/synchronization/GlobalMutex.cs +++ b/src/chocolatey/infrastructure/synchronization/GlobalMutex.cs @@ -83,12 +83,18 @@ public static void Enter(Action action, int timeout) { using (new GlobalMutex(timeout)) { - if (action != null) action.Invoke(); + if (action != null) + { + action.Invoke(); + } } } else { - if (action != null) action.Invoke(); + if (action != null) + { + action.Invoke(); + } } } @@ -107,12 +113,18 @@ public static T Enter(Func func, int timeout) { using (new GlobalMutex(timeout)) { - if (func != null) returnValue = func.Invoke(); + if (func != null) + { + returnValue = func.Invoke(); + } } } else { - if (func != null) returnValue = func.Invoke(); + if (func != null) + { + returnValue = func.Invoke(); + } } return returnValue; diff --git a/src/chocolatey/infrastructure/tokens/TokenReplacer.cs b/src/chocolatey/infrastructure/tokens/TokenReplacer.cs index 58b54e1223..93777687cd 100644 --- a/src/chocolatey/infrastructure/tokens/TokenReplacer.cs +++ b/src/chocolatey/infrastructure/tokens/TokenReplacer.cs @@ -25,10 +25,16 @@ public sealed class TokenReplacer { public static string ReplaceTokens(TConfig configuration, string textToReplace, string tokenPrefix = "[[", string tokenSuffix = "]]") { - if (string.IsNullOrEmpty(textToReplace)) return string.Empty; + if (string.IsNullOrEmpty(textToReplace)) + { + return string.Empty; + } IDictionary dictionary = CreateDictionaryFromConfiguration(configuration); - if (dictionary.Count == 0) return textToReplace; + if (dictionary.Count == 0) + { + return textToReplace; + } var regex = new Regex("{0}(?\\w+){1}".FormatWith(Regex.Escape(tokenPrefix), Regex.Escape(tokenSuffix))); @@ -52,7 +58,10 @@ public static string ReplaceTokens(TConfig configuration, string textTo private static IDictionary CreateDictionaryFromConfiguration(TConfig configuration) { - if (configuration is IDictionary) return configuration as IDictionary; + if (configuration is IDictionary) + { + return configuration as IDictionary; + } var propertyDictionary = new Dictionary(); foreach (PropertyInfo property in configuration.GetType().GetProperties()) diff --git a/src/chocolatey/infrastructure/tolerance/FaultTolerance.cs b/src/chocolatey/infrastructure/tolerance/FaultTolerance.cs index 5ac6c0250d..a41a7f39f1 100644 --- a/src/chocolatey/infrastructure/tolerance/FaultTolerance.cs +++ b/src/chocolatey/infrastructure/tolerance/FaultTolerance.cs @@ -51,7 +51,10 @@ private static bool InDebugMode() /// Log messages? public static void Retry(int numberOfTries, Action action, int waitDurationMilliseconds = 100, int increaseRetryByMilliseconds = 0, bool isSilent = false) { - if (action == null) return; + if (action == null) + { + return; + } var success = Retry( numberOfTries, @@ -78,13 +81,24 @@ public static void Retry(int numberOfTries, Action action, int waitDurationMilli /// Log messages? public static T Retry(int numberOfTries, Func function, int waitDurationMilliseconds = 100, int increaseRetryByMilliseconds = 0, bool isSilent = false) { - if (function == null) return default(T); - if (numberOfTries == 0) throw new ApplicationException("You must specify a number of tries greater than zero."); + if (function == null) + { + return default(T); + } + + if (numberOfTries == 0) + { + throw new ApplicationException("You must specify a number of tries greater than zero."); + } + var returnValue = default(T); var debugging = InDebugMode(); var logLocation = ChocolateyLoggers.Normal; - if (isSilent) logLocation = ChocolateyLoggers.LogFileOnly; + if (isSilent) + { + logLocation = ChocolateyLoggers.LogFileOnly; + } for (int i = 1; i <= numberOfTries; i++) { @@ -129,7 +143,10 @@ public static T Retry(int numberOfTries, Func function, int waitDurationMi /// Log messages? public static void TryCatchWithLoggingException(Action action, string errorMessage, bool throwError = false, bool logWarningInsteadOfError = false, bool logDebugInsteadOfError = false, bool isSilent = false) { - if (action == null) return; + if (action == null) + { + return; + } var success = TryCatchWithLoggingException( () => @@ -158,11 +175,18 @@ public static void TryCatchWithLoggingException(Action action, string errorMessa /// The return value from the function public static T TryCatchWithLoggingException(Func function, string errorMessage, bool throwError = false, bool logWarningInsteadOfError = false, bool logDebugInsteadOfError = false, bool isSilent = false) { - if (function == null) return default(T); + if (function == null) + { + return default(T); + } + var returnValue = default(T); var logLocation = ChocolateyLoggers.Normal; - if (isSilent) logLocation = ChocolateyLoggers.LogFileOnly; + if (isSilent) + { + logLocation = ChocolateyLoggers.LogFileOnly; + } try { diff --git a/src/chocolatey/infrastructure/xml/XmlCData.cs b/src/chocolatey/infrastructure/xml/XmlCData.cs index 209ec843d0..14e7e6ea43 100644 --- a/src/chocolatey/infrastructure/xml/XmlCData.cs +++ b/src/chocolatey/infrastructure/xml/XmlCData.cs @@ -49,7 +49,10 @@ public static implicit operator XmlCData(string value) /// public static implicit operator string(XmlCData cdata) { - if (cdata != null) return cdata._value.ToStringSafe(); + if (cdata != null) + { + return cdata._value.ToStringSafe(); + } return string.Empty; } From 6735897a0ed696049e3bab3cb416814c4086ac01 Mon Sep 17 00:00:00 2001 From: Rain Sallow Date: Thu, 4 Apr 2024 13:27:17 -0400 Subject: [PATCH 06/18] (maint) Fix IDE0065 warnings Place using statements outside namespace block --- src/chocolatey.console/Program.cs | 52 +++++++------- .../MockEventSubscriptionManager.cs | 16 ++--- .../NUnitSetup.cs | 33 +++++---- src/chocolatey.tests.integration/Scenario.cs | 34 ++++----- .../builders/ConfigurationBuilderSpecs.cs | 38 +++++----- .../services/FilesServiceSpecs.cs | 30 ++++---- .../commands/CommandExecutorSpecs.cs | 14 ++-- .../cryptography/CryptoHashProviderSpecs.cs | 14 ++-- .../filesystem/DotNetFileSystemSpecs.cs | 18 ++--- .../scenarios/InfoScenarios.cs | 40 +++++------ .../scenarios/InstallScenarios.cs | 40 +++++------ .../scenarios/ListScenarios.cs | 18 ++--- .../scenarios/PackScenarios.cs | 24 +++---- .../scenarios/PinScenarios.cs | 34 ++++----- .../scenarios/SearchScenarios.cs | 20 +++--- .../scenarios/UninstallScenarios.cs | 30 ++++---- .../scenarios/UpgradeScenarios.cs | 30 ++++---- src/chocolatey.tests/MockLogger.cs | 12 ++-- src/chocolatey.tests/TinySpec.cs | 14 ++-- src/chocolatey.tests/UNCHelper.cs | 10 +-- .../attributes/CommandForAttributeSpecs.cs | 6 +- .../commands/ChocolateyApiKeyCommandSpecs.cs | 24 +++---- .../commands/ChocolateyCacheCommandSpecs.cs | 28 ++++---- .../commands/ChocolateyConfigCommandSpecs.cs | 24 +++---- .../commands/ChocolateyExportCommandSpecs.cs | 24 +++---- .../commands/ChocolateyFeatureCommandSpecs.cs | 24 +++---- .../commands/ChocolateyHelpCommandSpecs.cs | 14 ++-- .../commands/ChocolateyInfoCommandSpecs.cs | 22 +++--- .../commands/ChocolateyInstallCommandSpecs.cs | 24 +++---- .../commands/ChocolateyListCommandSpecs.cs | 22 +++--- .../commands/ChocolateyNewCommandSpecs.cs | 24 +++---- .../ChocolateyOutdatedCommandSpecs.cs | 20 +++--- .../commands/ChocolateyPackCommandSpecs.cs | 22 +++--- .../commands/ChocolateyPinCommandSpecs.cs | 40 +++++------ .../commands/ChocolateyPushCommandSpecs.cs | 26 +++---- .../commands/ChocolateySearchCommandSpecs.cs | 22 +++--- .../commands/ChocolateySourceCommandSpecs.cs | 24 +++---- .../ChocolateyTemplateCommandSpecs.cs | 58 +++++++-------- .../ChocolateyUninstallCommandSpecs.cs | 24 +++---- .../ChocolateyUnpackSelfCommandSpecs.cs | 22 +++--- .../commands/ChocolateyUpgradeCommandSpecs.cs | 24 +++---- .../configuration/ConfigurationOptionsSpec.cs | 22 +++--- .../ChocolateyNuGetProjectContextSpecs.cs | 22 +++--- .../nuget/ChocolateyNugetLoggerSpecs.cs | 20 +++--- .../nuget/NugetCommonSpecs.cs | 28 ++++---- .../AutomaticUninstallerServiceSpecs.cs | 38 +++++----- .../ChocolateyConfigSettingsServiceSpecs.cs | 22 +++--- .../services/ChocolateyPackageServiceSpecs.cs | 7 +- .../services/FilesServiceSpecs.cs | 28 ++++---- .../services/NugetServiceSpecs.cs | 28 ++++---- .../services/RegistryServiceSpecs.cs | 18 ++--- .../services/RulesServiceSpecs.cs | 20 +++--- .../services/TemplateServiceSpecs.cs | 34 ++++----- .../utility/ArgumentsUtilitySpecs.cs | 10 +-- .../utility/PackageUtilitySpecs.cs | 42 +++++------ .../commandline/InteractivePromptSpecs.cs | 14 ++-- .../commands/CommandExecutorSpecs.cs | 16 ++--- .../ExternalCommandArgsBuilderSpecs.cs | 12 ++-- .../commands/PowershellExecutorSpecs.cs | 16 ++--- .../configuration/ConfigSpecs.cs | 8 +-- .../cryptography/CryptoHashProviderSpecs.cs | 20 +++--- .../events/EventSubscriptionManagerSpecs.cs | 16 ++--- .../events/context/FakeEvent.cs | 4 +- .../events/context/FakeSubscriber.cs | 6 +- .../filesystem/DotNetFileSystemSpecs.cs | 20 +++--- .../infrastructure/guards/EnsureSpecs.cs | 12 ++-- .../information/VersionInformationSpecs.cs | 8 +-- .../infrastructure/platforms/PlatformSpecs.cs | 16 ++--- .../tokens/TokenReplacerSpecs.cs | 10 +-- .../tolerance/FaultToleranceSpecs.cs | 10 +-- src/chocolatey/AssemblyExtensions.cs | 18 ++--- src/chocolatey/EnumExtensions.cs | 10 +-- src/chocolatey/EnumerableExtensions.cs | 10 +-- src/chocolatey/ExceptionExtensions.cs | 14 ++-- src/chocolatey/FileSystemExtensions.cs | 20 +++--- src/chocolatey/GetChocolatey.cs | 46 ++++++------ src/chocolatey/ILogExtensions.cs | 8 +-- src/chocolatey/LogExtensions.cs | 8 +-- src/chocolatey/NuGetVersionExtensions.cs | 6 +- src/chocolatey/ObjectExtensions.cs | 8 +-- src/chocolatey/RuleResultExtensions.cs | 10 +-- src/chocolatey/StringExtensions.cs | 26 +++---- src/chocolatey/StringResources.cs | 4 +- src/chocolatey/TypeExtensions.cs | 4 +- .../ApplicationParameters.cs | 16 ++--- .../attributes/CommandForAttribute.cs | 4 +- .../attributes/MultiServiceAttribute.cs | 4 +- .../builders/ConfigurationBuilder.cs | 50 ++++++------- .../commands/ChocolateyApiKeyCommand.cs | 24 +++---- .../commands/ChocolateyCacheCommand.cs | 26 +++---- .../commands/ChocolateyCommandBase.cs | 20 +++--- .../commands/ChocolateyConfigCommand.cs | 24 +++---- .../commands/ChocolateyExportCommand.cs | 30 ++++---- .../commands/ChocolateyFeatureCommand.cs | 24 +++---- .../commands/ChocolateyHelpCommand.cs | 22 +++--- .../commands/ChocolateyInfoCommand.cs | 16 ++--- .../commands/ChocolateyInstallCommand.cs | 20 +++--- .../commands/ChocolateyListCommand.cs | 24 +++---- .../commands/ChocolateyNewCommand.cs | 22 +++--- .../commands/ChocolateyOutdatedCommand.cs | 18 ++--- .../commands/ChocolateyPackCommand.cs | 20 +++--- .../commands/ChocolateyPinCommand.cs | 32 ++++----- .../commands/ChocolateyPushCommand.cs | 20 +++--- .../commands/ChocolateySearchCommand.cs | 22 +++--- .../commands/ChocolateySourceCommand.cs | 26 +++---- .../commands/ChocolateyTemplateCommand.cs | 58 +++++++-------- .../commands/ChocolateyUninstallCommand.cs | 20 +++--- .../commands/ChocolateyUnpackSelfCommand.cs | 27 +++---- .../commands/ChocolateyUpgradeCommand.cs | 20 +++--- .../configuration/ChocolateyConfiguration.cs | 16 ++--- .../configuration/ConfigFileApiKeySetting.cs | 6 +- .../configuration/ConfigFileConfigSetting.cs | 6 +- .../configuration/ConfigFileFeatureSetting.cs | 6 +- .../configuration/ConfigFileSettings.cs | 8 +-- .../configuration/ConfigFileSourceSetting.cs | 6 +- .../configuration/ConfigurationOptions.cs | 20 +++--- .../configuration/EnvironmentSettings.cs | 26 +++---- .../PackagesConfigFilePackageSetting.cs | 6 +- .../PackagesConfigFileSettings.cs | 8 +-- .../domain/ChocolateyPackageInformation.cs | 10 +-- .../domain/ChocolateyPackageMetadata.cs | 13 ++-- .../domain/CommandNameType.cs | 4 +- .../domain/ConfigCommandType.cs | 4 +- .../domain/FeatureCommandType.cs | 4 +- .../domain/GenericRegistryKey.cs | 6 +- .../domain/GenericRegistryValue.cs | 4 +- .../domain/InstallTokens.cs | 4 +- .../infrastructure.app/domain/PackageFile.cs | 6 +- .../infrastructure.app/domain/PackageFiles.cs | 10 +-- .../domain/PinCommandType.cs | 4 +- .../infrastructure.app/domain/Registry.cs | 10 +-- .../domain/RegistryApplicationKey.cs | 10 +-- .../domain/RegistryValueExtensions.cs | 8 +-- .../domain/SourceCommandType.cs | 4 +- .../infrastructure.app/domain/SourceType.cs | 4 +- .../infrastructure.app/domain/SourceTypes.cs | 4 +- .../domain/TemplateCommandType.cs | 36 +++++----- .../domain/installers/BitRockInstaller.cs | 4 +- .../domain/installers/CustomInstaller.cs | 6 +- .../domain/installers/GhostInstaller.cs | 4 +- .../domain/installers/IInstaller.cs | 6 +- .../domain/installers/InnoSetupInstaller.cs | 4 +- .../domain/installers/InstallForJInstaller.cs | 4 +- .../installers/InstallShieldInstaller.cs | 4 +- .../domain/installers/InstallerBase.cs | 8 +-- .../domain/installers/IzPackInstaller.cs | 4 +- .../domain/installers/MsiInstaller.cs | 4 +- .../domain/installers/MsiPatchInstaller.cs | 4 +- .../domain/installers/NsisInstaller.cs | 4 +- .../installers/PackageForTheWebInstaller.cs | 4 +- .../domain/installers/QtInstaller.cs | 4 +- .../installers/SetupFactoryInstaller.cs | 4 +- .../domain/installers/SquirrelInstaller.cs | 4 +- .../installers/WindowsUpdateInstaller.cs | 4 +- .../domain/installers/WiseInstaller.cs | 4 +- .../HandlePackageResultCompletedMessage.cs | 10 +-- .../events/PostRunMessage.cs | 8 +-- .../events/PreRunMessage.cs | 8 +-- .../nuget/ChocolateyLocalPackageRepository.cs | 23 +++--- .../nuget/ChocolateyNuGetProjectContext.cs | 17 +++-- .../nuget/ChocolateyNuGetSettings.cs | 7 +- .../ChocolateyNugetCredentialProvider.cs | 24 +++---- .../nuget/ChocolateyNugetLogger.cs | 14 ++-- .../nuget/ChocolateyPackagePathResolver.cs | 18 ++--- .../nuget/ChocolateyPhysicalFileSystem.cs | 3 +- .../nuget/ChocolateySourceCacheContext.cs | 14 ++-- .../nuget/DictionaryPropertyProvider.cs | 4 +- .../nuget/NuGetEndpointResources.cs | 12 ++-- .../nuget/NuGetEndpointResourcesExtensions.cs | 8 +-- .../nuget/NuGetFileSystemExtensions.cs | 9 +-- .../infrastructure.app/nuget/NugetCommon.cs | 72 +++++++++---------- .../nuget/NugetEncryptionUtility.cs | 12 ++-- .../infrastructure.app/nuget/NugetList.cs | 28 ++++---- .../infrastructure.app/nuget/NugetPack.cs | 20 +++--- .../infrastructure.app/nuget/NugetPush.cs | 20 +++--- .../ChocolateyRegistrationModule.cs | 44 ++++++------ .../registration/ContainerBinding.cs | 42 +++++------ .../registration/IContainerRegistrator.cs | 4 +- .../registration/IContainerResolver.cs | 6 +- .../registration/IExtensionConfiguration.cs | 10 +-- .../registration/IExtensionEnvironment.cs | 8 +-- .../registration/IExtensionModule.cs | 6 +- .../SimpleInjectorContainerRegistrator.cs | 30 ++++---- .../SimpleInjectorContainerResolver.cs | 8 +-- .../rules/EmptyOrInvalidUrlMetadataRule.cs | 10 +-- .../rules/FrameWorkReferencesMetadataRule.cs | 8 +-- .../rules/IconMetadataRule.cs | 8 +-- .../rules/LicenseMetadataRule.cs | 8 +-- .../rules/MetadataRuleBase.cs | 14 ++-- .../rules/PackageTypesMetadataRule.cs | 8 +-- .../rules/ReadmeMetadataRule.cs | 8 +-- .../rules/RepositoryMetadataRule.cs | 12 ++-- .../RequireLicenseAcceptanceMetadataRule.cs | 8 +-- .../rules/RequiredMetadataRule.cs | 8 +-- .../rules/ServicableMetadataRule.cs | 8 +-- .../rules/VersionMetadataRule.cs | 10 +-- .../runners/ConsoleApplication.cs | 20 +++--- .../runners/GenericRunner.cs | 42 +++++------ .../services/AutomaticUninstallerService.cs | 32 ++++----- .../ChocolateyConfigSettingsService.cs | 20 +++--- .../ChocolateyPackageInformationService.cs | 26 +++---- .../services/ChocolateyPackageService.cs | 54 +++++++------- .../services/ConfigTransformService.cs | 22 +++--- .../services/CygwinService.cs | 28 ++++---- .../services/FilesService.cs | 24 +++---- .../services/IAutomaticUninstallerService.cs | 10 +-- .../IChocolateyConfigSettingsService.cs | 8 +-- .../IChocolateyPackageInformationService.cs | 8 +-- .../services/IChocolateyPackageService.cs | 12 ++-- .../services/IConfigTransformService.cs | 8 +-- .../services/IFilesService.cs | 10 +-- .../services/INugetService.cs | 12 ++-- .../services/IPendingRebootService.cs | 6 +- .../services/IPowershellService.cs | 16 ++--- .../services/IRegistryService.cs | 12 ++-- .../services/IShimGenerationService.cs | 8 +-- .../services/ISourceRunner.cs | 16 ++--- .../services/ITemplateService.cs | 6 +- .../services/NugetService.cs | 70 +++++++++--------- .../services/PendingRebootService.cs | 10 +-- .../services/PowershellService.cs | 50 ++++++------- .../services/PythonService.cs | 30 ++++---- .../services/RegistryService.cs | 30 ++++---- .../services/RubyGemsService.cs | 24 +++---- .../services/RuleService.cs | 22 +++--- .../services/ShimGenerationService.cs | 16 ++--- .../services/TemplateService.cs | 30 ++++---- .../services/WindowsFeatureService.cs | 26 +++---- .../tasks/RemovePendingPackagesTask.cs | 22 +++--- .../templates/TemplateValues.cs | 6 +- .../utility/ArgumentsUtility.cs | 4 +- .../utility/PackageUtility.cs | 8 +-- .../CacheFolderValidationLockdown.cs | 14 ++-- .../GlobalConfigurationValidation.cs | 10 +-- .../validations/SystemStateValidation.cs | 12 ++-- .../infrastructure/adapters/Assembly.cs | 10 +-- .../infrastructure/adapters/Console.cs | 14 ++-- .../infrastructure/adapters/Environment.cs | 8 +-- .../infrastructure/adapters/HashAlgorithm.cs | 4 +- .../infrastructure/adapters/IAssembly.cs | 10 +-- .../infrastructure/adapters/IConsole.cs | 4 +- .../adapters/IEncryptionUtility.cs | 4 +- .../infrastructure/adapters/IEnvironment.cs | 6 +- .../infrastructure/adapters/IHashAlgorithm.cs | 4 +- .../infrastructure/adapters/IProcess.cs | 6 +- .../infrastructure/adapters/Process.cs | 6 +- .../commandline/ExitScenarioHandler.cs | 10 +-- .../commandline/InteractivePrompt.cs | 18 ++--- .../infrastructure/commandline/Options.cs | 26 ++++--- .../commandline/ReadKeyTimeout.cs | 6 +- .../commandline/ReadLineTimeout.cs | 6 +- .../commands/CommandExecutor.cs | 20 +++--- .../infrastructure/commands/Execute.cs | 10 +-- .../commands/ExitCodeDescription.cs | 4 +- .../commands/ExternalCommandArgsBuilder.cs | 10 +-- .../infrastructure/commands/ICommand.cs | 10 +-- .../commands/ICommandExecutor.cs | 6 +- .../infrastructure/commands/IListCommand.cs | 8 +-- .../commands/PowershellExecutor.cs | 18 ++--- .../infrastructure/configuration/Config.cs | 8 +-- .../cryptography/CryptoHashProvider.cs | 22 +++--- .../cryptography/DefaultEncryptionUtility.cs | 12 ++-- .../infrastructure/events/EventManager.cs | 8 +-- .../extractors/AssemblyFileExtractor.cs | 16 ++--- .../filesystem/DotNetFileSystem.cs | 38 +++++----- .../infrastructure/filesystem/FileSystem.cs | 6 +- .../infrastructure/filesystem/IFileSystem.cs | 10 +-- .../infrastructure/guards/Ensure.cs | 8 +-- .../information/ExtensionInformation.cs | 6 +- .../information/ProcessInformation.cs | 10 +-- .../information/VersionInformation.cs | 8 +-- .../licensing/ChocolateyLicense.cs | 8 +-- .../infrastructure/licensing/License.cs | 12 ++-- .../licensing/LicenseValidation.cs | 12 ++-- .../infrastructure/logging/AggregateLog.cs | 6 +- src/chocolatey/infrastructure/logging/ILog.cs | 4 +- src/chocolatey/infrastructure/logging/Log.cs | 4 +- .../logging/Log4NetAppenderConfiguration.cs | 36 +++++----- .../infrastructure/logging/Log4NetLog.cs | 9 ++- .../infrastructure/logging/LogSinkLog.cs | 6 +- .../infrastructure/logging/NullLog.cs | 4 +- .../infrastructure/logging/TraceLog.cs | 14 ++-- .../infrastructure/platforms/Platform.cs | 14 ++-- .../infrastructure/powershell/PoshHost.cs | 16 ++--- .../powershell/PoshHostRawUserInterface.cs | 10 +-- .../powershell/PoshHostUserInterface.cs | 26 +++---- .../registration/AssemblyResolution.cs | 24 +++---- .../infrastructure/registration/Bootstrap.cs | 12 ++-- .../registration/HttpsSecurity.cs | 16 ++--- .../registration/SecurityProtocol.cs | 10 +-- .../registration/SimpleInjectorContainer.cs | 24 +++---- ...mpleInjectorContainerResolutionBehavior.cs | 10 +-- .../infrastructure/results/IResult.cs | 4 +- .../infrastructure/results/PackageResult.cs | 20 +++--- .../infrastructure/results/Result.cs | 8 +-- .../infrastructure/rules/IMetadataRule.cs | 10 +-- .../EventSubscriptionManagerService.cs | 14 ++-- .../services/IDateTimeService.cs | 4 +- .../IEventSubscriptionManagerService.cs | 6 +- .../services/IRegularExpressionService.cs | 6 +- .../infrastructure/services/IRuleService.cs | 8 +-- .../infrastructure/services/IXmlService.cs | 4 +- .../services/RegularExpressionService.cs | 6 +- .../services/SystemDateTimeService.cs | 4 +- .../services/SystemDateTimeUtcService.cs | 4 +- .../infrastructure/services/XmlService.cs | 22 +++--- .../synchronization/GlobalMutex.cs | 14 ++-- src/chocolatey/infrastructure/tasks/ITask.cs | 6 +- .../infrastructure/tokens/TokenReplacer.cs | 10 +-- .../tolerance/FaultTolerance.cs | 10 +-- .../infrastructure/validations/IValidation.cs | 10 +-- src/chocolatey/infrastructure/xml/XmlCData.cs | 8 +-- 312 files changed, 2447 insertions(+), 2451 deletions(-) diff --git a/src/chocolatey.console/Program.cs b/src/chocolatey.console/Program.cs index 943f5b12b9..4428b162f0 100644 --- a/src/chocolatey.console/Program.cs +++ b/src/chocolatey.console/Program.cs @@ -14,39 +14,39 @@ // See the License for the specific language governing permissions and // limitations under the License. -namespace chocolatey.console -{ - using System; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Reflection; - using Microsoft.Win32; - using chocolatey.infrastructure.information; - using infrastructure.app; - using infrastructure.app.builders; - using infrastructure.app.configuration; - using infrastructure.app.runners; - using infrastructure.commandline; - using infrastructure.extractors; - using infrastructure.licensing; - using infrastructure.logging; - using infrastructure.platforms; - using infrastructure.registration; - using infrastructure.tolerance; - using SimpleInjector; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using Microsoft.Win32; +using chocolatey.infrastructure.information; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.app.builders; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.runners; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.extractors; +using chocolatey.infrastructure.licensing; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.platforms; +using chocolatey.infrastructure.registration; +using chocolatey.infrastructure.tolerance; +using SimpleInjector; #if !NoResources - using resources; +using chocolatey.resources; #endif - using Assembly = infrastructure.adapters.Assembly; - using Console = System.Console; - using Environment = System.Environment; - using IFileSystem = infrastructure.filesystem.IFileSystem; +using Assembly = chocolatey.infrastructure.adapters.Assembly; +using Console = System.Console; +using Environment = System.Environment; +using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem; +namespace chocolatey.console +{ public sealed class Program { private static void Main(string[] args) diff --git a/src/chocolatey.tests.integration/MockEventSubscriptionManager.cs b/src/chocolatey.tests.integration/MockEventSubscriptionManager.cs index c4769998e3..6a57914ed1 100644 --- a/src/chocolatey.tests.integration/MockEventSubscriptionManager.cs +++ b/src/chocolatey.tests.integration/MockEventSubscriptionManager.cs @@ -14,16 +14,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Reactive.Subjects; +using chocolatey.infrastructure.events; +using chocolatey.infrastructure.services; +using Moq; + namespace chocolatey.tests.integration { - using System; - using System.Collections.Concurrent; - using System.Collections.Generic; - using System.Reactive.Subjects; - using chocolatey.infrastructure.events; - using chocolatey.infrastructure.services; - using Moq; - public class MockEventSubscriptionManager : Mock, IEventSubscriptionManagerService { private readonly Lazy>> _messages = new Lazy>>(); diff --git a/src/chocolatey.tests.integration/NUnitSetup.cs b/src/chocolatey.tests.integration/NUnitSetup.cs index 73f9b71144..81697951b2 100644 --- a/src/chocolatey.tests.integration/NUnitSetup.cs +++ b/src/chocolatey.tests.integration/NUnitSetup.cs @@ -14,27 +14,26 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Threading; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.app.builders; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.licensing; +using chocolatey.infrastructure.platforms; +using chocolatey.infrastructure.registration; +using NUnit.Framework; +using SimpleInjector; [assembly: chocolatey.tests.Categories.Integration] namespace chocolatey.tests.integration { - using System; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Reflection; - using System.Threading; - using chocolatey.infrastructure.app; - using chocolatey.infrastructure.app.builders; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.filesystem; - using chocolatey.infrastructure.licensing; - using chocolatey.infrastructure.platforms; - using chocolatey.infrastructure.registration; - using NUnit.Framework; - using SimpleInjector; - // ReSharper disable InconsistentNaming [SetUpFixture] diff --git a/src/chocolatey.tests.integration/Scenario.cs b/src/chocolatey.tests.integration/Scenario.cs index f962ed1e7e..520d2b9f4e 100644 --- a/src/chocolatey.tests.integration/Scenario.cs +++ b/src/chocolatey.tests.integration/Scenario.cs @@ -14,25 +14,25 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.IO; +using System.IO.Compression; +using System.Linq; +using System.Xml.Linq; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.guards; +using chocolatey.infrastructure.platforms; +using NuGet.Configuration; +using NuGet.Packaging; + namespace chocolatey.tests.integration { - using System; - using System.Collections.Generic; - using System.IO; - using System.IO.Compression; - using System.Linq; - using System.Xml.Linq; - using chocolatey.infrastructure.app; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.domain; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.commands; - using chocolatey.infrastructure.filesystem; - using chocolatey.infrastructure.guards; - using chocolatey.infrastructure.platforms; - using NuGet.Configuration; - using NuGet.Packaging; - public class Scenario { private static IChocolateyPackageService _service; diff --git a/src/chocolatey.tests.integration/infrastructure.app/builders/ConfigurationBuilderSpecs.cs b/src/chocolatey.tests.integration/infrastructure.app/builders/ConfigurationBuilderSpecs.cs index 5ae1872b49..7903801397 100644 --- a/src/chocolatey.tests.integration/infrastructure.app/builders/ConfigurationBuilderSpecs.cs +++ b/src/chocolatey.tests.integration/infrastructure.app/builders/ConfigurationBuilderSpecs.cs @@ -14,27 +14,27 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Configuration; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.app; +using ConfigurationBuilder = chocolatey.infrastructure.app.builders.ConfigurationBuilder; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.licensing; +using Moq; +using NUnit.Framework; +using Container = SimpleInjector.Container; +using License = System.ComponentModel.License; +using chocolatey.infrastructure.registration; +using Microsoft.Win32; +using chocolatey.tests.integration.scenarios; +using FluentAssertions; + namespace chocolatey.tests.integration.infrastructure.app.builders { - using System; - using System.Collections.Generic; - using System.Configuration; - using chocolatey.infrastructure.adapters; - using chocolatey.infrastructure.app; - using ConfigurationBuilder = chocolatey.infrastructure.app.builders.ConfigurationBuilder; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.domain; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.licensing; - using Moq; - using NUnit.Framework; - using Container = SimpleInjector.Container; - using License = System.ComponentModel.License; - using chocolatey.infrastructure.registration; - using Microsoft.Win32; - using scenarios; - using FluentAssertions; - public class ConfigurationBuilderSpecs { private const string IgnoreSystemProxyReason = "System Proxy not mockable"; diff --git a/src/chocolatey.tests.integration/infrastructure.app/services/FilesServiceSpecs.cs b/src/chocolatey.tests.integration/infrastructure.app/services/FilesServiceSpecs.cs index 65c37ccd95..a0301aa684 100644 --- a/src/chocolatey.tests.integration/infrastructure.app/services/FilesServiceSpecs.cs +++ b/src/chocolatey.tests.integration/infrastructure.app/services/FilesServiceSpecs.cs @@ -14,23 +14,23 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.IO; +using System.Linq; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.cryptography; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.results; +using chocolatey.infrastructure.services; +using Moq; +using NUnit.Framework; +using FluentAssertions; + namespace chocolatey.tests.integration.infrastructure.app.services { - using System; - using System.IO; - using System.Linq; - using chocolatey.infrastructure.app; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.domain; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.cryptography; - using chocolatey.infrastructure.filesystem; - using chocolatey.infrastructure.results; - using chocolatey.infrastructure.services; - using Moq; - using NUnit.Framework; - using FluentAssertions; - public class FilesServiceSpecs { public abstract class FilesServiceSpecsBase : TinySpec diff --git a/src/chocolatey.tests.integration/infrastructure/commands/CommandExecutorSpecs.cs b/src/chocolatey.tests.integration/infrastructure/commands/CommandExecutorSpecs.cs index 88f0559571..faf24515ac 100644 --- a/src/chocolatey.tests.integration/infrastructure/commands/CommandExecutorSpecs.cs +++ b/src/chocolatey.tests.integration/infrastructure/commands/CommandExecutorSpecs.cs @@ -14,15 +14,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.filesystem; +using NUnit.Framework; +using FluentAssertions; + namespace chocolatey.tests.integration.infrastructure.commands { - using System; - using chocolatey.infrastructure.app; - using chocolatey.infrastructure.commands; - using chocolatey.infrastructure.filesystem; - using NUnit.Framework; - using FluentAssertions; - public class CommandExecutorSpecs { public abstract class CommandExecutorSpecsBase : TinySpec diff --git a/src/chocolatey.tests.integration/infrastructure/cryptography/CryptoHashProviderSpecs.cs b/src/chocolatey.tests.integration/infrastructure/cryptography/CryptoHashProviderSpecs.cs index 8f601520d5..d44690d1e2 100644 --- a/src/chocolatey.tests.integration/infrastructure/cryptography/CryptoHashProviderSpecs.cs +++ b/src/chocolatey.tests.integration/infrastructure/cryptography/CryptoHashProviderSpecs.cs @@ -14,15 +14,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.IO; +using System.Security.Cryptography; +using chocolatey.infrastructure.cryptography; +using chocolatey.infrastructure.filesystem; +using FluentAssertions; + namespace chocolatey.tests.integration.infrastructure.cryptography { - using System; - using System.IO; - using System.Security.Cryptography; - using chocolatey.infrastructure.cryptography; - using chocolatey.infrastructure.filesystem; - using FluentAssertions; - public class CryptoHashProviderSpecs { public abstract class CryptoHashProviderSpecsBase : TinySpec diff --git a/src/chocolatey.tests.integration/infrastructure/filesystem/DotNetFileSystemSpecs.cs b/src/chocolatey.tests.integration/infrastructure/filesystem/DotNetFileSystemSpecs.cs index af2d2f778a..857e44ea2f 100644 --- a/src/chocolatey.tests.integration/infrastructure/filesystem/DotNetFileSystemSpecs.cs +++ b/src/chocolatey.tests.integration/infrastructure/filesystem/DotNetFileSystemSpecs.cs @@ -14,17 +14,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.IO; +using System.Linq; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.platforms; +using NUnit.Framework; +using FluentAssertions; +using FluentAssertions.Extensions; + namespace chocolatey.tests.integration.infrastructure.filesystem { - using System; - using System.IO; - using System.Linq; - using chocolatey.infrastructure.filesystem; - using chocolatey.infrastructure.platforms; - using NUnit.Framework; - using FluentAssertions; - using FluentAssertions.Extensions; - public class DotNetFileSystemSpecs { public abstract class DotNetFileSystemSpecsBase : TinySpec diff --git a/src/chocolatey.tests.integration/scenarios/InfoScenarios.cs b/src/chocolatey.tests.integration/scenarios/InfoScenarios.cs index d55561d026..54e6aced98 100644 --- a/src/chocolatey.tests.integration/scenarios/InfoScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/InfoScenarios.cs @@ -1,25 +1,25 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.platforms; +using chocolatey.infrastructure.results; + +using NuGet; +using NuGet.Configuration; + +using NUnit.Framework; + +using FluentAssertions; + namespace chocolatey.tests.integration.scenarios { - using System; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Reflection; - using System.Text; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.commands; - using chocolatey.infrastructure.platforms; - using chocolatey.infrastructure.results; - - using NuGet; - using NuGet.Configuration; - - using NUnit.Framework; - - using FluentAssertions; - public class InfoScenarios { [ConcernFor("info")] diff --git a/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs b/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs index f42660a397..896b5c47fb 100644 --- a/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs @@ -14,28 +14,28 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Xml.XPath; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.results; +using NuGet.Configuration; +using NuGet.Packaging; +using NUnit.Framework; +using FluentAssertions; +using FluentAssertions.Execution; +using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem; + namespace chocolatey.tests.integration.scenarios { - using System; - using System.Collections; - using System.Collections.Concurrent; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Text; - using System.Xml.XPath; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.commands; - using chocolatey.infrastructure.results; - using NuGet.Configuration; - using NuGet.Packaging; - using NUnit.Framework; - using FluentAssertions; - using FluentAssertions.Execution; - using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem; - public class InstallScenarios { [ConcernFor("install")] diff --git a/src/chocolatey.tests.integration/scenarios/ListScenarios.cs b/src/chocolatey.tests.integration/scenarios/ListScenarios.cs index ab016df449..cf72223c35 100644 --- a/src/chocolatey.tests.integration/scenarios/ListScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/ListScenarios.cs @@ -13,17 +13,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.results; +using NuGet.Configuration; +using FluentAssertions; +using FluentAssertions.Execution; + namespace chocolatey.tests.integration.scenarios { - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.results; - using NuGet.Configuration; - using FluentAssertions; - using FluentAssertions.Execution; - public class ListScenarios { [ConcernFor("list")] diff --git a/src/chocolatey.tests.integration/scenarios/PackScenarios.cs b/src/chocolatey.tests.integration/scenarios/PackScenarios.cs index eccf2ceaae..81cbf903cd 100644 --- a/src/chocolatey.tests.integration/scenarios/PackScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/PackScenarios.cs @@ -14,23 +14,23 @@ // See the License for the specific language governing permissions and // limitations under the License. -namespace chocolatey.tests.integration.scenarios -{ - using System; - using System.IO; - using System.Xml; +using System; +using System.IO; +using System.Xml; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.services; - using NuGet.Packaging; +using NuGet.Packaging; - using NUnit.Framework; +using NUnit.Framework; - using FluentAssertions; - using FluentAssertions.Execution; +using FluentAssertions; +using FluentAssertions.Execution; +namespace chocolatey.tests.integration.scenarios +{ public class PackScenarios { [ConcernFor("pack")] diff --git a/src/chocolatey.tests.integration/scenarios/PinScenarios.cs b/src/chocolatey.tests.integration/scenarios/PinScenarios.cs index bcdb743c64..7f1abdbf99 100644 --- a/src/chocolatey.tests.integration/scenarios/PinScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/PinScenarios.cs @@ -14,25 +14,25 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.results; + +using NUnit.Framework; + +using NuGet.Configuration; +using FluentAssertions; +using Moq; + namespace chocolatey.tests.integration.scenarios { - using System; - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.app; - using chocolatey.infrastructure.app.attributes; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.domain; - using chocolatey.infrastructure.commands; - using chocolatey.infrastructure.results; - - using NUnit.Framework; - - using NuGet.Configuration; - using FluentAssertions; - using Moq; - public class PinScenarios { [ConcernFor("pin")] diff --git a/src/chocolatey.tests.integration/scenarios/SearchScenarios.cs b/src/chocolatey.tests.integration/scenarios/SearchScenarios.cs index 69ce958dc9..c47a83a270 100644 --- a/src/chocolatey.tests.integration/scenarios/SearchScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/SearchScenarios.cs @@ -14,18 +14,18 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.results; +using NuGet.Configuration; +using NUnit.Framework; +using FluentAssertions; +using System.IO; + namespace chocolatey.tests.integration.scenarios { - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.results; - using NuGet.Configuration; - using NUnit.Framework; - using FluentAssertions; - using System.IO; - public class SearchScenarios { [ConcernFor("search")] diff --git a/src/chocolatey.tests.integration/scenarios/UninstallScenarios.cs b/src/chocolatey.tests.integration/scenarios/UninstallScenarios.cs index 5af4abc25b..d874eb4c5c 100644 --- a/src/chocolatey.tests.integration/scenarios/UninstallScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/UninstallScenarios.cs @@ -14,23 +14,23 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Concurrent; +using System.IO; +using System.Linq; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.results; +using NuGet.Configuration; +using NUnit.Framework; +using FluentAssertions; +using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem; + namespace chocolatey.tests.integration.scenarios { - using System; - using System.Collections.Concurrent; - using System.IO; - using System.Linq; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.commands; - using chocolatey.infrastructure.filesystem; - using chocolatey.infrastructure.results; - using NuGet.Configuration; - using NUnit.Framework; - using FluentAssertions; - using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem; - public class UninstallScenarios { [ConcernFor("uninstall")] diff --git a/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs b/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs index 8b3f127f75..ad93b8407c 100644 --- a/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs @@ -14,23 +14,23 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Xml.XPath; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.results; +using NuGet.Configuration; +using NuGet.Packaging; +using NUnit.Framework; +using FluentAssertions; + namespace chocolatey.tests.integration.scenarios { - using System; - using System.Collections.Concurrent; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Xml.XPath; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.filesystem; - using chocolatey.infrastructure.results; - using NuGet.Configuration; - using NuGet.Packaging; - using NUnit.Framework; - using FluentAssertions; - public class UpgradeScenarios { [ConcernFor("upgrade")] diff --git a/src/chocolatey.tests/MockLogger.cs b/src/chocolatey.tests/MockLogger.cs index 2d09c9562f..a17f368ec3 100644 --- a/src/chocolatey.tests/MockLogger.cs +++ b/src/chocolatey.tests/MockLogger.cs @@ -14,14 +14,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using chocolatey.infrastructure.logging; +using Moq; + namespace chocolatey.tests { - using System; - using System.Collections.Concurrent; - using System.Collections.Generic; - using chocolatey.infrastructure.logging; - using Moq; - public enum LogLevel { Debug, diff --git a/src/chocolatey.tests/TinySpec.cs b/src/chocolatey.tests/TinySpec.cs index c1e601d905..fe0f026048 100644 --- a/src/chocolatey.tests/TinySpec.cs +++ b/src/chocolatey.tests/TinySpec.cs @@ -16,15 +16,15 @@ // specific language governing permissions and limitations under the License. // ============================================================================== +using System; +using NUnit.Framework; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.logging; +using System.IO; +using chocolatey.infrastructure.app.nuget; + namespace chocolatey.tests { - using System; - using NUnit.Framework; - using chocolatey.infrastructure.app; - using chocolatey.infrastructure.logging; - using System.IO; - using chocolatey.infrastructure.app.nuget; - // ReSharper disable InconsistentNaming [SetUpFixture] diff --git a/src/chocolatey.tests/UNCHelper.cs b/src/chocolatey.tests/UNCHelper.cs index 2c5d03f03c..5a5ef93cf4 100644 --- a/src/chocolatey.tests/UNCHelper.cs +++ b/src/chocolatey.tests/UNCHelper.cs @@ -1,9 +1,9 @@ -namespace chocolatey.tests -{ - using System; - using System.IO; - using System.Net; +using System; +using System.IO; +using System.Net; +namespace chocolatey.tests +{ public static class UNCHelper { public static string ConvertLocalFolderPathToIpBasedUncPath(string localFolderName) diff --git a/src/chocolatey.tests/infrastructure.app/attributes/CommandForAttributeSpecs.cs b/src/chocolatey.tests/infrastructure.app/attributes/CommandForAttributeSpecs.cs index 5537cd387b..80ea07e23b 100644 --- a/src/chocolatey.tests/infrastructure.app/attributes/CommandForAttributeSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/attributes/CommandForAttributeSpecs.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using chocolatey.infrastructure.app.attributes; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.app.attributes { - using chocolatey.infrastructure.app.attributes; - using FluentAssertions; - public class CommandForAttributeSpecs { public abstract class CommandForAttributeSpecsBase : TinySpec diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyApiKeyCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyApiKeyCommandSpecs.cs index 1373e94def..cb05acb204 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyApiKeyCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyApiKeyCommandSpecs.cs @@ -14,20 +14,20 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.commandline; +using Moq; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.app.attributes; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.domain; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.commandline; - using Moq; - using FluentAssertions; - public class ChocolateyApiKeyCommandSpecs { [ConcernFor("apikey")] diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyCacheCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyCacheCommandSpecs.cs index 93f683e1c8..285b0b4e99 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyCacheCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyCacheCommandSpecs.cs @@ -1,18 +1,18 @@ -namespace chocolatey.tests.infrastructure.app.commands +using chocolatey.infrastructure.app.attributes; +using System.Collections.Generic; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.filesystem; +using Moq; +using System.Reflection; +using System.Linq; +using FluentAssertions; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.app.domain; +using FluentAssertions.Execution; + +namespace chocolatey.tests.infrastructure.app.commands { - using chocolatey.infrastructure.app.attributes; - using System.Collections.Generic; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.filesystem; - using Moq; - using System.Reflection; - using System.Linq; - using FluentAssertions; - using chocolatey.infrastructure.commandline; - using chocolatey.infrastructure.app.domain; - using FluentAssertions.Execution; - public class ChocolateyCacheCommandSpecs { [ConcernFor("cache")] diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyConfigCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyConfigCommandSpecs.cs index b91fcf2f0d..cf6122fc64 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyConfigCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyConfigCommandSpecs.cs @@ -14,20 +14,20 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.commandline; +using Moq; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.app.attributes; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.domain; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.commandline; - using Moq; - using FluentAssertions; - public class ChocolateyConfigCommandSpecs { [ConcernFor("config")] diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyExportCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyExportCommandSpecs.cs index 42a11d3821..b5b1b7254a 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyExportCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyExportCommandSpecs.cs @@ -14,20 +14,20 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.filesystem; +using Moq; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.app.attributes; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.commandline; - using chocolatey.infrastructure.filesystem; - using Moq; - using FluentAssertions; - public class ChocolateyExportCommandSpecs { [ConcernFor("export")] diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyFeatureCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyFeatureCommandSpecs.cs index 0cd14f6eb9..1833c855fe 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyFeatureCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyFeatureCommandSpecs.cs @@ -14,20 +14,20 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.commandline; +using Moq; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.app.attributes; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.domain; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.commandline; - using Moq; - using FluentAssertions; - public class ChocolateyFeatureCommandSpecs { [ConcernFor("feature")] diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyHelpCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyHelpCommandSpecs.cs index f9e7c1e70d..018cbb65bf 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyHelpCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyHelpCommandSpecs.cs @@ -14,15 +14,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.app.commands { - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.app.attributes; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using FluentAssertions; - public class ChocolateyHelpCommandSpecs { [ConcernFor("help")] diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyInfoCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyInfoCommandSpecs.cs index 58082f04de..064d0d1004 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyInfoCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyInfoCommandSpecs.cs @@ -14,19 +14,19 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.commandline; +using Moq; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.app.attributes; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.commandline; - using Moq; - using FluentAssertions; - public class ChocolateyInfoCommandSpecs { [ConcernFor("info")] diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyInstallCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyInstallCommandSpecs.cs index eec8ee1a19..7717599ad0 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyInstallCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyInstallCommandSpecs.cs @@ -14,20 +14,20 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.commandline; +using Moq; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.app.attributes; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.domain; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.commandline; - using Moq; - using FluentAssertions; - public class ChocolateyInstallCommandSpecs { [ConcernFor("install")] diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyListCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyListCommandSpecs.cs index 4c4a509e63..068cffd7a5 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyListCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyListCommandSpecs.cs @@ -13,19 +13,19 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.commandline; +using Moq; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.app.attributes; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.commandline; - using Moq; - using FluentAssertions; - public static class ChocolateyListCommandSpecs { [ConcernFor("list")] diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyNewCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyNewCommandSpecs.cs index 7dcfd35d4a..5f8aee20d9 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyNewCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyNewCommandSpecs.cs @@ -14,20 +14,20 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.app.templates; +using chocolatey.infrastructure.commandline; +using Moq; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.app.attributes; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.app.templates; - using chocolatey.infrastructure.commandline; - using Moq; - using FluentAssertions; - public class ChocolateyNewCommandSpecs { [ConcernFor("new")] diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyOutdatedCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyOutdatedCommandSpecs.cs index 492576b7b9..815b15df71 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyOutdatedCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyOutdatedCommandSpecs.cs @@ -14,18 +14,18 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.commandline; +using Moq; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.app.commands { - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.app.attributes; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.commandline; - using Moq; - using FluentAssertions; - public class ChocolateyOutdatedCommandSpecs { [ConcernFor("outdated")] diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPackCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPackCommandSpecs.cs index d3d3183120..e5da9ec485 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPackCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPackCommandSpecs.cs @@ -14,19 +14,19 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.commandline; +using Moq; +using FluentAssertions; +using System; + namespace chocolatey.tests.infrastructure.app.commands { - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.app.attributes; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.commandline; - using Moq; - using FluentAssertions; - using System; - public class ChocolateyPackCommandSpecs { [ConcernFor("pack")] diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPinCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPinCommandSpecs.cs index b85edd62da..ece60dea8a 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPinCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPinCommandSpecs.cs @@ -14,28 +14,28 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.results; +using Moq; +using NuGet.Common; +using NuGet.Packaging; +using NuGet.Versioning; + +using NUnit.Framework; + +using FluentAssertions; + namespace chocolatey.tests.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.app; - using chocolatey.infrastructure.app.attributes; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.domain; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.commandline; - using chocolatey.infrastructure.results; - using Moq; - using NuGet.Common; - using NuGet.Packaging; - using NuGet.Versioning; - - using NUnit.Framework; - - using FluentAssertions; - public class ChocolateyPinCommandSpecs { [ConcernFor("pin")] diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPushCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPushCommandSpecs.cs index e3f87a6c8b..b42ba380c8 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPushCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPushCommandSpecs.cs @@ -14,21 +14,21 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.commandline; +using Moq; +using NUnit.Framework; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.app; - using chocolatey.infrastructure.app.attributes; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.commandline; - using Moq; - using NUnit.Framework; - using FluentAssertions; - public class ChocolateyPushCommandSpecs { [ConcernFor("push")] diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateySearchCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateySearchCommandSpecs.cs index ef8315c0e0..37c66d4a04 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateySearchCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateySearchCommandSpecs.cs @@ -14,19 +14,19 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.commandline; +using Moq; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.app.attributes; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.commandline; - using Moq; - using FluentAssertions; - public class ChocolateySearchCommandSpecs { [ConcernFor("search")] diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateySourceCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateySourceCommandSpecs.cs index 12a61594e4..be85240a27 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateySourceCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateySourceCommandSpecs.cs @@ -14,20 +14,20 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.commandline; +using Moq; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.app.attributes; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.domain; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.commandline; - using Moq; - using FluentAssertions; - public class ChocolateySourceCommandSpecs { [ConcernFor("source")] diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyTemplateCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyTemplateCommandSpecs.cs index 9ac08eaef6..c906624aeb 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyTemplateCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyTemplateCommandSpecs.cs @@ -1,34 +1,34 @@ -// Copyright © 2017 - 2021 Chocolatey Software, Inc -// Copyright © 2011 - 2017 RealDimensions Software, LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - +// Copyright © 2017 - 2021 Chocolatey Software, Inc +// Copyright © 2011 - 2017 RealDimensions Software, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.filesystem; +using Moq; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.app.attributes; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.domain; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.commandline; - using chocolatey.infrastructure.filesystem; - using Moq; - using FluentAssertions; - public class ChocolateyTemplateCommandSpecs { [ConcernFor("template")] diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyUninstallCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyUninstallCommandSpecs.cs index bd845698fb..3442cacdd8 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyUninstallCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyUninstallCommandSpecs.cs @@ -14,20 +14,20 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.commandline; +using Moq; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.app.attributes; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.domain; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.commandline; - using Moq; - using FluentAssertions; - public class ChocolateyUninstallCommandSpecs { [ConcernFor("uninstall")] diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyUnpackSelfCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyUnpackSelfCommandSpecs.cs index 98a44eb6b3..3bab755c38 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyUnpackSelfCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyUnpackSelfCommandSpecs.cs @@ -14,19 +14,19 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.filesystem; +using Moq; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.adapters; - using chocolatey.infrastructure.app.attributes; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.filesystem; - using Moq; - using FluentAssertions; - public class ChocolateyUnpackSelfCommandSpecs { [ConcernFor("unpackself")] diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyUpgradeCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyUpgradeCommandSpecs.cs index 3cacb24ffa..7645d06424 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyUpgradeCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyUpgradeCommandSpecs.cs @@ -14,20 +14,20 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.commandline; +using Moq; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.app.attributes; - using chocolatey.infrastructure.app.commands; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.domain; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.commandline; - using Moq; - using FluentAssertions; - public class ChocolateyUpgradeCommandSpecs { [ConcernFor("upgrade")] diff --git a/src/chocolatey.tests/infrastructure.app/configuration/ConfigurationOptionsSpec.cs b/src/chocolatey.tests/infrastructure.app/configuration/ConfigurationOptionsSpec.cs index ca131092de..eba1c4e50a 100644 --- a/src/chocolatey.tests/infrastructure.app/configuration/ConfigurationOptionsSpec.cs +++ b/src/chocolatey.tests/infrastructure.app/configuration/ConfigurationOptionsSpec.cs @@ -14,19 +14,19 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.commandline; +using Moq; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.app.configuration { - using System; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Text; - using chocolatey.infrastructure.adapters; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.commandline; - using Moq; - using FluentAssertions; - public class ConfigurationOptionsSpec { public abstract class ConfigurationOptionsSpecBase : TinySpec diff --git a/src/chocolatey.tests/infrastructure.app/nuget/ChocolateyNuGetProjectContextSpecs.cs b/src/chocolatey.tests/infrastructure.app/nuget/ChocolateyNuGetProjectContextSpecs.cs index 371bcf5c16..ebbd015ef0 100644 --- a/src/chocolatey.tests/infrastructure.app/nuget/ChocolateyNuGetProjectContextSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/nuget/ChocolateyNuGetProjectContextSpecs.cs @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.nuget; +using Moq; +using NuGet.Common; +using NuGet.ProjectManagement; +using NUnit.Framework; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.app.nuget { - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.nuget; - using Moq; - using NuGet.Common; - using NuGet.ProjectManagement; - using NUnit.Framework; - using FluentAssertions; - public class ChocolateyNuGetProjectContextSpecs { public abstract class ChocolateyNuGetProjectContextSpecsBase : TinySpec @@ -84,8 +84,8 @@ public void Should_log_info_information_in_child_logger() //Logger.VerifyNoOtherCalls(); } - [TestCase(LogLevel.Debug)] - public void Should_log_to_child_logger_and_pass_along_original_message(LogLevel logLevel) + [TestCase(NuGet.Common.LogLevel.Debug)] + public void Should_log_to_child_logger_and_pass_along_original_message(NuGet.Common.LogLevel logLevel) { var logMessage = new LogMessage(logLevel, "My awesome message"); @@ -122,7 +122,7 @@ public void Should_report_errors_to_child_logger() [Fact] public void Should_report_errors_with_message_to_child_logger() { - var logMessage = new LogMessage(LogLevel.Debug, "Some message"); + var logMessage = new LogMessage(NuGet.Common.LogLevel.Debug, "Some message"); Service.ReportError(logMessage); diff --git a/src/chocolatey.tests/infrastructure.app/nuget/ChocolateyNugetLoggerSpecs.cs b/src/chocolatey.tests/infrastructure.app/nuget/ChocolateyNugetLoggerSpecs.cs index 643c7c3b22..cf235d75c3 100644 --- a/src/chocolatey.tests/infrastructure.app/nuget/ChocolateyNugetLoggerSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/nuget/ChocolateyNugetLoggerSpecs.cs @@ -13,18 +13,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -namespace chocolatey.tests.infrastructure.app.nuget -{ - using System; - using System.Threading.Tasks; - using chocolatey.infrastructure.app.nuget; - using NuGet.Common; - using NUnit.Framework; - using FluentAssertions; +using System; +using System.Threading.Tasks; +using chocolatey.infrastructure.app.nuget; +using NuGet.Common; +using NUnit.Framework; +using FluentAssertions; - using LogLevel = chocolatey.tests.LogLevel; - using NuGetLogLevel = NuGet.Common.LogLevel; +using LogLevel = chocolatey.tests.LogLevel; +using NuGetLogLevel = NuGet.Common.LogLevel; +namespace chocolatey.tests.infrastructure.app.nuget +{ public class ChocolateyNugetLoggerSpecs { [Categories.Logging] diff --git a/src/chocolatey.tests/infrastructure.app/nuget/NugetCommonSpecs.cs b/src/chocolatey.tests/infrastructure.app/nuget/NugetCommonSpecs.cs index 3958a9a21a..b6de1d9ea1 100644 --- a/src/chocolatey.tests/infrastructure.app/nuget/NugetCommonSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/nuget/NugetCommonSpecs.cs @@ -14,22 +14,22 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.nuget; +using chocolatey.infrastructure.filesystem; +using Moq; +using NuGet.Common; +using NuGet.Packaging; +using NuGet.Protocol; +using NuGet.Protocol.Core.Types; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.app.nuget { - using System; - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.app; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.nuget; - using chocolatey.infrastructure.filesystem; - using Moq; - using NuGet.Common; - using NuGet.Packaging; - using NuGet.Protocol; - using NuGet.Protocol.Core.Types; - using FluentAssertions; - public class NugetCommonSpecs { private class When_gets_remote_repository : TinySpec diff --git a/src/chocolatey.tests/infrastructure.app/services/AutomaticUninstallerServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/AutomaticUninstallerServiceSpecs.cs index 8be49c1cf9..5785b34083 100644 --- a/src/chocolatey.tests/infrastructure.app/services/AutomaticUninstallerServiceSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/services/AutomaticUninstallerServiceSpecs.cs @@ -14,27 +14,27 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.app.domain.installers; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.results; +using Moq; +using NuGet.Packaging; +using NuGet.Versioning; +using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem; + namespace chocolatey.tests.infrastructure.app.services { - using System; - using System.Collections.Concurrent; - using System.Collections.Generic; - using System.Diagnostics; - using System.IO; - using System.Linq; - using chocolatey.infrastructure.adapters; - using chocolatey.infrastructure.app; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.domain; - using chocolatey.infrastructure.app.domain.installers; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.commands; - using chocolatey.infrastructure.results; - using Moq; - using NuGet.Packaging; - using NuGet.Versioning; - using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem; - public class AutomaticUninstallerServiceSpecs { public abstract class AutomaticUninstallerServiceSpecsBase : TinySpec diff --git a/src/chocolatey.tests/infrastructure.app/services/ChocolateyConfigSettingsServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/ChocolateyConfigSettingsServiceSpecs.cs index 72e69d6c79..ae4c670b3c 100644 --- a/src/chocolatey.tests/infrastructure.app/services/ChocolateyConfigSettingsServiceSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/services/ChocolateyConfigSettingsServiceSpecs.cs @@ -1,15 +1,15 @@ -namespace chocolatey.tests.integration.infrastructure.app.services +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.services; +using Moq; +using FluentAssertions; + +namespace chocolatey.tests.integration.infrastructure.app.services { - using System; - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.app; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.services; - using Moq; - using FluentAssertions; - public class ChocolateyConfigSettingsServiceSpecs { public abstract class ChocolateyConfigSettingsServiceSpecsBase : TinySpec diff --git a/src/chocolatey.tests/infrastructure.app/services/ChocolateyPackageServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/ChocolateyPackageServiceSpecs.cs index 8a708029a3..d972ea0b33 100644 --- a/src/chocolatey.tests/infrastructure.app/services/ChocolateyPackageServiceSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/services/ChocolateyPackageServiceSpecs.cs @@ -29,13 +29,12 @@ using NUnit.Framework; using FluentAssertions; using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem; +using System.IO; +using chocolatey.infrastructure.app.registration; +using NuGet.Packaging; namespace chocolatey.tests.infrastructure.app.services { - using System.IO; - using chocolatey.infrastructure.app.registration; - using NuGet.Packaging; - public class ChocolateyPackageServiceSpecs { public abstract class ChocolateyPackageServiceSpecsBase : TinySpec diff --git a/src/chocolatey.tests/infrastructure.app/services/FilesServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/FilesServiceSpecs.cs index 86b872b66d..34df43e29f 100644 --- a/src/chocolatey.tests/infrastructure.app/services/FilesServiceSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/services/FilesServiceSpecs.cs @@ -14,22 +14,22 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.IO; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.cryptography; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.results; +using chocolatey.infrastructure.services; +using Moq; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.app.services { - using System; - using System.Collections.Generic; - using System.IO; - using chocolatey.infrastructure.app; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.domain; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.cryptography; - using chocolatey.infrastructure.filesystem; - using chocolatey.infrastructure.results; - using chocolatey.infrastructure.services; - using Moq; - using FluentAssertions; - public class FilesServiceSpecs { public abstract class FilesServiceSpecsBase : TinySpec diff --git a/src/chocolatey.tests/infrastructure.app/services/NugetServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/NugetServiceSpecs.cs index f9ce4ac18d..570405b0a2 100644 --- a/src/chocolatey.tests/infrastructure.app/services/NugetServiceSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/services/NugetServiceSpecs.cs @@ -14,22 +14,22 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.services; +using Moq; +using NuGet.Common; +using NuGet.Packaging; +using FluentAssertions; +using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem; + namespace chocolatey.tests.infrastructure.app.services { - using System; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.domain; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.services; - using Moq; - using NuGet.Common; - using NuGet.Packaging; - using FluentAssertions; - using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem; - public class NugetServiceSpecs { public abstract class NugetServiceSpecsBase : TinySpec diff --git a/src/chocolatey.tests/infrastructure.app/services/RegistryServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/RegistryServiceSpecs.cs index 16a0657018..dce0671520 100644 --- a/src/chocolatey.tests/infrastructure.app/services/RegistryServiceSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/services/RegistryServiceSpecs.cs @@ -14,17 +14,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.services; +using Microsoft.Win32; +using Moq; +using NUnit.Framework; +using FluentAssertions; +using Registry = chocolatey.infrastructure.app.domain.Registry; + namespace chocolatey.tests.infrastructure.app.services { - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.filesystem; - using chocolatey.infrastructure.services; - using Microsoft.Win32; - using Moq; - using NUnit.Framework; - using FluentAssertions; - using Registry = chocolatey.infrastructure.app.domain.Registry; - public class RegistryServiceSpecs { public abstract class RegistryServiceSpecsBase : TinySpec diff --git a/src/chocolatey.tests/infrastructure.app/services/RulesServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/RulesServiceSpecs.cs index a5a63dcd01..b92f8a4eb1 100644 --- a/src/chocolatey.tests/infrastructure.app/services/RulesServiceSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/services/RulesServiceSpecs.cs @@ -14,18 +14,18 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.rules; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.rules; +using chocolatey.infrastructure.services; +using FluentAssertions; +using NuGet.Packaging; + namespace chocolatey.tests.infrastructure.app.services { - using System; - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.app.rules; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.rules; - using chocolatey.infrastructure.services; - using FluentAssertions; - using NuGet.Packaging; - public class RulesServiceSpecs { [Categories.RuleEngine] diff --git a/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs index 1fd4a09811..ef99df6201 100644 --- a/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs @@ -14,25 +14,25 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.app.templates; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.services; +using Moq; +using NuGet.Common; +using NUnit.Framework; +using FluentAssertions; +using LogLevel = chocolatey.tests.LogLevel; + namespace chocolatey.tests.infrastructure.app.services { - using System; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Text; - using chocolatey.infrastructure.app; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.app.templates; - using chocolatey.infrastructure.filesystem; - using chocolatey.infrastructure.services; - using Moq; - using NuGet.Common; - using NUnit.Framework; - using FluentAssertions; - using LogLevel = tests.LogLevel; - public class TemplateServiceSpecs { public abstract class TemplateServiceSpecsBase : TinySpec diff --git a/src/chocolatey.tests/infrastructure.app/utility/ArgumentsUtilitySpecs.cs b/src/chocolatey.tests/infrastructure.app/utility/ArgumentsUtilitySpecs.cs index a21daa2b91..1ee35004ca 100644 --- a/src/chocolatey.tests/infrastructure.app/utility/ArgumentsUtilitySpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/utility/ArgumentsUtilitySpecs.cs @@ -1,9 +1,9 @@ -namespace chocolatey.tests.infrastructure.app.utility -{ - using chocolatey.infrastructure.app.utility; - using NUnit.Framework; - using FluentAssertions; +using chocolatey.infrastructure.app.utility; +using NUnit.Framework; +using FluentAssertions; +namespace chocolatey.tests.infrastructure.app.utility +{ public class ArgumentsUtilitySpecs { public abstract class ArgumentsUtilitySpecsBase : TinySpec diff --git a/src/chocolatey.tests/infrastructure.app/utility/PackageUtilitySpecs.cs b/src/chocolatey.tests/infrastructure.app/utility/PackageUtilitySpecs.cs index 5a49ad2e29..f244ddefce 100644 --- a/src/chocolatey.tests/infrastructure.app/utility/PackageUtilitySpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/utility/PackageUtilitySpecs.cs @@ -1,26 +1,26 @@ -// Copyright © 2021 - 2021 Chocolatey Software, Inc -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - +// Copyright © 2021 - 2021 Chocolatey Software, Inc +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using chocolatey.infrastructure.app.utility; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.platforms; +using NUnit.Framework; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.app.utility { - using chocolatey.infrastructure.app.utility; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.platforms; - using NUnit.Framework; - using FluentAssertions; - public class PackageUtilitySpecs { public abstract class PackageUtilitySpecsBase : TinySpec diff --git a/src/chocolatey.tests/infrastructure/commandline/InteractivePromptSpecs.cs b/src/chocolatey.tests/infrastructure/commandline/InteractivePromptSpecs.cs index b6d2f7bda4..db3d4949ba 100644 --- a/src/chocolatey.tests/infrastructure/commandline/InteractivePromptSpecs.cs +++ b/src/chocolatey.tests/infrastructure/commandline/InteractivePromptSpecs.cs @@ -14,15 +14,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.commandline; +using Moq; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.commandline { - using System; - using System.Collections.Generic; - using chocolatey.infrastructure.adapters; - using chocolatey.infrastructure.commandline; - using Moq; - using FluentAssertions; - public class InteractivePromptSpecs { public abstract class InteractivePromptSpecsBase : TinySpec diff --git a/src/chocolatey.tests/infrastructure/commands/CommandExecutorSpecs.cs b/src/chocolatey.tests/infrastructure/commands/CommandExecutorSpecs.cs index 7aadb87cf5..6c160b2218 100644 --- a/src/chocolatey.tests/infrastructure/commands/CommandExecutorSpecs.cs +++ b/src/chocolatey.tests/infrastructure/commands/CommandExecutorSpecs.cs @@ -14,16 +14,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.filesystem; +using Moq; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.commands { - using System; - using chocolatey.infrastructure.adapters; - using chocolatey.infrastructure.app; - using chocolatey.infrastructure.commands; - using chocolatey.infrastructure.filesystem; - using Moq; - using FluentAssertions; - public class CommandExecutorSpecs { public abstract class CommandExecutorSpecsBase : TinySpec diff --git a/src/chocolatey.tests/infrastructure/commands/ExternalCommandArgsBuilderSpecs.cs b/src/chocolatey.tests/infrastructure/commands/ExternalCommandArgsBuilderSpecs.cs index 969834789d..e27b445453 100644 --- a/src/chocolatey.tests/infrastructure/commands/ExternalCommandArgsBuilderSpecs.cs +++ b/src/chocolatey.tests/infrastructure/commands/ExternalCommandArgsBuilderSpecs.cs @@ -14,14 +14,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.commands; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.commands { - using System; - using System.Collections.Generic; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.commands; - using FluentAssertions; - public class ExternalCommandArgsBuilderSpecs { public class When_using_ExternalCommandArgsBuilder : TinySpec diff --git a/src/chocolatey.tests/infrastructure/commands/PowershellExecutorSpecs.cs b/src/chocolatey.tests/infrastructure/commands/PowershellExecutorSpecs.cs index 49f8c254d8..a60d688f9b 100644 --- a/src/chocolatey.tests/infrastructure/commands/PowershellExecutorSpecs.cs +++ b/src/chocolatey.tests/infrastructure/commands/PowershellExecutorSpecs.cs @@ -14,16 +14,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.IO; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.filesystem; +using Moq; +using NUnit.Framework; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.commands { - using System; - using System.IO; - using chocolatey.infrastructure.commands; - using chocolatey.infrastructure.filesystem; - using Moq; - using NUnit.Framework; - using FluentAssertions; - public class PowershellExecutorSpecs { public abstract class PowerShellExecutorSpecsBase : TinySpec diff --git a/src/chocolatey.tests/infrastructure/configuration/ConfigSpecs.cs b/src/chocolatey.tests/infrastructure/configuration/ConfigSpecs.cs index 038ac90513..a9c78c2b7a 100644 --- a/src/chocolatey.tests/infrastructure/configuration/ConfigSpecs.cs +++ b/src/chocolatey.tests/infrastructure/configuration/ConfigSpecs.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.configuration; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.configuration { - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.configuration; - using FluentAssertions; - public class ConfigSpecs { public abstract class ConfigSpecsBase : TinySpec diff --git a/src/chocolatey.tests/infrastructure/cryptography/CryptoHashProviderSpecs.cs b/src/chocolatey.tests/infrastructure/cryptography/CryptoHashProviderSpecs.cs index 76f48ba3a3..ece526e454 100644 --- a/src/chocolatey.tests/infrastructure/cryptography/CryptoHashProviderSpecs.cs +++ b/src/chocolatey.tests/infrastructure/cryptography/CryptoHashProviderSpecs.cs @@ -14,18 +14,18 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.IO; +using System.Security.Cryptography; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.cryptography; +using chocolatey.infrastructure.filesystem; +using Moq; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.cryptography { - using System; - using System.IO; - using System.Security.Cryptography; - using chocolatey.infrastructure.adapters; - using chocolatey.infrastructure.app; - using chocolatey.infrastructure.cryptography; - using chocolatey.infrastructure.filesystem; - using Moq; - using FluentAssertions; - public class CryptoHashProviderSpecs { public abstract class CryptoHashProviderSpecsBase : TinySpec diff --git a/src/chocolatey.tests/infrastructure/events/EventSubscriptionManagerSpecs.cs b/src/chocolatey.tests/infrastructure/events/EventSubscriptionManagerSpecs.cs index 67a0512052..15b3c88456 100644 --- a/src/chocolatey.tests/infrastructure/events/EventSubscriptionManagerSpecs.cs +++ b/src/chocolatey.tests/infrastructure/events/EventSubscriptionManagerSpecs.cs @@ -14,16 +14,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Threading; +using chocolatey.infrastructure.services; +using chocolatey.tests.infrastructure.events.context; +using NUnit.Framework; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.events { - using System; - using System.Collections.Generic; - using System.Threading; - using chocolatey.infrastructure.services; - using context; - using NUnit.Framework; - using FluentAssertions; - public class EventSubscriptionManagerSpecs { public abstract class EventSubscriptionManagerSpecsBase : TinySpec diff --git a/src/chocolatey.tests/infrastructure/events/context/FakeEvent.cs b/src/chocolatey.tests/infrastructure/events/context/FakeEvent.cs index 560752ddaa..5968b591b9 100644 --- a/src/chocolatey.tests/infrastructure/events/context/FakeEvent.cs +++ b/src/chocolatey.tests/infrastructure/events/context/FakeEvent.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using chocolatey.infrastructure.events; + namespace chocolatey.tests.infrastructure.events.context { - using chocolatey.infrastructure.events; - public class FakeEvent : IMessage { public FakeEvent(string name, double digits) diff --git a/src/chocolatey.tests/infrastructure/events/context/FakeSubscriber.cs b/src/chocolatey.tests/infrastructure/events/context/FakeSubscriber.cs index eae6170814..b8f2a9a629 100644 --- a/src/chocolatey.tests/infrastructure/events/context/FakeSubscriber.cs +++ b/src/chocolatey.tests/infrastructure/events/context/FakeSubscriber.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using chocolatey.infrastructure.services; + namespace chocolatey.tests.infrastructure.events.context { - using System; - using chocolatey.infrastructure.services; - public class FakeSubscriber { public FakeSubscriber(IEventSubscriptionManagerService subscriptionManager) diff --git a/src/chocolatey.tests/infrastructure/filesystem/DotNetFileSystemSpecs.cs b/src/chocolatey.tests/infrastructure/filesystem/DotNetFileSystemSpecs.cs index 1a17273cce..d3a8be0b69 100644 --- a/src/chocolatey.tests/infrastructure/filesystem/DotNetFileSystemSpecs.cs +++ b/src/chocolatey.tests/infrastructure/filesystem/DotNetFileSystemSpecs.cs @@ -14,18 +14,18 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.IO; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.platforms; +using Moq; +using NUnit.Framework; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.filesystem { - using System; - using System.IO; - using chocolatey.infrastructure.adapters; - using chocolatey.infrastructure.app; - using chocolatey.infrastructure.filesystem; - using chocolatey.infrastructure.platforms; - using Moq; - using NUnit.Framework; - using FluentAssertions; - public class DotNetFileSystemSpecs { public abstract class DotNetFileSystemSpecsBase : TinySpec diff --git a/src/chocolatey.tests/infrastructure/guards/EnsureSpecs.cs b/src/chocolatey.tests/infrastructure/guards/EnsureSpecs.cs index 5a0d5d2055..fd168da681 100644 --- a/src/chocolatey.tests/infrastructure/guards/EnsureSpecs.cs +++ b/src/chocolatey.tests/infrastructure/guards/EnsureSpecs.cs @@ -14,14 +14,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.guards; +using Moq; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.guards { - using System; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.guards; - using Moq; - using FluentAssertions; - public class EnsureSpecs { public abstract class EnsureSpecsBase : TinySpec diff --git a/src/chocolatey.tests/infrastructure/information/VersionInformationSpecs.cs b/src/chocolatey.tests/infrastructure/information/VersionInformationSpecs.cs index 0d76f7c528..cf292bb33b 100644 --- a/src/chocolatey.tests/infrastructure/information/VersionInformationSpecs.cs +++ b/src/chocolatey.tests/infrastructure/information/VersionInformationSpecs.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using chocolatey.infrastructure.information; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.information { - using System; - using chocolatey.infrastructure.information; - using FluentAssertions; - public class VersionInformationSpecs { public abstract class VersionInformationSpecsBase : TinySpec diff --git a/src/chocolatey.tests/infrastructure/platforms/PlatformSpecs.cs b/src/chocolatey.tests/infrastructure/platforms/PlatformSpecs.cs index 5e4e2724fd..d2fb8fe6b6 100644 --- a/src/chocolatey.tests/infrastructure/platforms/PlatformSpecs.cs +++ b/src/chocolatey.tests/infrastructure/platforms/PlatformSpecs.cs @@ -14,16 +14,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.platforms; +using Moq; +using FluentAssertions; +using Environment = System.Environment; + namespace chocolatey.tests.infrastructure.platforms { - using System; - using chocolatey.infrastructure.adapters; - using chocolatey.infrastructure.filesystem; - using chocolatey.infrastructure.platforms; - using Moq; - using FluentAssertions; - using Environment = System.Environment; - public class PlatformSpecs { public abstract class PlatformSpecsBase : TinySpec diff --git a/src/chocolatey.tests/infrastructure/tokens/TokenReplacerSpecs.cs b/src/chocolatey.tests/infrastructure/tokens/TokenReplacerSpecs.cs index 1340d086d3..12101c1930 100644 --- a/src/chocolatey.tests/infrastructure/tokens/TokenReplacerSpecs.cs +++ b/src/chocolatey.tests/infrastructure/tokens/TokenReplacerSpecs.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.tokens; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.tokens { - using System.Collections.Generic; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.tokens; - using FluentAssertions; - public class TokenReplacerSpecs { public abstract class TokenReplacerSpecsBase : TinySpec diff --git a/src/chocolatey.tests/infrastructure/tolerance/FaultToleranceSpecs.cs b/src/chocolatey.tests/infrastructure/tolerance/FaultToleranceSpecs.cs index aee538c8f0..31187dbd51 100644 --- a/src/chocolatey.tests/infrastructure/tolerance/FaultToleranceSpecs.cs +++ b/src/chocolatey.tests/infrastructure/tolerance/FaultToleranceSpecs.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using chocolatey.infrastructure.tolerance; +using NUnit.Framework; +using FluentAssertions; + namespace chocolatey.tests.infrastructure.tolerance { - using System; - using chocolatey.infrastructure.tolerance; - using NUnit.Framework; - using FluentAssertions; - public class FaultToleranceSpecs { public abstract class FaultToleranceSpecsBase : TinySpec diff --git a/src/chocolatey/AssemblyExtensions.cs b/src/chocolatey/AssemblyExtensions.cs index efc47ec119..6dd0bc8fc9 100644 --- a/src/chocolatey/AssemblyExtensions.cs +++ b/src/chocolatey/AssemblyExtensions.cs @@ -14,17 +14,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using chocolatey.infrastructure.app.registration; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.adapters; + namespace chocolatey { - using System; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Reflection; - using chocolatey.infrastructure.app.registration; - using chocolatey.infrastructure.logging; - using infrastructure.adapters; - /// /// Extensions for Assembly /// diff --git a/src/chocolatey/EnumExtensions.cs b/src/chocolatey/EnumExtensions.cs index 0950b235bd..4cd7989e17 100644 --- a/src/chocolatey/EnumExtensions.cs +++ b/src/chocolatey/EnumExtensions.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.ComponentModel; +using System.Linq; +using System.Reflection; + namespace chocolatey { - using System; - using System.ComponentModel; - using System.Linq; - using System.Reflection; - /// /// Extensions for Enum /// diff --git a/src/chocolatey/EnumerableExtensions.cs b/src/chocolatey/EnumerableExtensions.cs index db17c3bd6e..e9e6c5cfbc 100644 --- a/src/chocolatey/EnumerableExtensions.cs +++ b/src/chocolatey/EnumerableExtensions.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + namespace chocolatey { - using System; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - /// /// Extensions for IEnumerable /// diff --git a/src/chocolatey/ExceptionExtensions.cs b/src/chocolatey/ExceptionExtensions.cs index eda7e450a9..80ab2a5e89 100644 --- a/src/chocolatey/ExceptionExtensions.cs +++ b/src/chocolatey/ExceptionExtensions.cs @@ -1,11 +1,11 @@ -namespace chocolatey +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace chocolatey { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Threading.Tasks; - public static class ExceptionExtensions { public static IEnumerable Enumerate(this Exception error) diff --git a/src/chocolatey/FileSystemExtensions.cs b/src/chocolatey/FileSystemExtensions.cs index af6b198caa..be37fefd90 100644 --- a/src/chocolatey/FileSystemExtensions.cs +++ b/src/chocolatey/FileSystemExtensions.cs @@ -14,18 +14,18 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.registration; + namespace chocolatey { - using System; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using chocolatey.infrastructure.adapters; - using chocolatey.infrastructure.app; - using chocolatey.infrastructure.filesystem; - using chocolatey.infrastructure.logging; - using chocolatey.infrastructure.registration; - public static class FileSystemExtensions { internal static IEnumerable GetExtensionAssemblies(this IFileSystem fileSystem) diff --git a/src/chocolatey/GetChocolatey.cs b/src/chocolatey/GetChocolatey.cs index d66320d537..a4fbbc7f4d 100644 --- a/src/chocolatey/GetChocolatey.cs +++ b/src/chocolatey/GetChocolatey.cs @@ -14,36 +14,36 @@ // See the License for the specific language governing permissions and // limitations under the License. -namespace chocolatey -{ - using System; - using System.Collections.Generic; - using System.IO; - using System.Reflection; - using infrastructure.licensing; - using SimpleInjector; - using infrastructure.app; - using infrastructure.app.builders; - using infrastructure.app.configuration; - using infrastructure.app.runners; - using infrastructure.configuration; - using infrastructure.extractors; - using infrastructure.logging; - using infrastructure.registration; - using infrastructure.synchronization; - using log4net; +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using chocolatey.infrastructure.licensing; +using SimpleInjector; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.app.builders; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.runners; +using chocolatey.infrastructure.configuration; +using chocolatey.infrastructure.extractors; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.registration; +using chocolatey.infrastructure.synchronization; +using log4net; #if !NoResources - using resources; +using chocolatey.resources; #endif - using Assembly = infrastructure.adapters.Assembly; - using IFileSystem = infrastructure.filesystem.IFileSystem; - using ILog = infrastructure.logging.ILog; - using System.Linq; +using Assembly = chocolatey.infrastructure.adapters.Assembly; +using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem; +using ILog = chocolatey.infrastructure.logging.ILog; +using System.Linq; +namespace chocolatey +{ /// /// Entry point for API /// diff --git a/src/chocolatey/ILogExtensions.cs b/src/chocolatey/ILogExtensions.cs index cf382ebfd5..b10f2374bd 100644 --- a/src/chocolatey/ILogExtensions.cs +++ b/src/chocolatey/ILogExtensions.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Runtime; +using chocolatey.infrastructure.logging; + namespace chocolatey { - using System; - using System.Runtime; - using infrastructure.logging; - /// /// Extensions for ILog /// diff --git a/src/chocolatey/LogExtensions.cs b/src/chocolatey/LogExtensions.cs index ad3d990a81..f3ff4f4442 100644 --- a/src/chocolatey/LogExtensions.cs +++ b/src/chocolatey/LogExtensions.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Concurrent; +using chocolatey.infrastructure.logging; + namespace chocolatey { - using System; - using System.Collections.Concurrent; - using infrastructure.logging; - /// /// Extensions to help make logging awesome /// diff --git a/src/chocolatey/NuGetVersionExtensions.cs b/src/chocolatey/NuGetVersionExtensions.cs index abac470c41..62a0b467b4 100644 --- a/src/chocolatey/NuGetVersionExtensions.cs +++ b/src/chocolatey/NuGetVersionExtensions.cs @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using NuGet.Versioning; +using System; + namespace chocolatey { - using NuGet.Versioning; - using System; - /// /// Helper methods for dealing with the the nuget version returned by /// the NuGet.Client libraries to ensure they can be easily used. diff --git a/src/chocolatey/ObjectExtensions.cs b/src/chocolatey/ObjectExtensions.cs index 6233675e06..b4219ebc72 100644 --- a/src/chocolatey/ObjectExtensions.cs +++ b/src/chocolatey/ObjectExtensions.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.IO; +using System.Runtime.Serialization.Formatters.Binary; + namespace chocolatey { - using System; - using System.IO; - using System.Runtime.Serialization.Formatters.Binary; - /// /// Extensions for Object /// diff --git a/src/chocolatey/RuleResultExtensions.cs b/src/chocolatey/RuleResultExtensions.cs index 492d7c465b..638c68305e 100644 --- a/src/chocolatey/RuleResultExtensions.cs +++ b/src/chocolatey/RuleResultExtensions.cs @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.rules; + namespace chocolatey { - using System; - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.rules; - public static class RuleResultExtensions { /// diff --git a/src/chocolatey/StringExtensions.cs b/src/chocolatey/StringExtensions.cs index fba121736e..818d252334 100644 --- a/src/chocolatey/StringExtensions.cs +++ b/src/chocolatey/StringExtensions.cs @@ -14,21 +14,21 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Runtime.InteropServices; +using System.Security; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading; +using System.Web.UI; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.logging; + namespace chocolatey { - using System; - using System.Collections.Generic; - using System.Globalization; - using System.Linq; - using System.Runtime.InteropServices; - using System.Security; - using System.Text; - using System.Text.RegularExpressions; - using System.Threading; - using System.Web.UI; - using infrastructure.app; - using infrastructure.logging; - /// /// Extensions for string /// diff --git a/src/chocolatey/StringResources.cs b/src/chocolatey/StringResources.cs index 4bbf0f6c99..8f04a3e641 100644 --- a/src/chocolatey/StringResources.cs +++ b/src/chocolatey/StringResources.cs @@ -13,10 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.ComponentModel; + namespace chocolatey { - using System.ComponentModel; - public static class StringResources { /// diff --git a/src/chocolatey/TypeExtensions.cs b/src/chocolatey/TypeExtensions.cs index 3ee507f1b7..9e4ec5ea69 100644 --- a/src/chocolatey/TypeExtensions.cs +++ b/src/chocolatey/TypeExtensions.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; + namespace chocolatey { - using System; - /// /// Extensions for Type /// diff --git a/src/chocolatey/infrastructure.app/ApplicationParameters.cs b/src/chocolatey/infrastructure.app/ApplicationParameters.cs index 8f413ddab1..b9f9146b49 100644 --- a/src/chocolatey/infrastructure.app/ApplicationParameters.cs +++ b/src/chocolatey/infrastructure.app/ApplicationParameters.cs @@ -14,16 +14,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Security.Principal; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.filesystem; +using Environment = System.Environment; +using chocolatey.infrastructure.platforms; +using chocolatey.infrastructure.information; + namespace chocolatey.infrastructure.app { - using System; - using System.Security.Principal; - using adapters; - using filesystem; - using Environment = System.Environment; - using chocolatey.infrastructure.platforms; - using chocolatey.infrastructure.information; - /// /// Application constants and settings for the application /// diff --git a/src/chocolatey/infrastructure.app/attributes/CommandForAttribute.cs b/src/chocolatey/infrastructure.app/attributes/CommandForAttribute.cs index 927a108349..3ab30458da 100644 --- a/src/chocolatey/infrastructure.app/attributes/CommandForAttribute.cs +++ b/src/chocolatey/infrastructure.app/attributes/CommandForAttribute.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; + namespace chocolatey.infrastructure.app.attributes { - using System; - [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] public class CommandForAttribute : Attribute { diff --git a/src/chocolatey/infrastructure.app/attributes/MultiServiceAttribute.cs b/src/chocolatey/infrastructure.app/attributes/MultiServiceAttribute.cs index 2745bbb9da..3403c1f717 100644 --- a/src/chocolatey/infrastructure.app/attributes/MultiServiceAttribute.cs +++ b/src/chocolatey/infrastructure.app/attributes/MultiServiceAttribute.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; + namespace chocolatey.infrastructure.app.attributes { - using System; - [AttributeUsage(AttributeTargets.Interface, Inherited = true, AllowMultiple = false)] internal sealed class MultiServiceAttribute : Attribute { diff --git a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs index ce574f0829..2ff3449421 100644 --- a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs +++ b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs @@ -14,33 +14,33 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Reflection; +using System.Text; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.cryptography; +using chocolatey.infrastructure.extractors; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.information; +using chocolatey.infrastructure.services; +using chocolatey.infrastructure.licensing; +using chocolatey.infrastructure.logging; +using Microsoft.Win32; +using chocolatey.infrastructure.app.nuget; +using chocolatey.infrastructure.platforms; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.tolerance; +using Assembly = chocolatey.infrastructure.adapters.Assembly; +using Container = SimpleInjector.Container; +using Environment = chocolatey.infrastructure.adapters.Environment; + namespace chocolatey.infrastructure.app.builders { - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.Linq; - using System.Reflection; - using System.Text; - using adapters; - using chocolatey.infrastructure.app.commands; - using configuration; - using cryptography; - using extractors; - using filesystem; - using information; - using infrastructure.services; - using licensing; - using logging; - using Microsoft.Win32; - using nuget; - using platforms; - using services; - using tolerance; - using Assembly = adapters.Assembly; - using Container = SimpleInjector.Container; - using Environment = adapters.Environment; - /// /// Responsible for gathering all configuration related information and producing the ChocolateyConfig /// diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs index 13515f5a10..40da00fb0d 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs @@ -14,20 +14,20 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.configuration; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.app.services; + namespace chocolatey.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using attributes; - using chocolatey.infrastructure.app.domain; - using commandline; - using configuration; - using infrastructure.commands; - using infrastructure.configuration; - using logging; - using services; - [CommandFor("apikey", "retrieves, saves or deletes an API key for a particular source")] [CommandFor("setapikey", "retrieves, saves or deletes an API key for a particular source (alias for apikey)")] public class ChocolateyApiKeyCommand : ICommand diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyCacheCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyCacheCommand.cs index 002807b00d..e95917a70a 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyCacheCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyCacheCommand.cs @@ -13,21 +13,21 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.app.nuget; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.logging; + namespace chocolatey.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using chocolatey.infrastructure.app.attributes; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.domain; - using chocolatey.infrastructure.app.nuget; - using chocolatey.infrastructure.commandline; - using chocolatey.infrastructure.commands; - using chocolatey.infrastructure.filesystem; - using chocolatey.infrastructure.logging; - [CommandFor("cache", "Manage the local HTTP caches used to store queries", Version = "2.1.0")] public class ChocolateyCacheCommand : ChocolateyCommandBase, ICommand { diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyCommandBase.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyCommandBase.cs index 3697cdb696..e772359d0b 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyCommandBase.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyCommandBase.cs @@ -13,18 +13,18 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.logging; + namespace chocolatey.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Reflection; - using System.Text; - using chocolatey.infrastructure.app.attributes; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.commands; - using chocolatey.infrastructure.logging; - /// /// A base class for any Chocolatey commands which need to utilise shared logic. /// diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs index 48fa69d470..ae6c00f61d 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs @@ -14,20 +14,20 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.configuration; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.app.services; + namespace chocolatey.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using attributes; - using commandline; - using configuration; - using domain; - using infrastructure.commands; - using infrastructure.configuration; - using logging; - using services; - [CommandFor("config", "Retrieve and configure config file settings")] public class ChocolateyConfigCommand : ICommand { diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyExportCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyExportCommand.cs index 46302b6e60..888b341c23 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyExportCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyExportCommand.cs @@ -14,23 +14,23 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Text; +using System.Xml; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.tolerance; + namespace chocolatey.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Diagnostics; - using System.IO; - using System.Text; - using System.Xml; - using attributes; - using commandline; - using configuration; - using filesystem; - using infrastructure.commands; - using logging; - using services; - using tolerance; - [CommandFor("export", "exports list of currently installed packages")] public class ChocolateyExportCommand : ICommand { diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs index 036995b6db..c0adf6f6c3 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs @@ -14,20 +14,20 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.configuration; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.app.services; + namespace chocolatey.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using attributes; - using commandline; - using configuration; - using domain; - using infrastructure.commands; - using infrastructure.configuration; - using logging; - using services; - [CommandFor("feature", "view and configure choco features")] [CommandFor("features", "view and configure choco features (alias for feature)")] public class ChocolateyFeatureCommand : ICommand diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyHelpCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyHelpCommand.cs index fd22fe12bd..19b8f3f2a7 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyHelpCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyHelpCommand.cs @@ -14,19 +14,19 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.logging; +using SimpleInjector; + namespace chocolatey.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using attributes; - using commandline; - using configuration; - using infrastructure.commands; - using logging; - using SimpleInjector; - [CommandFor("help", "displays top level help information for choco")] public class ChocolateyHelpCommand : ICommand { diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs index cc32c98d74..d6c6204ef9 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs @@ -14,16 +14,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.app.services; + namespace chocolatey.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using attributes; - using commandline; - using configuration; - using logging; - using services; - [CommandFor("info", "retrieves package information. Shorthand for choco search pkgname --exact --verbose")] public class ChocolateyInfoCommand : ChocolateySearchCommand { diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs index fad1080df9..af5d646b7e 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs @@ -14,18 +14,18 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.app.services; + namespace chocolatey.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using attributes; - using commandline; - using configuration; - using infrastructure.commands; - using logging; - using services; - [CommandFor("install", "installs packages using configured sources")] public class ChocolateyInstallCommand : ChocolateyCommandBase, ICommand { diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs index a9a1c4ef1a..e1650bf0d1 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs @@ -13,20 +13,20 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.results; + namespace chocolatey.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.app.attributes; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.domain; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.commandline; - using chocolatey.infrastructure.commands; - using chocolatey.infrastructure.logging; - using chocolatey.infrastructure.results; - [CommandFor("list", "lists local packages")] public class ChocolateyListCommand : IListCommand { diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyNewCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyNewCommand.cs index 3c24cc51ea..9e9c817619 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyNewCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyNewCommand.cs @@ -14,19 +14,19 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.app.templates; + namespace chocolatey.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using attributes; - using commandline; - using configuration; - using infrastructure.commands; - using logging; - using services; - using templates; - [CommandFor("new", "creates template files for creating a new Chocolatey package")] public class ChocolateyNewCommand : ICommand { diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyOutdatedCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyOutdatedCommand.cs index e0238c4485..bf45ef4e0b 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyOutdatedCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyOutdatedCommand.cs @@ -14,17 +14,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.app.services; + namespace chocolatey.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using attributes; - using commandline; - using configuration; - using infrastructure.commands; - using logging; - using services; - [CommandFor("outdated", "retrieves information about packages that are outdated. Similar to upgrade all --noop")] public class ChocolateyOutdatedCommand : ICommand { diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyPackCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyPackCommand.cs index 9723772468..29fcf05ae8 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyPackCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyPackCommand.cs @@ -14,18 +14,18 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.app.services; + namespace chocolatey.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using attributes; - using commandline; - using configuration; - using infrastructure.commands; - using logging; - using services; - [CommandFor("pack", "packages nuspec, scripts, and other Chocolatey package resources into a nupkg file")] public class ChocolateyPackCommand : ICommand { diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs index ca2ec3d134..0cd37d4e3f 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs @@ -14,24 +14,24 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.configuration; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.app.nuget; +using NuGet.Common; +using NuGet.PackageManagement; +using NuGet.Versioning; +using chocolatey.infrastructure.app.services; + namespace chocolatey.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using attributes; - using commandline; - using configuration; - using domain; - using infrastructure.commands; - using infrastructure.configuration; - using logging; - using nuget; - using NuGet.Common; - using NuGet.PackageManagement; - using NuGet.Versioning; - using services; - [CommandFor("pin", "suppress upgrades for a package")] public class ChocolateyPinCommand : ICommand { diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs index fe67e3c581..50c08fcb8f 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs @@ -14,18 +14,18 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.app.services; + namespace chocolatey.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using attributes; - using commandline; - using configuration; - using infrastructure.commands; - using logging; - using services; - [CommandFor("push", "pushes a compiled nupkg to a source")] public class ChocolateyPushCommand : ICommand { diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateySearchCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateySearchCommand.cs index 018dcd2028..87dbd4079b 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateySearchCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateySearchCommand.cs @@ -14,19 +14,19 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.results; +using chocolatey.infrastructure.app.services; + namespace chocolatey.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using attributes; - using commandline; - using configuration; - using infrastructure.commands; - using logging; - using results; - using services; - [CommandFor("search", "searches remote packages")] [CommandFor("find", "searches remote packages (alias for search)")] public class ChocolateySearchCommand : IListCommand diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs index a489c23eee..231b6e153c 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs @@ -14,21 +14,21 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.results; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.configuration; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.app.services; + namespace chocolatey.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using attributes; - using chocolatey.infrastructure.results; - using commandline; - using configuration; - using domain; - using infrastructure.commands; - using infrastructure.configuration; - using logging; - using services; - [CommandFor("source", "view and configure default sources")] [CommandFor("sources", "view and configure default sources (alias for source)")] public class ChocolateySourceCommand : IListCommand diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyTemplateCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyTemplateCommand.cs index 3fb8e21788..9f2d8fd801 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyTemplateCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyTemplateCommand.cs @@ -1,34 +1,34 @@ -// Copyright © 2017 - 2021 Chocolatey Software, Inc -// Copyright © 2011 - 2017 RealDimensions Software, LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - +// Copyright © 2017 - 2021 Chocolatey Software, Inc +// Copyright © 2011 - 2017 RealDimensions Software, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.results; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.app.templates; + namespace chocolatey.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using attributes; - using chocolatey.infrastructure.results; - using commandline; - using configuration; - using domain; - using infrastructure.commands; - using logging; - using services; - using templates; - [CommandFor("template", "get information about installed templates")] [CommandFor("templates", "get information about installed templates (alias for template)")] public class ChocolateyTemplateCommand : ICommand diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs index 2deceb51be..8abb40f6f4 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyUninstallCommand.cs @@ -14,18 +14,18 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.app.services; + namespace chocolatey.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using attributes; - using commandline; - using configuration; - using infrastructure.commands; - using logging; - using services; - [CommandFor("uninstall", "uninstalls a package")] public class ChocolateyUninstallCommand : ChocolateyCommandBase, ICommand { diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyUnpackSelfCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyUnpackSelfCommand.cs index 02f0b66a5d..8f1d4366d7 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyUnpackSelfCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyUnpackSelfCommand.cs @@ -14,21 +14,22 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.ComponentModel; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.extractors; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.logging; +#if !NoResources +using chocolatey.resources; + namespace chocolatey.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.ComponentModel; - using adapters; - using attributes; - using commandline; - using configuration; - using extractors; - using filesystem; - using infrastructure.commands; - using logging; -#if !NoResources - using resources; #endif [CommandFor("unpackself", "re-installs Chocolatey base files")] diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs index dfeca84055..2b5d47b94a 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs @@ -14,18 +14,18 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.app.services; + namespace chocolatey.infrastructure.app.commands { - using System; - using System.Collections.Generic; - using System.Linq; - using attributes; - using commandline; - using configuration; - using infrastructure.commands; - using logging; - using services; - [CommandFor("upgrade", "upgrades packages from various sources")] public class ChocolateyUpgradeCommand : ChocolateyCommandBase, ICommand { diff --git a/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs b/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs index 120dfc5d0d..c77b7faa3c 100644 --- a/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs +++ b/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs @@ -14,16 +14,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.platforms; + namespace chocolatey.infrastructure.app.configuration { - using System; - using System.Collections.Generic; - using System.Reflection; - using System.Text; - using domain; - using logging; - using platforms; - /// /// The chocolatey configuration. /// diff --git a/src/chocolatey/infrastructure.app/configuration/ConfigFileApiKeySetting.cs b/src/chocolatey/infrastructure.app/configuration/ConfigFileApiKeySetting.cs index 0806ec1a45..7014589a8d 100644 --- a/src/chocolatey/infrastructure.app/configuration/ConfigFileApiKeySetting.cs +++ b/src/chocolatey/infrastructure.app/configuration/ConfigFileApiKeySetting.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Xml.Serialization; + namespace chocolatey.infrastructure.app.configuration { - using System; - using System.Xml.Serialization; - /// /// XML config file api keys element /// diff --git a/src/chocolatey/infrastructure.app/configuration/ConfigFileConfigSetting.cs b/src/chocolatey/infrastructure.app/configuration/ConfigFileConfigSetting.cs index 8b354bf836..2c5dcaab68 100644 --- a/src/chocolatey/infrastructure.app/configuration/ConfigFileConfigSetting.cs +++ b/src/chocolatey/infrastructure.app/configuration/ConfigFileConfigSetting.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Xml.Serialization; + namespace chocolatey.infrastructure.app.configuration { - using System; - using System.Xml.Serialization; - /// /// XML config file config element /// diff --git a/src/chocolatey/infrastructure.app/configuration/ConfigFileFeatureSetting.cs b/src/chocolatey/infrastructure.app/configuration/ConfigFileFeatureSetting.cs index 01267505fc..f62f14c555 100644 --- a/src/chocolatey/infrastructure.app/configuration/ConfigFileFeatureSetting.cs +++ b/src/chocolatey/infrastructure.app/configuration/ConfigFileFeatureSetting.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Xml.Serialization; + namespace chocolatey.infrastructure.app.configuration { - using System; - using System.Xml.Serialization; - /// /// XML config file features element /// diff --git a/src/chocolatey/infrastructure.app/configuration/ConfigFileSettings.cs b/src/chocolatey/infrastructure.app/configuration/ConfigFileSettings.cs index 8141d94d8e..f86b362229 100644 --- a/src/chocolatey/infrastructure.app/configuration/ConfigFileSettings.cs +++ b/src/chocolatey/infrastructure.app/configuration/ConfigFileSettings.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Xml.Serialization; + namespace chocolatey.infrastructure.app.configuration { - using System; - using System.Collections.Generic; - using System.Xml.Serialization; - /// /// XML configuration file /// diff --git a/src/chocolatey/infrastructure.app/configuration/ConfigFileSourceSetting.cs b/src/chocolatey/infrastructure.app/configuration/ConfigFileSourceSetting.cs index 85be8c95c7..3966045b2c 100644 --- a/src/chocolatey/infrastructure.app/configuration/ConfigFileSourceSetting.cs +++ b/src/chocolatey/infrastructure.app/configuration/ConfigFileSourceSetting.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Xml.Serialization; + namespace chocolatey.infrastructure.app.configuration { - using System; - using System.Xml.Serialization; - /// /// XML config file sources element /// diff --git a/src/chocolatey/infrastructure.app/configuration/ConfigurationOptions.cs b/src/chocolatey/infrastructure.app/configuration/ConfigurationOptions.cs index 4266f70e13..17fbf160da 100644 --- a/src/chocolatey/infrastructure.app/configuration/ConfigurationOptions.cs +++ b/src/chocolatey/infrastructure.app/configuration/ConfigurationOptions.cs @@ -14,18 +14,18 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Text.RegularExpressions; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.commandline; +using Console = chocolatey.infrastructure.adapters.Console; + namespace chocolatey.infrastructure.app.configuration { - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.Diagnostics; - using System.Linq; - using System.Text.RegularExpressions; - using adapters; - using commandline; - using Console = adapters.Console; - public static class ConfigurationOptions { private static Lazy _console = new Lazy(() => new Console()); diff --git a/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs b/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs index 7237738977..2dbd8b6570 100644 --- a/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs +++ b/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs @@ -14,21 +14,21 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Reflection; +using System.Security.Principal; +using System.Text; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.app.nuget; +using Environment = chocolatey.infrastructure.adapters.Environment; + namespace chocolatey.infrastructure.app.configuration { - using System; - using System.Collections; - using System.Collections.Generic; - using System.ComponentModel; - using System.Linq; - using System.Reflection; - using System.Security.Principal; - using System.Text; - using adapters; - using logging; - using nuget; - using Environment = adapters.Environment; - public static class EnvironmentSettings { private const string SetEnvironmentMethod = "SetEnvironment"; diff --git a/src/chocolatey/infrastructure.app/configuration/PackagesConfigFilePackageSetting.cs b/src/chocolatey/infrastructure.app/configuration/PackagesConfigFilePackageSetting.cs index 5c4e8d5c1c..2820bfe53c 100644 --- a/src/chocolatey/infrastructure.app/configuration/PackagesConfigFilePackageSetting.cs +++ b/src/chocolatey/infrastructure.app/configuration/PackagesConfigFilePackageSetting.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Xml.Serialization; + namespace chocolatey.infrastructure.app.configuration { - using System; - using System.Xml.Serialization; - /// /// XML packages.config file package element /// diff --git a/src/chocolatey/infrastructure.app/configuration/PackagesConfigFileSettings.cs b/src/chocolatey/infrastructure.app/configuration/PackagesConfigFileSettings.cs index a2061d1364..1439933e59 100644 --- a/src/chocolatey/infrastructure.app/configuration/PackagesConfigFileSettings.cs +++ b/src/chocolatey/infrastructure.app/configuration/PackagesConfigFileSettings.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Xml.Serialization; + namespace chocolatey.infrastructure.app.configuration { - using System; - using System.Collections.Generic; - using System.Xml.Serialization; - /// /// XML packages.config configuration file /// diff --git a/src/chocolatey/infrastructure.app/domain/ChocolateyPackageInformation.cs b/src/chocolatey/infrastructure.app/domain/ChocolateyPackageInformation.cs index 3fb1f5fe54..f345412bc8 100644 --- a/src/chocolatey/infrastructure.app/domain/ChocolateyPackageInformation.cs +++ b/src/chocolatey/infrastructure.app/domain/ChocolateyPackageInformation.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using NuGet.Packaging; +using NuGet.Versioning; +using chocolatey.infrastructure.results; + namespace chocolatey.infrastructure.app.domain { - using System; - using NuGet.Packaging; - using NuGet.Versioning; - using results; - public sealed class ChocolateyPackageInformation { public ChocolateyPackageInformation(IPackageMetadata package) diff --git a/src/chocolatey/infrastructure.app/domain/ChocolateyPackageMetadata.cs b/src/chocolatey/infrastructure.app/domain/ChocolateyPackageMetadata.cs index 2ec61e67f5..448d2d871d 100644 --- a/src/chocolatey/infrastructure.app/domain/ChocolateyPackageMetadata.cs +++ b/src/chocolatey/infrastructure.app/domain/ChocolateyPackageMetadata.cs @@ -15,16 +15,15 @@ // limitations under the License. using System; +using System.Collections.Generic; +using NuGet.Configuration; +using NuGet.Packaging; +using NuGet.Packaging.Core; +using NuGet.Versioning; +using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem; namespace chocolatey.infrastructure.app.domain { - using System.Collections.Generic; - using NuGet.Configuration; - using NuGet.Packaging; - using NuGet.Packaging.Core; - using NuGet.Versioning; - using IFileSystem = filesystem.IFileSystem; - public class ChocolateyPackageMetadata : IPackageMetadata { public ChocolateyPackageMetadata(NuspecReader reader) diff --git a/src/chocolatey/infrastructure.app/domain/CommandNameType.cs b/src/chocolatey/infrastructure.app/domain/CommandNameType.cs index c5b00c6eed..f2dda6b4e9 100644 --- a/src/chocolatey/infrastructure.app/domain/CommandNameType.cs +++ b/src/chocolatey/infrastructure.app/domain/CommandNameType.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; + namespace chocolatey.infrastructure.app.domain { - using System; - public enum CommandNameType { List, diff --git a/src/chocolatey/infrastructure.app/domain/ConfigCommandType.cs b/src/chocolatey/infrastructure.app/domain/ConfigCommandType.cs index 919d40cf2a..1998f4537d 100644 --- a/src/chocolatey/infrastructure.app/domain/ConfigCommandType.cs +++ b/src/chocolatey/infrastructure.app/domain/ConfigCommandType.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; + namespace chocolatey.infrastructure.app.domain { - using System; - public enum ConfigCommandType { Unknown, diff --git a/src/chocolatey/infrastructure.app/domain/FeatureCommandType.cs b/src/chocolatey/infrastructure.app/domain/FeatureCommandType.cs index ed823b70ac..4fec0c36cf 100644 --- a/src/chocolatey/infrastructure.app/domain/FeatureCommandType.cs +++ b/src/chocolatey/infrastructure.app/domain/FeatureCommandType.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; + namespace chocolatey.infrastructure.app.domain { - using System; - public enum FeatureCommandType { Unknown, diff --git a/src/chocolatey/infrastructure.app/domain/GenericRegistryKey.cs b/src/chocolatey/infrastructure.app/domain/GenericRegistryKey.cs index 95650d1404..574cb2cfba 100644 --- a/src/chocolatey/infrastructure.app/domain/GenericRegistryKey.cs +++ b/src/chocolatey/infrastructure.app/domain/GenericRegistryKey.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; +using Microsoft.Win32; + namespace chocolatey.infrastructure.app.domain { - using System.Collections.Generic; - using Microsoft.Win32; - public class GenericRegistryKey { public string Name { get; set; } diff --git a/src/chocolatey/infrastructure.app/domain/GenericRegistryValue.cs b/src/chocolatey/infrastructure.app/domain/GenericRegistryValue.cs index 89c16cc802..979da4a7ab 100644 --- a/src/chocolatey/infrastructure.app/domain/GenericRegistryValue.cs +++ b/src/chocolatey/infrastructure.app/domain/GenericRegistryValue.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; + namespace chocolatey.infrastructure.app.domain { - using System; - public class GenericRegistryValue : IEquatable { public string ParentKeyName { get; set; } diff --git a/src/chocolatey/infrastructure.app/domain/InstallTokens.cs b/src/chocolatey/infrastructure.app/domain/InstallTokens.cs index 58278cd1ac..095fd42fe5 100644 --- a/src/chocolatey/infrastructure.app/domain/InstallTokens.cs +++ b/src/chocolatey/infrastructure.app/domain/InstallTokens.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; + namespace chocolatey.infrastructure.app.domain { - using System; - public static class InstallTokens { public const string InstallerLocation = "{{INSTALLER_LOCATION}}"; diff --git a/src/chocolatey/infrastructure.app/domain/PackageFile.cs b/src/chocolatey/infrastructure.app/domain/PackageFile.cs index eb3ccc689c..dfc62d5628 100644 --- a/src/chocolatey/infrastructure.app/domain/PackageFile.cs +++ b/src/chocolatey/infrastructure.app/domain/PackageFile.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Xml.Serialization; + namespace chocolatey.infrastructure.app.domain { - using System; - using System.Xml.Serialization; - /// /// A package file in the snapshot. /// diff --git a/src/chocolatey/infrastructure.app/domain/PackageFiles.cs b/src/chocolatey/infrastructure.app/domain/PackageFiles.cs index bc6b333cec..2da84e1fa8 100644 --- a/src/chocolatey/infrastructure.app/domain/PackageFiles.cs +++ b/src/chocolatey/infrastructure.app/domain/PackageFiles.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Xml.Serialization; + namespace chocolatey.infrastructure.app.domain { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Xml.Serialization; - /// /// The package files snapshot /// diff --git a/src/chocolatey/infrastructure.app/domain/PinCommandType.cs b/src/chocolatey/infrastructure.app/domain/PinCommandType.cs index cd9157d34a..5d14640175 100644 --- a/src/chocolatey/infrastructure.app/domain/PinCommandType.cs +++ b/src/chocolatey/infrastructure.app/domain/PinCommandType.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; + namespace chocolatey.infrastructure.app.domain { - using System; - public enum PinCommandType { Unknown, diff --git a/src/chocolatey/infrastructure.app/domain/Registry.cs b/src/chocolatey/infrastructure.app/domain/Registry.cs index 68d63d7d39..9535eb32b5 100644 --- a/src/chocolatey/infrastructure.app/domain/Registry.cs +++ b/src/chocolatey/infrastructure.app/domain/Registry.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Xml.Serialization; + namespace chocolatey.infrastructure.app.domain { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Xml.Serialization; - /// /// The installer registry as a snapshot /// diff --git a/src/chocolatey/infrastructure.app/domain/RegistryApplicationKey.cs b/src/chocolatey/infrastructure.app/domain/RegistryApplicationKey.cs index b28ac469c8..210251a23f 100644 --- a/src/chocolatey/infrastructure.app/domain/RegistryApplicationKey.cs +++ b/src/chocolatey/infrastructure.app/domain/RegistryApplicationKey.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Xml.Serialization; +using Microsoft.Win32; +using chocolatey.infrastructure.xml; + namespace chocolatey.infrastructure.app.domain { - using System; - using System.Xml.Serialization; - using Microsoft.Win32; - using xml; - [Serializable] [XmlType("key")] public class RegistryApplicationKey : IEquatable diff --git a/src/chocolatey/infrastructure.app/domain/RegistryValueExtensions.cs b/src/chocolatey/infrastructure.app/domain/RegistryValueExtensions.cs index 78306b515f..7e72f06526 100644 --- a/src/chocolatey/infrastructure.app/domain/RegistryValueExtensions.cs +++ b/src/chocolatey/infrastructure.app/domain/RegistryValueExtensions.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Security; +using Microsoft.Win32; + namespace chocolatey.infrastructure.app.domain { - using System; - using System.Security; - using Microsoft.Win32; - public static class RegistryValueExtensions { public static string AsXmlSafeString(this RegistryKey key, string name) diff --git a/src/chocolatey/infrastructure.app/domain/SourceCommandType.cs b/src/chocolatey/infrastructure.app/domain/SourceCommandType.cs index c5239c32eb..e1b25a1005 100644 --- a/src/chocolatey/infrastructure.app/domain/SourceCommandType.cs +++ b/src/chocolatey/infrastructure.app/domain/SourceCommandType.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; + namespace chocolatey.infrastructure.app.domain { - using System; - public enum SourceCommandType { Unknown, diff --git a/src/chocolatey/infrastructure.app/domain/SourceType.cs b/src/chocolatey/infrastructure.app/domain/SourceType.cs index a9beab9cb0..50280513d5 100644 --- a/src/chocolatey/infrastructure.app/domain/SourceType.cs +++ b/src/chocolatey/infrastructure.app/domain/SourceType.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; + namespace chocolatey.infrastructure.app.domain { - using System; - /// /// Special source modifiers that use alternate sources for packages /// diff --git a/src/chocolatey/infrastructure.app/domain/SourceTypes.cs b/src/chocolatey/infrastructure.app/domain/SourceTypes.cs index 978f302514..a87ed5cd2f 100644 --- a/src/chocolatey/infrastructure.app/domain/SourceTypes.cs +++ b/src/chocolatey/infrastructure.app/domain/SourceTypes.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; + namespace chocolatey.infrastructure.app.domain { - using System; - /// /// This class contains the default source types that are implemented in /// the Chocolatey CLI codebase. This is replacing the enumeration previously diff --git a/src/chocolatey/infrastructure.app/domain/TemplateCommandType.cs b/src/chocolatey/infrastructure.app/domain/TemplateCommandType.cs index 85c5cb9797..659a5c2278 100644 --- a/src/chocolatey/infrastructure.app/domain/TemplateCommandType.cs +++ b/src/chocolatey/infrastructure.app/domain/TemplateCommandType.cs @@ -1,23 +1,23 @@ -// Copyright © 2017 - 2021 Chocolatey Software, Inc -// Copyright © 2011 - 2017 RealDimensions Software, LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - +// Copyright © 2017 - 2021 Chocolatey Software, Inc +// Copyright © 2011 - 2017 RealDimensions Software, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; + namespace chocolatey.infrastructure.app.domain { - using System; - public enum TemplateCommandType { Unknown, diff --git a/src/chocolatey/infrastructure.app/domain/installers/BitRockInstaller.cs b/src/chocolatey/infrastructure.app/domain/installers/BitRockInstaller.cs index 49fb3f8cec..0dae42f8c2 100644 --- a/src/chocolatey/infrastructure.app/domain/installers/BitRockInstaller.cs +++ b/src/chocolatey/infrastructure.app/domain/installers/BitRockInstaller.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; + namespace chocolatey.infrastructure.app.domain.installers { - using System.Collections.Generic; - /// /// BitRock Installer Options /// diff --git a/src/chocolatey/infrastructure.app/domain/installers/CustomInstaller.cs b/src/chocolatey/infrastructure.app/domain/installers/CustomInstaller.cs index b29e7a5180..fc6e977c67 100644 --- a/src/chocolatey/infrastructure.app/domain/installers/CustomInstaller.cs +++ b/src/chocolatey/infrastructure.app/domain/installers/CustomInstaller.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; + namespace chocolatey.infrastructure.app.domain.installers { - using System; - using System.Collections.Generic; - public class CustomInstaller : InstallerBase { public CustomInstaller() diff --git a/src/chocolatey/infrastructure.app/domain/installers/GhostInstaller.cs b/src/chocolatey/infrastructure.app/domain/installers/GhostInstaller.cs index dfd05ade8f..4c128c2d23 100644 --- a/src/chocolatey/infrastructure.app/domain/installers/GhostInstaller.cs +++ b/src/chocolatey/infrastructure.app/domain/installers/GhostInstaller.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; + namespace chocolatey.infrastructure.app.domain.installers { - using System.Collections.Generic; - /// /// Ghost Installer Options /// diff --git a/src/chocolatey/infrastructure.app/domain/installers/IInstaller.cs b/src/chocolatey/infrastructure.app/domain/installers/IInstaller.cs index cf4ba5b773..14a388db4c 100644 --- a/src/chocolatey/infrastructure.app/domain/installers/IInstaller.cs +++ b/src/chocolatey/infrastructure.app/domain/installers/IInstaller.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; + namespace chocolatey.infrastructure.app.domain.installers { - using System; - using System.Collections.Generic; - public interface IInstaller { InstallerType InstallerType { get; } diff --git a/src/chocolatey/infrastructure.app/domain/installers/InnoSetupInstaller.cs b/src/chocolatey/infrastructure.app/domain/installers/InnoSetupInstaller.cs index 96ce3859c6..14b4ee0976 100644 --- a/src/chocolatey/infrastructure.app/domain/installers/InnoSetupInstaller.cs +++ b/src/chocolatey/infrastructure.app/domain/installers/InnoSetupInstaller.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; + namespace chocolatey.infrastructure.app.domain.installers { - using System.Collections.Generic; - /// /// InnoSetup Installer Options /// diff --git a/src/chocolatey/infrastructure.app/domain/installers/InstallForJInstaller.cs b/src/chocolatey/infrastructure.app/domain/installers/InstallForJInstaller.cs index 7136efcc01..6d269f6809 100644 --- a/src/chocolatey/infrastructure.app/domain/installers/InstallForJInstaller.cs +++ b/src/chocolatey/infrastructure.app/domain/installers/InstallForJInstaller.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; + namespace chocolatey.infrastructure.app.domain.installers { - using System.Collections.Generic; - /// /// InstallForJ Installer Options /// diff --git a/src/chocolatey/infrastructure.app/domain/installers/InstallShieldInstaller.cs b/src/chocolatey/infrastructure.app/domain/installers/InstallShieldInstaller.cs index d935eca87f..27cc71dee5 100644 --- a/src/chocolatey/infrastructure.app/domain/installers/InstallShieldInstaller.cs +++ b/src/chocolatey/infrastructure.app/domain/installers/InstallShieldInstaller.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; + namespace chocolatey.infrastructure.app.domain.installers { - using System.Collections.Generic; - /// /// InstallShield Installer Options /// diff --git a/src/chocolatey/infrastructure.app/domain/installers/InstallerBase.cs b/src/chocolatey/infrastructure.app/domain/installers/InstallerBase.cs index ef6a193380..29e9ef830a 100644 --- a/src/chocolatey/infrastructure.app/domain/installers/InstallerBase.cs +++ b/src/chocolatey/infrastructure.app/domain/installers/InstallerBase.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Text; + namespace chocolatey.infrastructure.app.domain.installers { - using System; - using System.Collections.Generic; - using System.Text; - public abstract class InstallerBase : IInstaller { public abstract InstallerType InstallerType { get; } diff --git a/src/chocolatey/infrastructure.app/domain/installers/IzPackInstaller.cs b/src/chocolatey/infrastructure.app/domain/installers/IzPackInstaller.cs index 1c796619cd..999c534703 100644 --- a/src/chocolatey/infrastructure.app/domain/installers/IzPackInstaller.cs +++ b/src/chocolatey/infrastructure.app/domain/installers/IzPackInstaller.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; + namespace chocolatey.infrastructure.app.domain.installers { - using System.Collections.Generic; - /// /// izPack Installer Options /// diff --git a/src/chocolatey/infrastructure.app/domain/installers/MsiInstaller.cs b/src/chocolatey/infrastructure.app/domain/installers/MsiInstaller.cs index c5a8bdb986..54e84e3d65 100644 --- a/src/chocolatey/infrastructure.app/domain/installers/MsiInstaller.cs +++ b/src/chocolatey/infrastructure.app/domain/installers/MsiInstaller.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; + namespace chocolatey.infrastructure.app.domain.installers { - using System.Collections.Generic; - /// /// Windows Installer (MsiExec) Options /// diff --git a/src/chocolatey/infrastructure.app/domain/installers/MsiPatchInstaller.cs b/src/chocolatey/infrastructure.app/domain/installers/MsiPatchInstaller.cs index a93f2722b1..77c214f8eb 100644 --- a/src/chocolatey/infrastructure.app/domain/installers/MsiPatchInstaller.cs +++ b/src/chocolatey/infrastructure.app/domain/installers/MsiPatchInstaller.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; + namespace chocolatey.infrastructure.app.domain.installers { - using System.Collections.Generic; - public class MsiPatchInstaller : InstallerBase { public MsiPatchInstaller() diff --git a/src/chocolatey/infrastructure.app/domain/installers/NsisInstaller.cs b/src/chocolatey/infrastructure.app/domain/installers/NsisInstaller.cs index ca7a4c2673..f930a9accb 100644 --- a/src/chocolatey/infrastructure.app/domain/installers/NsisInstaller.cs +++ b/src/chocolatey/infrastructure.app/domain/installers/NsisInstaller.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; + namespace chocolatey.infrastructure.app.domain.installers { - using System.Collections.Generic; - /// /// NSIS Installer Options /// diff --git a/src/chocolatey/infrastructure.app/domain/installers/PackageForTheWebInstaller.cs b/src/chocolatey/infrastructure.app/domain/installers/PackageForTheWebInstaller.cs index 8569026572..008dba2ace 100644 --- a/src/chocolatey/infrastructure.app/domain/installers/PackageForTheWebInstaller.cs +++ b/src/chocolatey/infrastructure.app/domain/installers/PackageForTheWebInstaller.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; + namespace chocolatey.infrastructure.app.domain.installers { - using System.Collections.Generic; - /// /// PackageForTheWeb Options /// diff --git a/src/chocolatey/infrastructure.app/domain/installers/QtInstaller.cs b/src/chocolatey/infrastructure.app/domain/installers/QtInstaller.cs index fb21501619..2a3a3b0c07 100644 --- a/src/chocolatey/infrastructure.app/domain/installers/QtInstaller.cs +++ b/src/chocolatey/infrastructure.app/domain/installers/QtInstaller.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; + namespace chocolatey.infrastructure.app.domain.installers { - using System.Collections.Generic; - /// /// QT Installer Options /// diff --git a/src/chocolatey/infrastructure.app/domain/installers/SetupFactoryInstaller.cs b/src/chocolatey/infrastructure.app/domain/installers/SetupFactoryInstaller.cs index a41dd41f8a..569f14eec1 100644 --- a/src/chocolatey/infrastructure.app/domain/installers/SetupFactoryInstaller.cs +++ b/src/chocolatey/infrastructure.app/domain/installers/SetupFactoryInstaller.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; + namespace chocolatey.infrastructure.app.domain.installers { - using System.Collections.Generic; - /// /// SetupFactory Options /// diff --git a/src/chocolatey/infrastructure.app/domain/installers/SquirrelInstaller.cs b/src/chocolatey/infrastructure.app/domain/installers/SquirrelInstaller.cs index 225f19a9b9..19918fe648 100644 --- a/src/chocolatey/infrastructure.app/domain/installers/SquirrelInstaller.cs +++ b/src/chocolatey/infrastructure.app/domain/installers/SquirrelInstaller.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; + namespace chocolatey.infrastructure.app.domain.installers { - using System.Collections.Generic; - /// /// Squirrel Installer Options /// diff --git a/src/chocolatey/infrastructure.app/domain/installers/WindowsUpdateInstaller.cs b/src/chocolatey/infrastructure.app/domain/installers/WindowsUpdateInstaller.cs index 961cb9f7b8..61f4247fac 100644 --- a/src/chocolatey/infrastructure.app/domain/installers/WindowsUpdateInstaller.cs +++ b/src/chocolatey/infrastructure.app/domain/installers/WindowsUpdateInstaller.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; + namespace chocolatey.infrastructure.app.domain.installers { - using System.Collections.Generic; - /// /// Windows Update Installer (msu) /// diff --git a/src/chocolatey/infrastructure.app/domain/installers/WiseInstaller.cs b/src/chocolatey/infrastructure.app/domain/installers/WiseInstaller.cs index dbec70b392..1f80029b83 100644 --- a/src/chocolatey/infrastructure.app/domain/installers/WiseInstaller.cs +++ b/src/chocolatey/infrastructure.app/domain/installers/WiseInstaller.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; + namespace chocolatey.infrastructure.app.domain.installers { - using System.Collections.Generic; - /// /// WISE Options /// diff --git a/src/chocolatey/infrastructure.app/events/HandlePackageResultCompletedMessage.cs b/src/chocolatey/infrastructure.app/events/HandlePackageResultCompletedMessage.cs index 1726534d08..61b19f9861 100644 --- a/src/chocolatey/infrastructure.app/events/HandlePackageResultCompletedMessage.cs +++ b/src/chocolatey/infrastructure.app/events/HandlePackageResultCompletedMessage.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.events; +using chocolatey.infrastructure.results; + namespace chocolatey.infrastructure.app.events { - using configuration; - using domain; - using infrastructure.events; - using results; - public class HandlePackageResultCompletedMessage : IMessage { public PackageResult PackageResult { get; private set; } diff --git a/src/chocolatey/infrastructure.app/events/PostRunMessage.cs b/src/chocolatey/infrastructure.app/events/PostRunMessage.cs index 32b8aaf3c2..435a5ecc25 100644 --- a/src/chocolatey/infrastructure.app/events/PostRunMessage.cs +++ b/src/chocolatey/infrastructure.app/events/PostRunMessage.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.events; + namespace chocolatey.infrastructure.app.events { - using configuration; - using infrastructure.commands; - using infrastructure.events; - public class PostRunMessage : IMessage { public ChocolateyConfiguration Configuration { get; private set; } diff --git a/src/chocolatey/infrastructure.app/events/PreRunMessage.cs b/src/chocolatey/infrastructure.app/events/PreRunMessage.cs index 344db88558..3e10f83e45 100644 --- a/src/chocolatey/infrastructure.app/events/PreRunMessage.cs +++ b/src/chocolatey/infrastructure.app/events/PreRunMessage.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.events; + namespace chocolatey.infrastructure.app.events { - using configuration; - using infrastructure.commands; - using infrastructure.events; - public class PreRunMessage : IMessage { public ChocolateyConfiguration Configuration { get; private set; } diff --git a/src/chocolatey/infrastructure.app/nuget/ChocolateyLocalPackageRepository.cs b/src/chocolatey/infrastructure.app/nuget/ChocolateyLocalPackageRepository.cs index 47411b1032..fc59d71869 100644 --- a/src/chocolatey/infrastructure.app/nuget/ChocolateyLocalPackageRepository.cs +++ b/src/chocolatey/infrastructure.app/nuget/ChocolateyLocalPackageRepository.cs @@ -14,19 +14,20 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.Versioning; +using System.Threading; +using chocolatey.infrastructure.filesystem; +using NuGet.Common; +using NuGet.Packaging; +using NuGet.ProjectManagement; +using NuGet.Versioning; + namespace chocolatey.infrastructure.app.nuget { - using System; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Runtime.Versioning; - using System.Threading; - using filesystem; - using NuGet.Common; - using NuGet.Packaging; - using NuGet.ProjectManagement; - using NuGet.Versioning; // ReSharper disable InconsistentNaming /* diff --git a/src/chocolatey/infrastructure.app/nuget/ChocolateyNuGetProjectContext.cs b/src/chocolatey/infrastructure.app/nuget/ChocolateyNuGetProjectContext.cs index 49637d6852..2648278f55 100644 --- a/src/chocolatey/infrastructure.app/nuget/ChocolateyNuGetProjectContext.cs +++ b/src/chocolatey/infrastructure.app/nuget/ChocolateyNuGetProjectContext.cs @@ -3,18 +3,17 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Xml.Linq; +using chocolatey.infrastructure.app.configuration; +using NuGet.Common; +using NuGet.Packaging; +using NuGet.ProjectManagement; +using chocolatey.infrastructure.logging; +using NuGet.Configuration; +using NuGet.Packaging.Signing; namespace chocolatey.infrastructure.app.nuget { - using System.Xml.Linq; - using configuration; - using NuGet.Common; - using NuGet.Packaging; - using NuGet.ProjectManagement; - using logging; - using NuGet.Configuration; - using NuGet.Packaging.Signing; - public class ChocolateyNuGetProjectContext : INuGetProjectContext { private readonly ILogger _logger; diff --git a/src/chocolatey/infrastructure.app/nuget/ChocolateyNuGetSettings.cs b/src/chocolatey/infrastructure.app/nuget/ChocolateyNuGetSettings.cs index 6825a98707..9152bbb910 100644 --- a/src/chocolatey/infrastructure.app/nuget/ChocolateyNuGetSettings.cs +++ b/src/chocolatey/infrastructure.app/nuget/ChocolateyNuGetSettings.cs @@ -3,13 +3,12 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using chocolatey.infrastructure.app.configuration; +using NuGet.Configuration; +using NuGet.Packaging.Signing; namespace chocolatey.infrastructure.app.nuget { - using configuration; - using NuGet.Configuration; - using NuGet.Packaging.Signing; - public class ChocolateyNuGetSettings : ISettings { //private ClientPolicyContext diff --git a/src/chocolatey/infrastructure.app/nuget/ChocolateyNugetCredentialProvider.cs b/src/chocolatey/infrastructure.app/nuget/ChocolateyNugetCredentialProvider.cs index ec744e264d..6d7ec7da18 100644 --- a/src/chocolatey/infrastructure.app/nuget/ChocolateyNugetCredentialProvider.cs +++ b/src/chocolatey/infrastructure.app/nuget/ChocolateyNugetCredentialProvider.cs @@ -14,20 +14,20 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Linq; +using System.Net; +using System.Text.RegularExpressions; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.logging; +using NuGet.Credentials; +using System.Threading.Tasks; +using NuGet.Configuration; +using System.Threading; + namespace chocolatey.infrastructure.app.nuget { - using System; - using System.Linq; - using System.Net; - using System.Text.RegularExpressions; - using commandline; - using configuration; - using logging; - using NuGet.Credentials; - using System.Threading.Tasks; - using NuGet.Configuration; - using System.Threading; - public sealed class ChocolateyNugetCredentialProvider : ICredentialProvider { private readonly ChocolateyConfiguration _config; diff --git a/src/chocolatey/infrastructure.app/nuget/ChocolateyNugetLogger.cs b/src/chocolatey/infrastructure.app/nuget/ChocolateyNugetLogger.cs index 0b6b993fc4..45d77ebe38 100644 --- a/src/chocolatey/infrastructure.app/nuget/ChocolateyNugetLogger.cs +++ b/src/chocolatey/infrastructure.app/nuget/ChocolateyNugetLogger.cs @@ -14,15 +14,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.IO; +using System.Text; +using System.Threading.Tasks; +using chocolatey.infrastructure.logging; +using NuGet.Common; + namespace chocolatey.infrastructure.app.nuget { - using System; - using System.IO; - using System.Text; - using System.Threading.Tasks; - using logging; - using NuGet.Common; - public sealed class ChocolateyNugetLogger : ILogger { public void LogDebug(string message) diff --git a/src/chocolatey/infrastructure.app/nuget/ChocolateyPackagePathResolver.cs b/src/chocolatey/infrastructure.app/nuget/ChocolateyPackagePathResolver.cs index 03f2c0a0ba..aeaeeacf2c 100644 --- a/src/chocolatey/infrastructure.app/nuget/ChocolateyPackagePathResolver.cs +++ b/src/chocolatey/infrastructure.app/nuget/ChocolateyPackagePathResolver.cs @@ -14,17 +14,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.IO; +using chocolatey.infrastructure.filesystem; +using NuGet.Configuration; +using NuGet.Packaging; +using NuGet.Packaging.Core; +using NuGet.ProjectManagement; +using NuGet.Versioning; + namespace chocolatey.infrastructure.app.nuget { - using System; - using System.IO; - using filesystem; - using NuGet.Configuration; - using NuGet.Packaging; - using NuGet.Packaging.Core; - using NuGet.ProjectManagement; - using NuGet.Versioning; - public sealed class ChocolateyPackagePathResolver : PackagePathResolver { public string RootDirectory { get; set; } diff --git a/src/chocolatey/infrastructure.app/nuget/ChocolateyPhysicalFileSystem.cs b/src/chocolatey/infrastructure.app/nuget/ChocolateyPhysicalFileSystem.cs index 3a55e31f4e..0c01de3463 100644 --- a/src/chocolatey/infrastructure.app/nuget/ChocolateyPhysicalFileSystem.cs +++ b/src/chocolatey/infrastructure.app/nuget/ChocolateyPhysicalFileSystem.cs @@ -14,9 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; + namespace chocolatey.infrastructure.app.nuget { - using System.Collections.Generic; // ReSharper disable InconsistentNaming diff --git a/src/chocolatey/infrastructure.app/nuget/ChocolateySourceCacheContext.cs b/src/chocolatey/infrastructure.app/nuget/ChocolateySourceCacheContext.cs index aa494477de..87e28b2462 100644 --- a/src/chocolatey/infrastructure.app/nuget/ChocolateySourceCacheContext.cs +++ b/src/chocolatey/infrastructure.app/nuget/ChocolateySourceCacheContext.cs @@ -1,11 +1,11 @@ -namespace chocolatey.infrastructure.app.nuget -{ - using System; - using System.Threading; - using Alphaleonis.Win32.Filesystem; - using chocolatey.infrastructure.app.configuration; - using NuGet.Protocol.Core.Types; +using System; +using System.Threading; +using Alphaleonis.Win32.Filesystem; +using chocolatey.infrastructure.app.configuration; +using NuGet.Protocol.Core.Types; +namespace chocolatey.infrastructure.app.nuget +{ public class ChocolateySourceCacheContext : SourceCacheContext { /// diff --git a/src/chocolatey/infrastructure.app/nuget/DictionaryPropertyProvider.cs b/src/chocolatey/infrastructure.app/nuget/DictionaryPropertyProvider.cs index 4e6e086388..a6bb8f5702 100644 --- a/src/chocolatey/infrastructure.app/nuget/DictionaryPropertyProvider.cs +++ b/src/chocolatey/infrastructure.app/nuget/DictionaryPropertyProvider.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; + namespace chocolatey.infrastructure.app.nuget { - using System.Collections.Generic; - // ReSharper disable InconsistentNaming public sealed class DictionaryPropertyProvider diff --git a/src/chocolatey/infrastructure.app/nuget/NuGetEndpointResources.cs b/src/chocolatey/infrastructure.app/nuget/NuGetEndpointResources.cs index 9189b69251..91069800d4 100644 --- a/src/chocolatey/infrastructure.app/nuget/NuGetEndpointResources.cs +++ b/src/chocolatey/infrastructure.app/nuget/NuGetEndpointResources.cs @@ -13,14 +13,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using chocolatey.infrastructure.logging; +using NuGet.Protocol.Core.Types; + namespace chocolatey.infrastructure.app.nuget { - using System; - using System.Collections.Concurrent; - using System.Collections.Generic; - using chocolatey.infrastructure.logging; - using NuGet.Protocol.Core.Types; - public sealed class NuGetEndpointResources { private static readonly ConcurrentDictionary _cachedResources = new ConcurrentDictionary(); diff --git a/src/chocolatey/infrastructure.app/nuget/NuGetEndpointResourcesExtensions.cs b/src/chocolatey/infrastructure.app/nuget/NuGetEndpointResourcesExtensions.cs index 14877e9e04..1f8de8819d 100644 --- a/src/chocolatey/infrastructure.app/nuget/NuGetEndpointResourcesExtensions.cs +++ b/src/chocolatey/infrastructure.app/nuget/NuGetEndpointResourcesExtensions.cs @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; +using System.Linq; +using NuGet.Protocol.Core.Types; + namespace chocolatey.infrastructure.app.nuget { - using System.Collections.Generic; - using System.Linq; - using NuGet.Protocol.Core.Types; - public static class NuGetEndpointResourcesExtensions { public static IEnumerable MetadataResources(this IEnumerable resources) diff --git a/src/chocolatey/infrastructure.app/nuget/NuGetFileSystemExtensions.cs b/src/chocolatey/infrastructure.app/nuget/NuGetFileSystemExtensions.cs index 351f9cbf64..fc467ecc31 100644 --- a/src/chocolatey/infrastructure.app/nuget/NuGetFileSystemExtensions.cs +++ b/src/chocolatey/infrastructure.app/nuget/NuGetFileSystemExtensions.cs @@ -14,12 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.IO; +using NuGet.Packaging; + namespace chocolatey.infrastructure.app.nuget { - using System; - using System.Collections.Generic; - using System.IO; - using NuGet.Packaging; // ReSharper disable InconsistentNaming /* diff --git a/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs b/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs index 35390a963c..0f4ae9f781 100644 --- a/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs +++ b/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs @@ -14,44 +14,44 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Security; +using System.Runtime.CompilerServices; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using chocolatey.infrastructure.adapters; +using Alphaleonis.Win32.Filesystem; +using Chocolatey.NuGet.Frameworks; +using chocolatey.infrastructure.configuration; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.logging; +using NuGet; +using NuGet.Common; +using NuGet.Configuration; +using NuGet.Credentials; +using NuGet.PackageManagement; +using NuGet.Packaging; +using NuGet.Packaging.Core; +using NuGet.ProjectManagement; +using NuGet.Protocol; +using NuGet.Protocol.Core.Types; +using NuGet.Versioning; +using chocolatey.infrastructure.results; +using Console = chocolatey.infrastructure.adapters.Console; +using Environment = chocolatey.infrastructure.adapters.Environment; +using System.Collections.Concurrent; + namespace chocolatey.infrastructure.app.nuget { - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Net.Security; - using System.Runtime.CompilerServices; - using System.Security.Cryptography.X509Certificates; - using System.Text; - using System.Threading; - using System.Threading.Tasks; - using adapters; - using Alphaleonis.Win32.Filesystem; - using Chocolatey.NuGet.Frameworks; - using infrastructure.configuration; - using configuration; - using domain; - using filesystem; - using logging; - using NuGet; - using NuGet.Common; - using NuGet.Configuration; - using NuGet.Credentials; - using NuGet.PackageManagement; - using NuGet.Packaging; - using NuGet.Packaging.Core; - using NuGet.ProjectManagement; - using NuGet.Protocol; - using NuGet.Protocol.Core.Types; - using NuGet.Versioning; - using results; - using Console = adapters.Console; - using Environment = adapters.Environment; - using System.Collections.Concurrent; - public sealed class NugetCommon { private static readonly ConcurrentDictionary _repositories = new ConcurrentDictionary(); diff --git a/src/chocolatey/infrastructure.app/nuget/NugetEncryptionUtility.cs b/src/chocolatey/infrastructure.app/nuget/NugetEncryptionUtility.cs index 700a2e4207..6c7e0410a3 100644 --- a/src/chocolatey/infrastructure.app/nuget/NugetEncryptionUtility.cs +++ b/src/chocolatey/infrastructure.app/nuget/NugetEncryptionUtility.cs @@ -14,14 +14,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.ComponentModel; +using System.Text; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.cryptography; + namespace chocolatey.infrastructure.app.nuget { - using System; - using System.ComponentModel; - using System.Text; - using adapters; - using cryptography; - public static class NugetEncryptionUtility { private static Lazy _encryptionUtility = new Lazy(() => new DefaultEncryptionUtility()); diff --git a/src/chocolatey/infrastructure.app/nuget/NugetList.cs b/src/chocolatey/infrastructure.app/nuget/NugetList.cs index d57cd4b56f..fd0fe07b17 100644 --- a/src/chocolatey/infrastructure.app/nuget/NugetList.cs +++ b/src/chocolatey/infrastructure.app/nuget/NugetList.cs @@ -14,22 +14,22 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using chocolatey.infrastructure.tolerance; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.filesystem; +using NuGet.Common; +using NuGet.Packaging; +using NuGet.Packaging.Core; +using NuGet.Protocol.Core.Types; +using NuGet.Versioning; + namespace chocolatey.infrastructure.app.nuget { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Threading; - using System.Threading.Tasks; - using chocolatey.infrastructure.tolerance; - using configuration; - using filesystem; - using NuGet.Common; - using NuGet.Packaging; - using NuGet.Packaging.Core; - using NuGet.Protocol.Core.Types; - using NuGet.Versioning; - public static class NugetList { public static int LastPackageLimitUsed { get; private set; } diff --git a/src/chocolatey/infrastructure.app/nuget/NugetPack.cs b/src/chocolatey/infrastructure.app/nuget/NugetPack.cs index 994d58e557..3615343f8a 100644 --- a/src/chocolatey/infrastructure.app/nuget/NugetPack.cs +++ b/src/chocolatey/infrastructure.app/nuget/NugetPack.cs @@ -14,18 +14,18 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem; +using chocolatey.infrastructure.platforms; +using NuGet.Common; +using NuGet.Configuration; +using NuGet.Packaging; + namespace chocolatey.infrastructure.app.nuget { - using System; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using IFileSystem = filesystem.IFileSystem; - using chocolatey.infrastructure.platforms; - using NuGet.Common; - using NuGet.Configuration; - using NuGet.Packaging; - public sealed class NugetPack { public static bool BuildPackage(PackageBuilder builder, IFileSystem fileSystem, string outputPath) diff --git a/src/chocolatey/infrastructure.app/nuget/NugetPush.cs b/src/chocolatey/infrastructure.app/nuget/NugetPush.cs index b93cc86e15..e5bfe6baa9 100644 --- a/src/chocolatey/infrastructure.app/nuget/NugetPush.cs +++ b/src/chocolatey/infrastructure.app/nuget/NugetPush.cs @@ -14,18 +14,18 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.logging; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.filesystem; +using NuGet.Common; +using NuGet.Protocol.Core.Types; +using System.Net.Http; + namespace chocolatey.infrastructure.app.nuget { - using System; - using configuration; - using logging; - using System.Collections.Generic; - using System.Linq; - using filesystem; - using NuGet.Common; - using NuGet.Protocol.Core.Types; - using System.Net.Http; - public class NugetPush { [Obsolete("This overload is deprecated and will be removed in v3.")] diff --git a/src/chocolatey/infrastructure.app/registration/ChocolateyRegistrationModule.cs b/src/chocolatey/infrastructure.app/registration/ChocolateyRegistrationModule.cs index 7929f6617f..ab559a6af2 100644 --- a/src/chocolatey/infrastructure.app/registration/ChocolateyRegistrationModule.cs +++ b/src/chocolatey/infrastructure.app/registration/ChocolateyRegistrationModule.cs @@ -14,30 +14,30 @@ // See the License for the specific language governing permissions and // limitations under the License. +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.nuget; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.app.tasks; +using chocolatey.infrastructure.app.validations; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.configuration; +using chocolatey.infrastructure.services; +using chocolatey.infrastructure.tasks; +using chocolatey.infrastructure.validations; +using CryptoHashProvider = chocolatey.infrastructure.cryptography.CryptoHashProvider; +using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem; +using IHashProvider = chocolatey.infrastructure.cryptography.IHashProvider; +using NuGet.Common; +using NuGet.PackageManagement; +using NuGet.Packaging; +using chocolatey.infrastructure.rules; +using chocolatey.infrastructure.app.rules; +using System.Linq; +using System; +using System.Security.AccessControl; + namespace chocolatey.infrastructure.app.registration { - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.app.nuget; - using chocolatey.infrastructure.app.services; - using chocolatey.infrastructure.app.tasks; - using chocolatey.infrastructure.app.validations; - using chocolatey.infrastructure.commands; - using chocolatey.infrastructure.configuration; - using chocolatey.infrastructure.services; - using chocolatey.infrastructure.tasks; - using chocolatey.infrastructure.validations; - using CryptoHashProvider = cryptography.CryptoHashProvider; - using IFileSystem = filesystem.IFileSystem; - using IHashProvider = cryptography.IHashProvider; - using NuGet.Common; - using NuGet.PackageManagement; - using NuGet.Packaging; - using chocolatey.infrastructure.rules; - using chocolatey.infrastructure.app.rules; - using System.Linq; - using System; - using System.Security.AccessControl; - internal class ChocolateyRegistrationModule : IExtensionModule { public void RegisterDependencies(IContainerRegistrator registrator, ChocolateyConfiguration configuration) diff --git a/src/chocolatey/infrastructure.app/registration/ContainerBinding.cs b/src/chocolatey/infrastructure.app/registration/ContainerBinding.cs index 522e1248a6..9230cf5cff 100644 --- a/src/chocolatey/infrastructure.app/registration/ContainerBinding.cs +++ b/src/chocolatey/infrastructure.app/registration/ContainerBinding.cs @@ -14,29 +14,29 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using chocolatey.infrastructure.app.builders; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.information; +using chocolatey.infrastructure.licensing; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.services; +using chocolatey.infrastructure.configuration; +using SimpleInjector; +using Assembly = chocolatey.infrastructure.adapters.Assembly; +using chocolatey.infrastructure.app.nuget; +using NuGet.Common; +using NuGet.Versioning; +using CryptoHashProvider = chocolatey.infrastructure.cryptography.CryptoHashProvider; +using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem; +using IHashProvider = chocolatey.infrastructure.cryptography.IHashProvider; + namespace chocolatey.infrastructure.app.registration { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Reflection; - using chocolatey.infrastructure.app.builders; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.filesystem; - using chocolatey.infrastructure.information; - using chocolatey.infrastructure.licensing; - using chocolatey.infrastructure.logging; - using chocolatey.infrastructure.services; - using infrastructure.configuration; - using SimpleInjector; - using Assembly = adapters.Assembly; - using nuget; - using NuGet.Common; - using NuGet.Versioning; - using CryptoHashProvider = cryptography.CryptoHashProvider; - using IFileSystem = filesystem.IFileSystem; - using IHashProvider = cryptography.IHashProvider; - // ReSharper disable InconsistentNaming /// diff --git a/src/chocolatey/infrastructure.app/registration/IContainerRegistrator.cs b/src/chocolatey/infrastructure.app/registration/IContainerRegistrator.cs index 20088790e8..d20934e6aa 100644 --- a/src/chocolatey/infrastructure.app/registration/IContainerRegistrator.cs +++ b/src/chocolatey/infrastructure.app/registration/IContainerRegistrator.cs @@ -13,10 +13,10 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +using System; + namespace chocolatey.infrastructure.app.registration { - using System; - public interface IContainerRegistrator { bool RegistrationFailed { get; } diff --git a/src/chocolatey/infrastructure.app/registration/IContainerResolver.cs b/src/chocolatey/infrastructure.app/registration/IContainerResolver.cs index ea2e478b3a..4904c51960 100644 --- a/src/chocolatey/infrastructure.app/registration/IContainerResolver.cs +++ b/src/chocolatey/infrastructure.app/registration/IContainerResolver.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; + namespace chocolatey.infrastructure.app.registration { - using System; - using System.Collections.Generic; - public interface IContainerResolver { TService Resolve() diff --git a/src/chocolatey/infrastructure.app/registration/IExtensionConfiguration.cs b/src/chocolatey/infrastructure.app/registration/IExtensionConfiguration.cs index 2d8cfe5f37..6f36788e85 100644 --- a/src/chocolatey/infrastructure.app/registration/IExtensionConfiguration.cs +++ b/src/chocolatey/infrastructure.app/registration/IExtensionConfiguration.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + namespace chocolatey.infrastructure.app.registration { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - /// /// Placeholder for the future to prevent the need to do a breaking release of /// Chocolatey Licensed Extension. diff --git a/src/chocolatey/infrastructure.app/registration/IExtensionEnvironment.cs b/src/chocolatey/infrastructure.app/registration/IExtensionEnvironment.cs index e6ddab93a5..efe52e316a 100644 --- a/src/chocolatey/infrastructure.app/registration/IExtensionEnvironment.cs +++ b/src/chocolatey/infrastructure.app/registration/IExtensionEnvironment.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using chocolatey.infrastructure.app.configuration; + namespace chocolatey.infrastructure.app.registration { - using System; - using System.Collections.Generic; - using chocolatey.infrastructure.app.configuration; - /// /// Placeholder for the future to prevent the need for a breaking release of Chocolatey Licensed Extension. /// diff --git a/src/chocolatey/infrastructure.app/registration/IExtensionModule.cs b/src/chocolatey/infrastructure.app/registration/IExtensionModule.cs index 5e61986dfd..f861cef26d 100644 --- a/src/chocolatey/infrastructure.app/registration/IExtensionModule.cs +++ b/src/chocolatey/infrastructure.app/registration/IExtensionModule.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using chocolatey.infrastructure.app.configuration; +using System; + namespace chocolatey.infrastructure.app.registration { - using chocolatey.infrastructure.app.configuration; - using System; - public interface IExtensionModule { void RegisterDependencies(IContainerRegistrator registrator, ChocolateyConfiguration configuration); diff --git a/src/chocolatey/infrastructure.app/registration/SimpleInjectorContainerRegistrator.cs b/src/chocolatey/infrastructure.app/registration/SimpleInjectorContainerRegistrator.cs index 1794185eab..6929d3285c 100644 --- a/src/chocolatey/infrastructure.app/registration/SimpleInjectorContainerRegistrator.cs +++ b/src/chocolatey/infrastructure.app/registration/SimpleInjectorContainerRegistrator.cs @@ -14,23 +14,23 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.events; +using chocolatey.infrastructure.services; +using NuGet.Packaging; +using SimpleInjector; +using Assembly = chocolatey.infrastructure.adapters.Assembly; + namespace chocolatey.infrastructure.app.registration { - using System; - using System.Collections.Concurrent; - using System.Collections.Generic; - using System.Linq; - using System.Reflection; - using chocolatey.infrastructure.adapters; - using chocolatey.infrastructure.app.attributes; - using chocolatey.infrastructure.app.services; - using infrastructure.commands; - using infrastructure.events; - using infrastructure.services; - using NuGet.Packaging; - using SimpleInjector; - using Assembly = adapters.Assembly; - internal sealed class SimpleInjectorContainerRegistrator : IContainerRegistrator, ICloneable { internal List> ValidationHandlers = new List>(); diff --git a/src/chocolatey/infrastructure.app/registration/SimpleInjectorContainerResolver.cs b/src/chocolatey/infrastructure.app/registration/SimpleInjectorContainerResolver.cs index 4f181e4383..aff38355cf 100644 --- a/src/chocolatey/infrastructure.app/registration/SimpleInjectorContainerResolver.cs +++ b/src/chocolatey/infrastructure.app/registration/SimpleInjectorContainerResolver.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using SimpleInjector; + namespace chocolatey.infrastructure.app.registration { - using System; - using System.Collections.Generic; - using SimpleInjector; - internal class SimpleInjectorContainerResolver : IContainerResolver { private readonly Container _container; diff --git a/src/chocolatey/infrastructure.app/rules/EmptyOrInvalidUrlMetadataRule.cs b/src/chocolatey/infrastructure.app/rules/EmptyOrInvalidUrlMetadataRule.cs index 89662fedba..5233d0127f 100644 --- a/src/chocolatey/infrastructure.app/rules/EmptyOrInvalidUrlMetadataRule.cs +++ b/src/chocolatey/infrastructure.app/rules/EmptyOrInvalidUrlMetadataRule.cs @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using chocolatey.infrastructure.rules; +using NuGet.Packaging; + namespace chocolatey.infrastructure.app.rules { - using System; - using System.Collections.Generic; - using chocolatey.infrastructure.rules; - using NuGet.Packaging; - internal sealed class EmptyOrInvalidUrlMetadataRule : MetadataRuleBase { public override IEnumerable Validate(NuspecReader reader) diff --git a/src/chocolatey/infrastructure.app/rules/FrameWorkReferencesMetadataRule.cs b/src/chocolatey/infrastructure.app/rules/FrameWorkReferencesMetadataRule.cs index 671aa41dae..afe11ebd03 100644 --- a/src/chocolatey/infrastructure.app/rules/FrameWorkReferencesMetadataRule.cs +++ b/src/chocolatey/infrastructure.app/rules/FrameWorkReferencesMetadataRule.cs @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; +using chocolatey.infrastructure.rules; +using NuGet.Packaging; + namespace chocolatey.infrastructure.app.rules { - using System.Collections.Generic; - using chocolatey.infrastructure.rules; - using NuGet.Packaging; - internal class FrameWorkReferencesMetadataRule : MetadataRuleBase { public override IEnumerable Validate(NuspecReader reader) diff --git a/src/chocolatey/infrastructure.app/rules/IconMetadataRule.cs b/src/chocolatey/infrastructure.app/rules/IconMetadataRule.cs index 25e3e46031..6d97eeb366 100644 --- a/src/chocolatey/infrastructure.app/rules/IconMetadataRule.cs +++ b/src/chocolatey/infrastructure.app/rules/IconMetadataRule.cs @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; +using chocolatey.infrastructure.rules; +using NuGet.Packaging; + namespace chocolatey.infrastructure.app.rules { - using System.Collections.Generic; - using chocolatey.infrastructure.rules; - using NuGet.Packaging; - internal sealed class IconMetadataRule : FrameWorkReferencesMetadataRule { public override IEnumerable Validate(NuspecReader reader) diff --git a/src/chocolatey/infrastructure.app/rules/LicenseMetadataRule.cs b/src/chocolatey/infrastructure.app/rules/LicenseMetadataRule.cs index ff86b3818f..d395be909c 100644 --- a/src/chocolatey/infrastructure.app/rules/LicenseMetadataRule.cs +++ b/src/chocolatey/infrastructure.app/rules/LicenseMetadataRule.cs @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; +using chocolatey.infrastructure.rules; +using NuGet.Packaging; + namespace chocolatey.infrastructure.app.rules { - using System.Collections.Generic; - using chocolatey.infrastructure.rules; - using NuGet.Packaging; - internal sealed class LicenseMetadataRule : FrameWorkReferencesMetadataRule { public override IEnumerable Validate(NuspecReader reader) diff --git a/src/chocolatey/infrastructure.app/rules/MetadataRuleBase.cs b/src/chocolatey/infrastructure.app/rules/MetadataRuleBase.cs index da938a0a1f..60130fc604 100644 --- a/src/chocolatey/infrastructure.app/rules/MetadataRuleBase.cs +++ b/src/chocolatey/infrastructure.app/rules/MetadataRuleBase.cs @@ -13,15 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Xml.Linq; +using chocolatey.infrastructure.rules; +using NuGet.Packaging; + namespace chocolatey.infrastructure.app.rules { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Xml.Linq; - using chocolatey.infrastructure.rules; - using NuGet.Packaging; - public abstract class MetadataRuleBase : IMetadataRule { private IDictionary _cachedRules; diff --git a/src/chocolatey/infrastructure.app/rules/PackageTypesMetadataRule.cs b/src/chocolatey/infrastructure.app/rules/PackageTypesMetadataRule.cs index d7de9f58e4..dacf665eea 100644 --- a/src/chocolatey/infrastructure.app/rules/PackageTypesMetadataRule.cs +++ b/src/chocolatey/infrastructure.app/rules/PackageTypesMetadataRule.cs @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; +using chocolatey.infrastructure.rules; +using NuGet.Packaging; + namespace chocolatey.infrastructure.app.rules { - using System.Collections.Generic; - using chocolatey.infrastructure.rules; - using NuGet.Packaging; - internal sealed class PackageTypesMetadataRule : FrameWorkReferencesMetadataRule { public override IEnumerable Validate(NuspecReader reader) diff --git a/src/chocolatey/infrastructure.app/rules/ReadmeMetadataRule.cs b/src/chocolatey/infrastructure.app/rules/ReadmeMetadataRule.cs index b96713d4c4..837304f099 100644 --- a/src/chocolatey/infrastructure.app/rules/ReadmeMetadataRule.cs +++ b/src/chocolatey/infrastructure.app/rules/ReadmeMetadataRule.cs @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; +using chocolatey.infrastructure.rules; +using NuGet.Packaging; + namespace chocolatey.infrastructure.app.rules { - using System.Collections.Generic; - using chocolatey.infrastructure.rules; - using NuGet.Packaging; - internal sealed class ReadmeMetadataRule : FrameWorkReferencesMetadataRule { public override IEnumerable Validate(NuspecReader reader) diff --git a/src/chocolatey/infrastructure.app/rules/RepositoryMetadataRule.cs b/src/chocolatey/infrastructure.app/rules/RepositoryMetadataRule.cs index f85bea00ae..6d3d0da979 100644 --- a/src/chocolatey/infrastructure.app/rules/RepositoryMetadataRule.cs +++ b/src/chocolatey/infrastructure.app/rules/RepositoryMetadataRule.cs @@ -13,14 +13,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.rules; +using NuGet.Packaging; + namespace chocolatey.infrastructure.app.rules { - using System; - using System.Collections.Generic; - using System.Linq; - using chocolatey.infrastructure.rules; - using NuGet.Packaging; - internal sealed class RepositoryMetadataRule : FrameWorkReferencesMetadataRule { public override IEnumerable Validate(NuspecReader reader) diff --git a/src/chocolatey/infrastructure.app/rules/RequireLicenseAcceptanceMetadataRule.cs b/src/chocolatey/infrastructure.app/rules/RequireLicenseAcceptanceMetadataRule.cs index 6db956d85f..e198e3fce4 100644 --- a/src/chocolatey/infrastructure.app/rules/RequireLicenseAcceptanceMetadataRule.cs +++ b/src/chocolatey/infrastructure.app/rules/RequireLicenseAcceptanceMetadataRule.cs @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; +using chocolatey.infrastructure.rules; +using NuGet.Packaging; + namespace chocolatey.infrastructure.app.rules { - using System.Collections.Generic; - using chocolatey.infrastructure.rules; - using NuGet.Packaging; - internal sealed class RequireLicenseAcceptanceMetadataRule : MetadataRuleBase { public override IEnumerable Validate(NuspecReader reader) diff --git a/src/chocolatey/infrastructure.app/rules/RequiredMetadataRule.cs b/src/chocolatey/infrastructure.app/rules/RequiredMetadataRule.cs index 9402e4b214..0025587e88 100644 --- a/src/chocolatey/infrastructure.app/rules/RequiredMetadataRule.cs +++ b/src/chocolatey/infrastructure.app/rules/RequiredMetadataRule.cs @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; +using chocolatey.infrastructure.rules; +using NuGet.Packaging; + namespace chocolatey.infrastructure.app.rules { - using System.Collections.Generic; - using chocolatey.infrastructure.rules; - using NuGet.Packaging; - internal sealed class RequiredMetadataRule : MetadataRuleBase { public override IEnumerable Validate(NuspecReader reader) diff --git a/src/chocolatey/infrastructure.app/rules/ServicableMetadataRule.cs b/src/chocolatey/infrastructure.app/rules/ServicableMetadataRule.cs index 61f0b0187f..d93ba4405c 100644 --- a/src/chocolatey/infrastructure.app/rules/ServicableMetadataRule.cs +++ b/src/chocolatey/infrastructure.app/rules/ServicableMetadataRule.cs @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; +using chocolatey.infrastructure.rules; +using NuGet.Packaging; + namespace chocolatey.infrastructure.app.rules { - using System.Collections.Generic; - using chocolatey.infrastructure.rules; - using NuGet.Packaging; - internal sealed class ServicableMetadataRule : FrameWorkReferencesMetadataRule { public override IEnumerable Validate(NuspecReader reader) diff --git a/src/chocolatey/infrastructure.app/rules/VersionMetadataRule.cs b/src/chocolatey/infrastructure.app/rules/VersionMetadataRule.cs index 2cd0576267..41eab57c86 100644 --- a/src/chocolatey/infrastructure.app/rules/VersionMetadataRule.cs +++ b/src/chocolatey/infrastructure.app/rules/VersionMetadataRule.cs @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; +using chocolatey.infrastructure.rules; +using NuGet.Packaging; +using NuGet.Versioning; + namespace chocolatey.infrastructure.app.rules { - using System.Collections.Generic; - using chocolatey.infrastructure.rules; - using NuGet.Packaging; - using NuGet.Versioning; - internal sealed class VersionMetadataRule : MetadataRuleBase { public override IEnumerable Validate(NuspecReader reader) diff --git a/src/chocolatey/infrastructure.app/runners/ConsoleApplication.cs b/src/chocolatey/infrastructure.app/runners/ConsoleApplication.cs index 772dbb3a68..dc11f10b09 100644 --- a/src/chocolatey/infrastructure.app/runners/ConsoleApplication.cs +++ b/src/chocolatey/infrastructure.app/runners/ConsoleApplication.cs @@ -14,18 +14,18 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using SimpleInjector; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.validations; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.app.utility; +using chocolatey.infrastructure.app.validations; + namespace chocolatey.infrastructure.app.runners { - using System; - using System.Collections.Generic; - using System.Linq; - using SimpleInjector; - using configuration; - using infrastructure.validations; - using logging; - using utility; - using validations; - /// /// Console application responsible for running chocolatey /// diff --git a/src/chocolatey/infrastructure.app/runners/GenericRunner.cs b/src/chocolatey/infrastructure.app/runners/GenericRunner.cs index 2ad5c34a54..046798aec4 100644 --- a/src/chocolatey/infrastructure.app/runners/GenericRunner.cs +++ b/src/chocolatey/infrastructure.app/runners/GenericRunner.cs @@ -14,29 +14,29 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Linq; +using System.Collections.Generic; +using chocolatey.infrastructure.app.services; +using chocolatey.infrastructure.app.events; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.events; +using chocolatey.infrastructure.registration; +using chocolatey.infrastructure.tasks; +using SimpleInjector; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.configuration; +using chocolatey.infrastructure.logging; +using Console = System.Console; +using Environment = System.Environment; + namespace chocolatey.infrastructure.app.runners { - using System; - using System.Linq; - using System.Collections.Generic; - using chocolatey.infrastructure.app.services; - using events; - using filesystem; - using infrastructure.events; - using infrastructure.registration; - using infrastructure.tasks; - using SimpleInjector; - using adapters; - using attributes; - using commandline; - using configuration; - using domain; - using infrastructure.commands; - using infrastructure.configuration; - using logging; - using Console = System.Console; - using Environment = System.Environment; - public sealed class GenericRunner { private ICommand FindCommand(ChocolateyConfiguration config, Container container, bool isConsole, Action parseArgs) diff --git a/src/chocolatey/infrastructure.app/services/AutomaticUninstallerService.cs b/src/chocolatey/infrastructure.app/services/AutomaticUninstallerService.cs index ea97fdc821..b960879436 100644 --- a/src/chocolatey/infrastructure.app/services/AutomaticUninstallerService.cs +++ b/src/chocolatey/infrastructure.app/services/AutomaticUninstallerService.cs @@ -14,24 +14,24 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.RegularExpressions; +using System.Threading; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.app.domain.installers; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.results; +using chocolatey.infrastructure.app.utility; + namespace chocolatey.infrastructure.app.services { - using System; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Text.RegularExpressions; - using System.Threading; - using commandline; - using configuration; - using domain; - using domain.installers; - using filesystem; - using infrastructure.commands; - using logging; - using results; - using utility; - public class AutomaticUninstallerService : IAutomaticUninstallerService { private readonly IChocolateyPackageInformationService _packageInfoService; diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyConfigSettingsService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyConfigSettingsService.cs index 138a3c95d1..1fbcadefd2 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyConfigSettingsService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyConfigSettingsService.cs @@ -14,18 +14,18 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using chocolatey.infrastructure.app.commands; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.services; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.app.nuget; + namespace chocolatey.infrastructure.app.services { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Reflection; - using chocolatey.infrastructure.app.commands; - using configuration; - using infrastructure.services; - using logging; - using nuget; - public class ChocolateyConfigSettingsService : IChocolateyConfigSettingsService { private readonly HashSet _knownFeatures = new HashSet(); diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs index 51b54d9640..aa4a5b036f 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs @@ -14,21 +14,21 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.configuration; +using NuGet.Packaging; +using NuGet.Versioning; +using chocolatey.infrastructure.results; +using chocolatey.infrastructure.tolerance; +using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem; + namespace chocolatey.infrastructure.app.services { - using System; - using System.Collections.Generic; - using System.IO; - using System.Text; - using configuration; - using domain; - using infrastructure.configuration; - using NuGet.Packaging; - using NuGet.Versioning; - using results; - using tolerance; - using IFileSystem = filesystem.IFileSystem; - public class ChocolateyPackageInformationService : IChocolateyPackageInformationService { private readonly IFileSystem _fileSystem; diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs index dccab927af..ad60ee05f4 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs @@ -14,35 +14,35 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.ComponentModel.Design; +using System.IO; +using System.Linq; +using System.Text; +using chocolatey.infrastructure.app.registration; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.app.events; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.events; +using chocolatey.infrastructure.services; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.app.nuget; +using NuGet.Configuration; +using NuGet.Packaging; +using NuGet.Protocol.Core.Types; +using NuGet.Versioning; +using chocolatey.infrastructure.platforms; +using chocolatey.infrastructure.results; +using SimpleInjector; +using chocolatey.infrastructure.tolerance; +using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem; + namespace chocolatey.infrastructure.app.services { - using System; - using System.Collections.Concurrent; - using System.Collections.Generic; - using System.ComponentModel.Design; - using System.IO; - using System.Linq; - using System.Text; - using chocolatey.infrastructure.app.registration; - using commandline; - using configuration; - using domain; - using events; - using infrastructure.commands; - using infrastructure.events; - using infrastructure.services; - using logging; - using nuget; - using NuGet.Configuration; - using NuGet.Packaging; - using NuGet.Protocol.Core.Types; - using NuGet.Versioning; - using platforms; - using results; - using SimpleInjector; - using tolerance; - using IFileSystem = filesystem.IFileSystem; - public class ChocolateyPackageService : IChocolateyPackageService { private readonly INugetService _nugetService; diff --git a/src/chocolatey/infrastructure.app/services/ConfigTransformService.cs b/src/chocolatey/infrastructure.app/services/ConfigTransformService.cs index 96c29895a5..d700026fdd 100644 --- a/src/chocolatey/infrastructure.app/services/ConfigTransformService.cs +++ b/src/chocolatey/infrastructure.app/services/ConfigTransformService.cs @@ -14,19 +14,19 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Microsoft.Web.XmlTransform; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.results; +using chocolatey.infrastructure.synchronization; +using chocolatey.infrastructure.tolerance; + namespace chocolatey.infrastructure.app.services { - using System; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using Microsoft.Web.XmlTransform; - using configuration; - using filesystem; - using results; - using synchronization; - using tolerance; - public class ConfigTransformService : IConfigTransformService { private readonly IFileSystem _fileSystem; diff --git a/src/chocolatey/infrastructure.app/services/CygwinService.cs b/src/chocolatey/infrastructure.app/services/CygwinService.cs index 8583fe024e..a3259d2432 100644 --- a/src/chocolatey/infrastructure.app/services/CygwinService.cs +++ b/src/chocolatey/infrastructure.app/services/CygwinService.cs @@ -14,22 +14,22 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using Microsoft.Win32; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.results; +using chocolatey.infrastructure.platforms; + namespace chocolatey.infrastructure.app.services { - using System; - using System.Collections.Concurrent; - using System.Collections.Generic; - using System.Linq; - using System.Text.RegularExpressions; - using Microsoft.Win32; - using configuration; - using domain; - using filesystem; - using infrastructure.commands; - using logging; - using results; - using platforms; - /// /// Alternative Source for Cygwin /// diff --git a/src/chocolatey/infrastructure.app/services/FilesService.cs b/src/chocolatey/infrastructure.app/services/FilesService.cs index 7974e23c2c..f6d9bf244f 100644 --- a/src/chocolatey/infrastructure.app/services/FilesService.cs +++ b/src/chocolatey/infrastructure.app/services/FilesService.cs @@ -14,20 +14,20 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.IO; +using System.Linq; +using System.Runtime.ConstrainedExecution; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.cryptography; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.services; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.results; + namespace chocolatey.infrastructure.app.services { - using System; - using System.IO; - using System.Linq; - using System.Runtime.ConstrainedExecution; - using configuration; - using cryptography; - using domain; - using filesystem; - using infrastructure.services; - using logging; - using results; - public sealed class FilesService : IFilesService { private readonly IXmlService _xmlService; diff --git a/src/chocolatey/infrastructure.app/services/IAutomaticUninstallerService.cs b/src/chocolatey/infrastructure.app/services/IAutomaticUninstallerService.cs index 8b9f7e4379..36124216f7 100644 --- a/src/chocolatey/infrastructure.app/services/IAutomaticUninstallerService.cs +++ b/src/chocolatey/infrastructure.app/services/IAutomaticUninstallerService.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.results; +using System; + namespace chocolatey.infrastructure.app.services { - using configuration; - using domain; - using results; - using System; - /// /// The automagic uninstaller service /// diff --git a/src/chocolatey/infrastructure.app/services/IChocolateyConfigSettingsService.cs b/src/chocolatey/infrastructure.app/services/IChocolateyConfigSettingsService.cs index c7e19b416d..71b811787e 100644 --- a/src/chocolatey/infrastructure.app/services/IChocolateyConfigSettingsService.cs +++ b/src/chocolatey/infrastructure.app/services/IChocolateyConfigSettingsService.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using chocolatey.infrastructure.app.configuration; + namespace chocolatey.infrastructure.app.services { - using System; - using System.Collections.Generic; - using configuration; - public interface IChocolateyConfigSettingsService { void DryRun(ChocolateyConfiguration configuration); diff --git a/src/chocolatey/infrastructure.app/services/IChocolateyPackageInformationService.cs b/src/chocolatey/infrastructure.app/services/IChocolateyPackageInformationService.cs index eacf4c1c49..ebef4a9369 100644 --- a/src/chocolatey/infrastructure.app/services/IChocolateyPackageInformationService.cs +++ b/src/chocolatey/infrastructure.app/services/IChocolateyPackageInformationService.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using chocolatey.infrastructure.app.domain; +using NuGet.Packaging; +using System; + namespace chocolatey.infrastructure.app.services { - using domain; - using NuGet.Packaging; - using System; - public interface IChocolateyPackageInformationService { ChocolateyPackageInformation Get(IPackageMetadata package); diff --git a/src/chocolatey/infrastructure.app/services/IChocolateyPackageService.cs b/src/chocolatey/infrastructure.app/services/IChocolateyPackageService.cs index b03174bf54..8465a044dc 100644 --- a/src/chocolatey/infrastructure.app/services/IChocolateyPackageService.cs +++ b/src/chocolatey/infrastructure.app/services/IChocolateyPackageService.cs @@ -14,14 +14,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.results; + namespace chocolatey.infrastructure.app.services { - using System; - using System.Collections.Concurrent; - using System.Collections.Generic; - using configuration; - using results; - /// /// The packaging service /// diff --git a/src/chocolatey/infrastructure.app/services/IConfigTransformService.cs b/src/chocolatey/infrastructure.app/services/IConfigTransformService.cs index ba5fa6eaa4..5249793103 100644 --- a/src/chocolatey/infrastructure.app/services/IConfigTransformService.cs +++ b/src/chocolatey/infrastructure.app/services/IConfigTransformService.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.results; +using System; + namespace chocolatey.infrastructure.app.services { - using configuration; - using results; - using System; - public interface IConfigTransformService { /// diff --git a/src/chocolatey/infrastructure.app/services/IFilesService.cs b/src/chocolatey/infrastructure.app/services/IFilesService.cs index 5861e3ff98..153b491d2b 100644 --- a/src/chocolatey/infrastructure.app/services/IFilesService.cs +++ b/src/chocolatey/infrastructure.app/services/IFilesService.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.results; + namespace chocolatey.infrastructure.app.services { - using System; - using configuration; - using domain; - using results; - /// /// The files service for capturing and handling file snapshots. /// diff --git a/src/chocolatey/infrastructure.app/services/INugetService.cs b/src/chocolatey/infrastructure.app/services/INugetService.cs index b664ae58ca..a7a3a30f35 100644 --- a/src/chocolatey/infrastructure.app/services/INugetService.cs +++ b/src/chocolatey/infrastructure.app/services/INugetService.cs @@ -14,14 +14,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.results; + namespace chocolatey.infrastructure.app.services { - using System; - using System.Collections.Concurrent; - using System.Collections.Generic; - using configuration; - using results; - public interface INugetService : ISourceRunner { /// diff --git a/src/chocolatey/infrastructure.app/services/IPendingRebootService.cs b/src/chocolatey/infrastructure.app/services/IPendingRebootService.cs index 3884d7c6e9..56d84bcb33 100644 --- a/src/chocolatey/infrastructure.app/services/IPendingRebootService.cs +++ b/src/chocolatey/infrastructure.app/services/IPendingRebootService.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using chocolatey.infrastructure.app.configuration; +using System; + namespace chocolatey.infrastructure.app.services { - using configuration; - using System; - /// /// Test to see if there are any known situations that require /// a System reboot. diff --git a/src/chocolatey/infrastructure.app/services/IPowershellService.cs b/src/chocolatey/infrastructure.app/services/IPowershellService.cs index 58f047ac84..cd92079a9f 100644 --- a/src/chocolatey/infrastructure.app/services/IPowershellService.cs +++ b/src/chocolatey/infrastructure.app/services/IPowershellService.cs @@ -14,16 +14,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Management.Automation.Runspaces; +using chocolatey.infrastructure.app.configuration; +using NuGet.Packaging; +using NuGet.Protocol.Core.Types; +using chocolatey.infrastructure.results; + namespace chocolatey.infrastructure.app.services { - using System; - using System.Collections.Generic; - using System.Management.Automation.Runspaces; - using configuration; - using NuGet.Packaging; - using NuGet.Protocol.Core.Types; - using results; - public interface IPowershellService { /// diff --git a/src/chocolatey/infrastructure.app/services/IRegistryService.cs b/src/chocolatey/infrastructure.app/services/IRegistryService.cs index 0657b88ad5..daf144afa5 100644 --- a/src/chocolatey/infrastructure.app/services/IRegistryService.cs +++ b/src/chocolatey/infrastructure.app/services/IRegistryService.cs @@ -14,14 +14,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using chocolatey.infrastructure.app.domain; +using Microsoft.Win32; +using Registry = chocolatey.infrastructure.app.domain.Registry; + namespace chocolatey.infrastructure.app.services { - using System; - using System.Collections.Generic; - using domain; - using Microsoft.Win32; - using Registry = domain.Registry; - public interface IRegistryService { Registry GetInstallerKeys(); diff --git a/src/chocolatey/infrastructure.app/services/IShimGenerationService.cs b/src/chocolatey/infrastructure.app/services/IShimGenerationService.cs index 1f9de35217..bbaa17509e 100644 --- a/src/chocolatey/infrastructure.app/services/IShimGenerationService.cs +++ b/src/chocolatey/infrastructure.app/services/IShimGenerationService.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.results; +using System; + namespace chocolatey.infrastructure.app.services { - using configuration; - using results; - using System; - public interface IShimGenerationService { /// diff --git a/src/chocolatey/infrastructure.app/services/ISourceRunner.cs b/src/chocolatey/infrastructure.app/services/ISourceRunner.cs index f424a6a8c3..ec4bbc3411 100644 --- a/src/chocolatey/infrastructure.app/services/ISourceRunner.cs +++ b/src/chocolatey/infrastructure.app/services/ISourceRunner.cs @@ -14,16 +14,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using chocolatey.infrastructure.app.attributes; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.results; + namespace chocolatey.infrastructure.app.services { - using System; - using System.Collections.Concurrent; - using System.Collections.Generic; - using chocolatey.infrastructure.app.attributes; - using configuration; - using domain; - using results; - [MultiService] [Obsolete("This interface is deprecated and will be removed in v3.")] public interface ISourceRunner : IBootstrappableSourceRunner, ICountSourceRunner, IListSourceRunner, IInstallSourceRunner, IUpgradeSourceRunner, IUninstallSourceRunner diff --git a/src/chocolatey/infrastructure.app/services/ITemplateService.cs b/src/chocolatey/infrastructure.app/services/ITemplateService.cs index a4c7f587fd..41df9c5f60 100644 --- a/src/chocolatey/infrastructure.app/services/ITemplateService.cs +++ b/src/chocolatey/infrastructure.app/services/ITemplateService.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using chocolatey.infrastructure.app.configuration; +using System; + namespace chocolatey.infrastructure.app.services { - using configuration; - using System; - public interface ITemplateService { void GenerateDryRun(ChocolateyConfiguration configuration); diff --git a/src/chocolatey/infrastructure.app/services/NugetService.cs b/src/chocolatey/infrastructure.app/services/NugetService.cs index 20c630c9eb..e5fa5de9ba 100644 --- a/src/chocolatey/infrastructure.app/services/NugetService.cs +++ b/src/chocolatey/infrastructure.app/services/NugetService.cs @@ -14,43 +14,43 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Text.RegularExpressions; +using System.Threading; +using Chocolatey.NuGet.Frameworks; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.app.utility; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.guards; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.app.nuget; +using chocolatey.infrastructure.platforms; +using chocolatey.infrastructure.results; +using chocolatey.infrastructure.tolerance; +using DateTime = chocolatey.infrastructure.adapters.DateTime; +using Environment = System.Environment; +using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem; +using NuGet.Common; +using NuGet.Configuration; +using NuGet.PackageManagement; +using NuGet.Packaging; +using NuGet.Packaging.Core; +using NuGet.Protocol; +using NuGet.ProjectManagement; +using NuGet.Protocol.Core.Types; +using NuGet.Resolver; +using NuGet.Versioning; +using chocolatey.infrastructure.services; + namespace chocolatey.infrastructure.app.services { - using System; - using System.Collections.Concurrent; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Net; - using System.Text.RegularExpressions; - using System.Threading; - using Chocolatey.NuGet.Frameworks; - using adapters; - using chocolatey.infrastructure.app.utility; - using commandline; - using configuration; - using domain; - using guards; - using logging; - using nuget; - using platforms; - using results; - using tolerance; - using DateTime = adapters.DateTime; - using Environment = System.Environment; - using IFileSystem = filesystem.IFileSystem; - using NuGet.Common; - using NuGet.Configuration; - using NuGet.PackageManagement; - using NuGet.Packaging; - using NuGet.Packaging.Core; - using NuGet.Protocol; - using NuGet.ProjectManagement; - using NuGet.Protocol.Core.Types; - using NuGet.Resolver; - using NuGet.Versioning; - using chocolatey.infrastructure.services; - //todo: #2575 - this monolith is too large. Refactor once test coverage is up. public class NugetService : INugetService diff --git a/src/chocolatey/infrastructure.app/services/PendingRebootService.cs b/src/chocolatey/infrastructure.app/services/PendingRebootService.cs index 815c739d20..c32fc8b747 100644 --- a/src/chocolatey/infrastructure.app/services/PendingRebootService.cs +++ b/src/chocolatey/infrastructure.app/services/PendingRebootService.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using chocolatey.infrastructure.app.configuration; +using Microsoft.Win32; +using chocolatey.infrastructure.platforms; +using System; + namespace chocolatey.infrastructure.app.services { - using configuration; - using Microsoft.Win32; - using platforms; - using System; - /// /// Service to check for System level pending reboot request /// diff --git a/src/chocolatey/infrastructure.app/services/PowershellService.cs b/src/chocolatey/infrastructure.app/services/PowershellService.cs index 28f12bcef9..1cf567e9ef 100644 --- a/src/chocolatey/infrastructure.app/services/PowershellService.cs +++ b/src/chocolatey/infrastructure.app/services/PowershellService.cs @@ -14,33 +14,33 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Management.Automation.Runspaces; +using System.Reflection; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.cryptography; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.registration; +using chocolatey.infrastructure.logging; +using NuGet.Packaging; +using NuGet.Protocol.Core.Types; +using chocolatey.infrastructure.powershell; +using chocolatey.infrastructure.results; +using chocolatey.infrastructure.app.utility; +using CryptoHashProvider = chocolatey.infrastructure.cryptography.CryptoHashProvider; +using Environment = System.Environment; +using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem; + namespace chocolatey.infrastructure.app.services { - using System; - using System.Collections.Generic; - using System.Diagnostics; - using System.IO; - using System.Linq; - using System.Management.Automation; - using System.Management.Automation.Runspaces; - using System.Reflection; - using adapters; - using commandline; - using configuration; - using cryptography; - using domain; - using infrastructure.commands; - using infrastructure.registration; - using logging; - using NuGet.Packaging; - using NuGet.Protocol.Core.Types; - using powershell; - using results; - using utility; - using CryptoHashProvider = cryptography.CryptoHashProvider; - using Environment = System.Environment; - using IFileSystem = filesystem.IFileSystem; - public class PowershellService : IPowershellService { private readonly IFileSystem _fileSystem; diff --git a/src/chocolatey/infrastructure.app/services/PythonService.cs b/src/chocolatey/infrastructure.app/services/PythonService.cs index 71ca71c38e..1db3c74564 100644 --- a/src/chocolatey/infrastructure.app/services/PythonService.cs +++ b/src/chocolatey/infrastructure.app/services/PythonService.cs @@ -14,23 +14,23 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.RegularExpressions; +using Microsoft.Win32; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.results; +using chocolatey.infrastructure.platforms; + namespace chocolatey.infrastructure.app.services { - using System; - using System.Collections.Concurrent; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Text.RegularExpressions; - using Microsoft.Win32; - using configuration; - using domain; - using filesystem; - using infrastructure.commands; - using logging; - using results; - using platforms; - /// /// Alternative Source for Installing Python packages /// diff --git a/src/chocolatey/infrastructure.app/services/RegistryService.cs b/src/chocolatey/infrastructure.app/services/RegistryService.cs index 9238a7ad65..ed5a850e8b 100644 --- a/src/chocolatey/infrastructure.app/services/RegistryService.cs +++ b/src/chocolatey/infrastructure.app/services/RegistryService.cs @@ -14,23 +14,23 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Security.AccessControl; +using System.Security.Principal; +using System.Text; +using System.Text.RegularExpressions; +using Microsoft.Win32; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.services; +using chocolatey.infrastructure.tolerance; +using Registry = chocolatey.infrastructure.app.domain.Registry; + namespace chocolatey.infrastructure.app.services { - using System; - using System.Collections.Generic; - using System.Globalization; - using System.Linq; - using System.Security.AccessControl; - using System.Security.Principal; - using System.Text; - using System.Text.RegularExpressions; - using Microsoft.Win32; - using domain; - using filesystem; - using infrastructure.services; - using tolerance; - using Registry = domain.Registry; - /// /// Allows comparing registry /// diff --git a/src/chocolatey/infrastructure.app/services/RubyGemsService.cs b/src/chocolatey/infrastructure.app/services/RubyGemsService.cs index 76d8dfcca3..1750781058 100644 --- a/src/chocolatey/infrastructure.app/services/RubyGemsService.cs +++ b/src/chocolatey/infrastructure.app/services/RubyGemsService.cs @@ -14,20 +14,20 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.results; +using chocolatey.infrastructure.platforms; + namespace chocolatey.infrastructure.app.services { - using System; - using System.Collections.Concurrent; - using System.Collections.Generic; - using System.Linq; - using System.Text.RegularExpressions; - using configuration; - using domain; - using infrastructure.commands; - using logging; - using results; - using platforms; - public sealed class RubyGemsService : IBootstrappableSourceRunner, IListSourceRunner, IInstallSourceRunner { private readonly ICommandExecutor _commandExecutor; diff --git a/src/chocolatey/infrastructure.app/services/RuleService.cs b/src/chocolatey/infrastructure.app/services/RuleService.cs index ebdc90bf7c..f919f411a8 100644 --- a/src/chocolatey/infrastructure.app/services/RuleService.cs +++ b/src/chocolatey/infrastructure.app/services/RuleService.cs @@ -13,19 +13,19 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using chocolatey.infrastructure.guards; +using chocolatey.infrastructure.rules; +using chocolatey.infrastructure.services; +using NuGet.Configuration; +using NuGet.Packaging; + namespace chocolatey.infrastructure.app.services { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Threading; - using System.Threading.Tasks; - using chocolatey.infrastructure.guards; - using chocolatey.infrastructure.rules; - using chocolatey.infrastructure.services; - using NuGet.Configuration; - using NuGet.Packaging; - public class RuleService : IRuleService { private readonly IMetadataRule[] _rules; diff --git a/src/chocolatey/infrastructure.app/services/ShimGenerationService.cs b/src/chocolatey/infrastructure.app/services/ShimGenerationService.cs index 42a8c8404c..9b7ffaab5e 100644 --- a/src/chocolatey/infrastructure.app/services/ShimGenerationService.cs +++ b/src/chocolatey/infrastructure.app/services/ShimGenerationService.cs @@ -14,16 +14,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.IO; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.results; + namespace chocolatey.infrastructure.app.services { - using System; - using System.Collections.Generic; - using System.IO; - using configuration; - using filesystem; - using infrastructure.commands; - using results; - public class ShimGenerationService : IShimGenerationService { private readonly IFileSystem _fileSystem; diff --git a/src/chocolatey/infrastructure.app/services/TemplateService.cs b/src/chocolatey/infrastructure.app/services/TemplateService.cs index f8e7ca080a..cdb464ace7 100644 --- a/src/chocolatey/infrastructure.app/services/TemplateService.cs +++ b/src/chocolatey/infrastructure.app/services/TemplateService.cs @@ -14,23 +14,23 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.services; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.app.templates; +using chocolatey.infrastructure.tokens; +using chocolatey.infrastructure.app.nuget; +using NuGet.Common; +using IFileSystem = chocolatey.infrastructure.filesystem.IFileSystem; + namespace chocolatey.infrastructure.app.services { - using System; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Reflection; - using System.Text; - using configuration; - using infrastructure.services; - using logging; - using templates; - using tokens; - using nuget; - using NuGet.Common; - using IFileSystem = filesystem.IFileSystem; - public class TemplateService : ITemplateService { private readonly UTF8Encoding _utf8WithoutBOM = new UTF8Encoding(false); diff --git a/src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs b/src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs index a531400aac..b5abf8a3b3 100644 --- a/src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs +++ b/src/chocolatey/infrastructure.app/services/WindowsFeatureService.cs @@ -14,21 +14,21 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.IO; +using System.Text.RegularExpressions; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.commands; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.results; +using chocolatey.infrastructure.platforms; + namespace chocolatey.infrastructure.app.services { - using System; - using System.Collections.Concurrent; - using System.Collections.Generic; - using System.IO; - using System.Text.RegularExpressions; - using configuration; - using domain; - using filesystem; - using infrastructure.commands; - using logging; - using results; - using platforms; - /// /// Alternative Source for Enabling Windows Features /// diff --git a/src/chocolatey/infrastructure.app/tasks/RemovePendingPackagesTask.cs b/src/chocolatey/infrastructure.app/tasks/RemovePendingPackagesTask.cs index 95ca978a16..4e2444e565 100644 --- a/src/chocolatey/infrastructure.app/tasks/RemovePendingPackagesTask.cs +++ b/src/chocolatey/infrastructure.app/tasks/RemovePendingPackagesTask.cs @@ -14,19 +14,19 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.IO; +using System.Linq; +using chocolatey.infrastructure.app.events; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.events; +using chocolatey.infrastructure.services; +using chocolatey.infrastructure.tasks; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.tolerance; + namespace chocolatey.infrastructure.app.tasks { - using System; - using System.IO; - using System.Linq; - using events; - using filesystem; - using infrastructure.events; - using infrastructure.services; - using infrastructure.tasks; - using logging; - using tolerance; - public class RemovePendingPackagesTask : ITask { private readonly IFileSystem _fileSystem; diff --git a/src/chocolatey/infrastructure.app/templates/TemplateValues.cs b/src/chocolatey/infrastructure.app/templates/TemplateValues.cs index 02424765bd..10f0a3c94d 100644 --- a/src/chocolatey/infrastructure.app/templates/TemplateValues.cs +++ b/src/chocolatey/infrastructure.app/templates/TemplateValues.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; + namespace chocolatey.infrastructure.app.templates { - using System; - using System.Collections.Generic; - public class TemplateValues { public TemplateValues() diff --git a/src/chocolatey/infrastructure.app/utility/ArgumentsUtility.cs b/src/chocolatey/infrastructure.app/utility/ArgumentsUtility.cs index bd64f32910..53df50dbbf 100644 --- a/src/chocolatey/infrastructure.app/utility/ArgumentsUtility.cs +++ b/src/chocolatey/infrastructure.app/utility/ArgumentsUtility.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; + namespace chocolatey.infrastructure.app.utility { - using System; - //todo: #2560 maybe find a better name/location for this public static class ArgumentsUtility diff --git a/src/chocolatey/infrastructure.app/utility/PackageUtility.cs b/src/chocolatey/infrastructure.app/utility/PackageUtility.cs index fdbbe23ec0..2dbee3473e 100644 --- a/src/chocolatey/infrastructure.app/utility/PackageUtility.cs +++ b/src/chocolatey/infrastructure.app/utility/PackageUtility.cs @@ -13,12 +13,12 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +using System; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.platforms; + namespace chocolatey.infrastructure.app.utility { - using System; - using configuration; - using platforms; - public class PackageUtility { /// diff --git a/src/chocolatey/infrastructure.app/validations/CacheFolderValidationLockdown.cs b/src/chocolatey/infrastructure.app/validations/CacheFolderValidationLockdown.cs index 53eebc1246..5bb36aeaf1 100644 --- a/src/chocolatey/infrastructure.app/validations/CacheFolderValidationLockdown.cs +++ b/src/chocolatey/infrastructure.app/validations/CacheFolderValidationLockdown.cs @@ -14,15 +14,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.information; +using chocolatey.infrastructure.validations; + namespace chocolatey.infrastructure.app.validations { - using System; - using System.Collections.Generic; - using chocolatey.infrastructure.app.configuration; - using chocolatey.infrastructure.filesystem; - using chocolatey.infrastructure.information; - using chocolatey.infrastructure.validations; - public sealed class CacheFolderLockdownValidation : IValidation { private readonly IFileSystem _fileSystem; diff --git a/src/chocolatey/infrastructure.app/validations/GlobalConfigurationValidation.cs b/src/chocolatey/infrastructure.app/validations/GlobalConfigurationValidation.cs index 0d72ec1383..565fb42eeb 100644 --- a/src/chocolatey/infrastructure.app/validations/GlobalConfigurationValidation.cs +++ b/src/chocolatey/infrastructure.app/validations/GlobalConfigurationValidation.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.validations; + namespace chocolatey.infrastructure.app.validations { - using System; - using System.Collections.Generic; - using configuration; - using infrastructure.validations; - /// /// Performs top level validation checks against the current /// Chocolatey Configuration object to ensure that everything is diff --git a/src/chocolatey/infrastructure.app/validations/SystemStateValidation.cs b/src/chocolatey/infrastructure.app/validations/SystemStateValidation.cs index 0840685f97..594dfe10e5 100644 --- a/src/chocolatey/infrastructure.app/validations/SystemStateValidation.cs +++ b/src/chocolatey/infrastructure.app/validations/SystemStateValidation.cs @@ -14,14 +14,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.validations; +using chocolatey.infrastructure.app.services; + namespace chocolatey.infrastructure.app.validations { - using System; - using System.Collections.Generic; - using configuration; - using infrastructure.validations; - using services; - /// /// Performs validation against the current System State. This /// includes things like pending reboot requirement. Any errors diff --git a/src/chocolatey/infrastructure/adapters/Assembly.cs b/src/chocolatey/infrastructure/adapters/Assembly.cs index a37d199e2e..f24bee499b 100644 --- a/src/chocolatey/infrastructure/adapters/Assembly.cs +++ b/src/chocolatey/infrastructure/adapters/Assembly.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.ComponentModel; +using System.IO; +using System.Reflection; + namespace chocolatey.infrastructure.adapters { - using System; - using System.ComponentModel; - using System.IO; - using System.Reflection; - public sealed class Assembly : IAssembly { private readonly System.Reflection.Assembly _assembly; diff --git a/src/chocolatey/infrastructure/adapters/Console.cs b/src/chocolatey/infrastructure/adapters/Console.cs index 90bc8802a6..4c50b576ac 100644 --- a/src/chocolatey/infrastructure/adapters/Console.cs +++ b/src/chocolatey/infrastructure/adapters/Console.cs @@ -14,15 +14,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.IO; +using System.Runtime.InteropServices; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.platforms; + namespace chocolatey.infrastructure.adapters { - using System; - using System.IO; - using System.Runtime.InteropServices; - using app; - using commandline; - using platforms; - /// /// Adapter for System.Console /// diff --git a/src/chocolatey/infrastructure/adapters/Environment.cs b/src/chocolatey/infrastructure/adapters/Environment.cs index 5356f8f6e1..93d3705d55 100644 --- a/src/chocolatey/infrastructure/adapters/Environment.cs +++ b/src/chocolatey/infrastructure/adapters/Environment.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections; +using chocolatey.infrastructure.app; + namespace chocolatey.infrastructure.adapters { - using System; - using System.Collections; - using app; - public sealed class Environment : IEnvironment { public OperatingSystem OSVersion diff --git a/src/chocolatey/infrastructure/adapters/HashAlgorithm.cs b/src/chocolatey/infrastructure/adapters/HashAlgorithm.cs index 3e5e30e094..868486c577 100644 --- a/src/chocolatey/infrastructure/adapters/HashAlgorithm.cs +++ b/src/chocolatey/infrastructure/adapters/HashAlgorithm.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.IO; + namespace chocolatey.infrastructure.adapters { - using System.IO; - public sealed class HashAlgorithm : IHashAlgorithm { private readonly System.Security.Cryptography.HashAlgorithm _algorithm; diff --git a/src/chocolatey/infrastructure/adapters/IAssembly.cs b/src/chocolatey/infrastructure/adapters/IAssembly.cs index bb1caca0ff..73a96be9e2 100644 --- a/src/chocolatey/infrastructure/adapters/IAssembly.cs +++ b/src/chocolatey/infrastructure/adapters/IAssembly.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.ComponentModel; +using System.IO; +using System.Reflection; + namespace chocolatey.infrastructure.adapters { - using System; - using System.ComponentModel; - using System.IO; - using System.Reflection; - // ReSharper disable InconsistentNaming public interface IAssembly diff --git a/src/chocolatey/infrastructure/adapters/IConsole.cs b/src/chocolatey/infrastructure/adapters/IConsole.cs index fc0f67be25..9a29c7c40a 100644 --- a/src/chocolatey/infrastructure/adapters/IConsole.cs +++ b/src/chocolatey/infrastructure/adapters/IConsole.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.IO; + namespace chocolatey.infrastructure.adapters { - using System.IO; - // ReSharper disable InconsistentNaming public interface IConsole diff --git a/src/chocolatey/infrastructure/adapters/IEncryptionUtility.cs b/src/chocolatey/infrastructure/adapters/IEncryptionUtility.cs index f9e25f0451..22eaf26049 100644 --- a/src/chocolatey/infrastructure/adapters/IEncryptionUtility.cs +++ b/src/chocolatey/infrastructure/adapters/IEncryptionUtility.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; + namespace chocolatey.infrastructure.adapters { - using System; - public interface IEncryptionUtility { string EncryptString(string cleartextValue); diff --git a/src/chocolatey/infrastructure/adapters/IEnvironment.cs b/src/chocolatey/infrastructure/adapters/IEnvironment.cs index a69936c469..c8c9fc6397 100644 --- a/src/chocolatey/infrastructure/adapters/IEnvironment.cs +++ b/src/chocolatey/infrastructure/adapters/IEnvironment.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections; + namespace chocolatey.infrastructure.adapters { - using System; - using System.Collections; - // ReSharper disable InconsistentNaming public interface IEnvironment diff --git a/src/chocolatey/infrastructure/adapters/IHashAlgorithm.cs b/src/chocolatey/infrastructure/adapters/IHashAlgorithm.cs index 3c3f8f0b74..af1e6fcd1b 100644 --- a/src/chocolatey/infrastructure/adapters/IHashAlgorithm.cs +++ b/src/chocolatey/infrastructure/adapters/IHashAlgorithm.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.IO; + namespace chocolatey.infrastructure.adapters { - using System.IO; - // ReSharper disable InconsistentNaming public interface IHashAlgorithm diff --git a/src/chocolatey/infrastructure/adapters/IProcess.cs b/src/chocolatey/infrastructure/adapters/IProcess.cs index 82fde88c2d..4279f3cfcf 100644 --- a/src/chocolatey/infrastructure/adapters/IProcess.cs +++ b/src/chocolatey/infrastructure/adapters/IProcess.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Diagnostics; + namespace chocolatey.infrastructure.adapters { - using System; - using System.Diagnostics; - // ReSharper disable InconsistentNaming public interface IProcess : IDisposable diff --git a/src/chocolatey/infrastructure/adapters/Process.cs b/src/chocolatey/infrastructure/adapters/Process.cs index 109c6d7267..3ce5c3d32a 100644 --- a/src/chocolatey/infrastructure/adapters/Process.cs +++ b/src/chocolatey/infrastructure/adapters/Process.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Diagnostics; + namespace chocolatey.infrastructure.adapters { - using System; - using System.Diagnostics; - public sealed class Process : IProcess { private readonly System.Diagnostics.Process _process; diff --git a/src/chocolatey/infrastructure/commandline/ExitScenarioHandler.cs b/src/chocolatey/infrastructure/commandline/ExitScenarioHandler.cs index 037a548849..cd3abd660d 100644 --- a/src/chocolatey/infrastructure/commandline/ExitScenarioHandler.cs +++ b/src/chocolatey/infrastructure/commandline/ExitScenarioHandler.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Runtime.InteropServices; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.platforms; + namespace chocolatey.infrastructure.commandline { - using System; - using System.Runtime.InteropServices; - using logging; - using platforms; - /// /// Detect abnormal exit signals and log them /// diff --git a/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs b/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs index a87abf30b9..76da2bc402 100644 --- a/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs +++ b/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs @@ -14,17 +14,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.guards; +using chocolatey.infrastructure.logging; +using Console = chocolatey.infrastructure.adapters.Console; + namespace chocolatey.infrastructure.commandline { - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.Linq; - using adapters; - using guards; - using logging; - using Console = adapters.Console; - public class InteractivePrompt { private static Lazy _console = new Lazy(() => new Console()); diff --git a/src/chocolatey/infrastructure/commandline/Options.cs b/src/chocolatey/infrastructure/commandline/Options.cs index bf16a7223d..3baaffc08f 100644 --- a/src/chocolatey/infrastructure/commandline/Options.cs +++ b/src/chocolatey/infrastructure/commandline/Options.cs @@ -1,4 +1,16 @@  +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Globalization; +using System.IO; +using System.Runtime.Serialization; +using System.Security.Permissions; +using System.Text; +using System.Text.RegularExpressions; + // // Options.cs // @@ -139,20 +151,6 @@ namespace chocolatey.infrastructure.commandline { - - using System; - using System.Collections; - using System.Collections.Generic; - using System.Collections.ObjectModel; - using System.ComponentModel; - using System.Globalization; - using System.IO; - using System.Runtime.Serialization; - using System.Security.Permissions; - using System.Text; - using System.Text.RegularExpressions; - - // ReSharper disable InconsistentNaming public class OptionValueCollection : IList, IList { diff --git a/src/chocolatey/infrastructure/commandline/ReadKeyTimeout.cs b/src/chocolatey/infrastructure/commandline/ReadKeyTimeout.cs index 0444d5b12f..ac32137ad8 100644 --- a/src/chocolatey/infrastructure/commandline/ReadKeyTimeout.cs +++ b/src/chocolatey/infrastructure/commandline/ReadKeyTimeout.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Threading; + namespace chocolatey.infrastructure.commandline { - using System; - using System.Threading; - /// /// Because sometimes you to timeout a readkey instead of blocking infinitely. /// diff --git a/src/chocolatey/infrastructure/commandline/ReadLineTimeout.cs b/src/chocolatey/infrastructure/commandline/ReadLineTimeout.cs index 8db9211e38..2fea566a03 100644 --- a/src/chocolatey/infrastructure/commandline/ReadLineTimeout.cs +++ b/src/chocolatey/infrastructure/commandline/ReadLineTimeout.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Threading; + namespace chocolatey.infrastructure.commandline { - using System; - using System.Threading; - /// /// Because sometimes you to timeout a readline instead of blocking infinitely. /// diff --git a/src/chocolatey/infrastructure/commands/CommandExecutor.cs b/src/chocolatey/infrastructure/commands/CommandExecutor.cs index c8e576537f..5ab7b1304e 100644 --- a/src/chocolatey/infrastructure/commands/CommandExecutor.cs +++ b/src/chocolatey/infrastructure/commands/CommandExecutor.cs @@ -14,18 +14,18 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.ComponentModel; +using System.Diagnostics; +using System.IO; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.platforms; +using Process = chocolatey.infrastructure.adapters.Process; + namespace chocolatey.infrastructure.commands { - using System; - using System.ComponentModel; - using System.Diagnostics; - using System.IO; - using adapters; - using filesystem; - using logging; - using platforms; - using Process = adapters.Process; - public sealed class CommandExecutor : ICommandExecutor { public CommandExecutor(IFileSystem fileSystem) diff --git a/src/chocolatey/infrastructure/commands/Execute.cs b/src/chocolatey/infrastructure/commands/Execute.cs index 77f01a5d68..498de424b5 100644 --- a/src/chocolatey/infrastructure/commands/Execute.cs +++ b/src/chocolatey/infrastructure/commands/Execute.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Threading; +using System.Threading.Tasks; +using chocolatey.infrastructure.logging; + namespace chocolatey.infrastructure.commands { - using System; - using System.Threading; - using System.Threading.Tasks; - using logging; - /// /// Execute a method or function /// diff --git a/src/chocolatey/infrastructure/commands/ExitCodeDescription.cs b/src/chocolatey/infrastructure/commands/ExitCodeDescription.cs index ff7c4072f1..f2531d451d 100644 --- a/src/chocolatey/infrastructure/commands/ExitCodeDescription.cs +++ b/src/chocolatey/infrastructure/commands/ExitCodeDescription.cs @@ -13,10 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; + namespace chocolatey.infrastructure.commands { - using System; - public sealed class ExitCodeDescription { public ExitCodeDescription(string description, params int[] exitCodes) diff --git a/src/chocolatey/infrastructure/commands/ExternalCommandArgsBuilder.cs b/src/chocolatey/infrastructure/commands/ExternalCommandArgsBuilder.cs index e2c3ff8210..03141d9ecb 100644 --- a/src/chocolatey/infrastructure/commands/ExternalCommandArgsBuilder.cs +++ b/src/chocolatey/infrastructure/commands/ExternalCommandArgsBuilder.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; + namespace chocolatey.infrastructure.commands { - using System; - using System.Collections.Generic; - using System.Reflection; - using System.Text; - /// /// Responsible for setting up arguments for an external command to be executed /// diff --git a/src/chocolatey/infrastructure/commands/ICommand.cs b/src/chocolatey/infrastructure/commands/ICommand.cs index b21f4f1426..2159f1c89e 100644 --- a/src/chocolatey/infrastructure/commands/ICommand.cs +++ b/src/chocolatey/infrastructure/commands/ICommand.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.commandline; + namespace chocolatey.infrastructure.commands { - using System; - using System.Collections.Generic; - using app.configuration; - using commandline; - /// /// Commands that can be configured and run /// diff --git a/src/chocolatey/infrastructure/commands/ICommandExecutor.cs b/src/chocolatey/infrastructure/commands/ICommandExecutor.cs index a54a8a1267..bb87e3e8be 100644 --- a/src/chocolatey/infrastructure/commands/ICommandExecutor.cs +++ b/src/chocolatey/infrastructure/commands/ICommandExecutor.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Diagnostics; + namespace chocolatey.infrastructure.commands { - using System; - using System.Diagnostics; - public interface ICommandExecutor { int Execute(string process, string arguments, int waitForExitInSeconds); diff --git a/src/chocolatey/infrastructure/commands/IListCommand.cs b/src/chocolatey/infrastructure/commands/IListCommand.cs index ba8bc1453f..a42cfe16bb 100644 --- a/src/chocolatey/infrastructure/commands/IListCommand.cs +++ b/src/chocolatey/infrastructure/commands/IListCommand.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using chocolatey.infrastructure.app.configuration; + namespace chocolatey.infrastructure.commands { - using System; - using System.Collections.Generic; - using app.configuration; - public interface IListCommand : ICommand { int Count(ChocolateyConfiguration config); diff --git a/src/chocolatey/infrastructure/commands/PowershellExecutor.cs b/src/chocolatey/infrastructure/commands/PowershellExecutor.cs index 93cef52d15..0bd0163251 100644 --- a/src/chocolatey/infrastructure/commands/PowershellExecutor.cs +++ b/src/chocolatey/infrastructure/commands/PowershellExecutor.cs @@ -14,17 +14,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.IO; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.filesystem; +using Environment = System.Environment; + namespace chocolatey.infrastructure.commands { - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.Diagnostics; - using System.IO; - using adapters; - using filesystem; - using Environment = System.Environment; - public sealed class PowershellExecutor { private static bool _allowUseWindow = true; diff --git a/src/chocolatey/infrastructure/configuration/Config.cs b/src/chocolatey/infrastructure/configuration/Config.cs index 0b00577198..99cd4a5e70 100644 --- a/src/chocolatey/infrastructure/configuration/Config.cs +++ b/src/chocolatey/infrastructure/configuration/Config.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.ComponentModel; +using chocolatey.infrastructure.app.configuration; + namespace chocolatey.infrastructure.configuration { - using System; - using System.ComponentModel; - using app.configuration; - /// /// Configuration initialization /// diff --git a/src/chocolatey/infrastructure/cryptography/CryptoHashProvider.cs b/src/chocolatey/infrastructure/cryptography/CryptoHashProvider.cs index 2dbccd20a4..039d4717ef 100644 --- a/src/chocolatey/infrastructure/cryptography/CryptoHashProvider.cs +++ b/src/chocolatey/infrastructure/cryptography/CryptoHashProvider.cs @@ -14,19 +14,19 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.IO; +using System.Runtime.InteropServices; +using System.Security.Cryptography; +using System.Text; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.filesystem; +using Environment = System.Environment; +using HashAlgorithm = chocolatey.infrastructure.adapters.HashAlgorithm; + namespace chocolatey.infrastructure.cryptography { - using System; - using System.IO; - using System.Runtime.InteropServices; - using System.Security.Cryptography; - using System.Text; - using adapters; - using app; - using filesystem; - using Environment = System.Environment; - using HashAlgorithm = adapters.HashAlgorithm; - public class CryptoHashProvider : IHashProvider { private readonly IFileSystem _fileSystem; diff --git a/src/chocolatey/infrastructure/cryptography/DefaultEncryptionUtility.cs b/src/chocolatey/infrastructure/cryptography/DefaultEncryptionUtility.cs index e71872edab..b876295739 100644 --- a/src/chocolatey/infrastructure/cryptography/DefaultEncryptionUtility.cs +++ b/src/chocolatey/infrastructure/cryptography/DefaultEncryptionUtility.cs @@ -14,14 +14,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Security.Cryptography; +using System.Text; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.platforms; + namespace chocolatey.infrastructure.cryptography { - using System; - using System.Security.Cryptography; - using System.Text; - using adapters; - using platforms; - public class DefaultEncryptionUtility : IEncryptionUtility { private readonly byte[] _entropyBytes = Encoding.UTF8.GetBytes("Chocolatey"); diff --git a/src/chocolatey/infrastructure/events/EventManager.cs b/src/chocolatey/infrastructure/events/EventManager.cs index b05cc14def..67fa01f4a0 100644 --- a/src/chocolatey/infrastructure/events/EventManager.cs +++ b/src/chocolatey/infrastructure/events/EventManager.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.ComponentModel; +using chocolatey.infrastructure.services; + namespace chocolatey.infrastructure.events { - using System; - using System.ComponentModel; - using services; - public static class EventManager { private static Func _messageSubscriptionManager = () => new EventSubscriptionManagerService(); diff --git a/src/chocolatey/infrastructure/extractors/AssemblyFileExtractor.cs b/src/chocolatey/infrastructure/extractors/AssemblyFileExtractor.cs index 2a736e65ad..0509542cf1 100644 --- a/src/chocolatey/infrastructure/extractors/AssemblyFileExtractor.cs +++ b/src/chocolatey/infrastructure/extractors/AssemblyFileExtractor.cs @@ -14,16 +14,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.tolerance; + namespace chocolatey.infrastructure.extractors { - using System; - using System.Collections.Generic; - using System.IO; - using System.Text; - using adapters; - using filesystem; - using tolerance; - /// /// Extracts resources from an assembly. /// diff --git a/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs b/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs index b313ed0044..8b7520b2c0 100644 --- a/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs +++ b/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs @@ -14,27 +14,27 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Security.AccessControl; +using System.Security.Principal; +using System.Text; +using System.Threading; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.platforms; +using chocolatey.infrastructure.tolerance; +using Assembly = chocolatey.infrastructure.adapters.Assembly; +using Environment = chocolatey.infrastructure.adapters.Environment; + namespace chocolatey.infrastructure.filesystem { - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.Diagnostics; - using System.IO; - using System.Linq; - using System.Runtime.InteropServices; - using System.Security.AccessControl; - using System.Security.Principal; - using System.Text; - using System.Threading; - using adapters; - using app; - using logging; - using platforms; - using tolerance; - using Assembly = adapters.Assembly; - using Environment = adapters.Environment; - /// /// Implementation of IFileSystem for Dot Net /// diff --git a/src/chocolatey/infrastructure/filesystem/FileSystem.cs b/src/chocolatey/infrastructure/filesystem/FileSystem.cs index 0e09322544..486693b6c8 100644 --- a/src/chocolatey/infrastructure/filesystem/FileSystem.cs +++ b/src/chocolatey/infrastructure/filesystem/FileSystem.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.IO; + namespace chocolatey.infrastructure.filesystem { - using System; - using System.IO; - public static class FileSystem { public static byte[] ReadFileBytes(string filePath) diff --git a/src/chocolatey/infrastructure/filesystem/IFileSystem.cs b/src/chocolatey/infrastructure/filesystem/IFileSystem.cs index 784c44237a..982b3d5dd3 100644 --- a/src/chocolatey/infrastructure/filesystem/IFileSystem.cs +++ b/src/chocolatey/infrastructure/filesystem/IFileSystem.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; + namespace chocolatey.infrastructure.filesystem { - using System; - using System.Collections.Generic; - using System.IO; - using System.Text; - /// /// File System Interface /// diff --git a/src/chocolatey/infrastructure/guards/Ensure.cs b/src/chocolatey/infrastructure/guards/Ensure.cs index 764a80288b..e6f56efe3b 100644 --- a/src/chocolatey/infrastructure/guards/Ensure.cs +++ b/src/chocolatey/infrastructure/guards/Ensure.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.IO; +using System.Linq.Expressions; + namespace chocolatey.infrastructure.guards { - using System; - using System.IO; - using System.Linq.Expressions; - public static class Ensure { public static EnsureString That(Expression> expression) diff --git a/src/chocolatey/infrastructure/information/ExtensionInformation.cs b/src/chocolatey/infrastructure/information/ExtensionInformation.cs index a55c0fabd2..26962c4cb4 100644 --- a/src/chocolatey/infrastructure/information/ExtensionInformation.cs +++ b/src/chocolatey/infrastructure/information/ExtensionInformation.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; +using chocolatey.infrastructure.adapters; + namespace chocolatey.infrastructure.information { - using System.Collections.Generic; - using chocolatey.infrastructure.adapters; - public class ExtensionInformation { public ExtensionInformation(IAssembly assembly) diff --git a/src/chocolatey/infrastructure/information/ProcessInformation.cs b/src/chocolatey/infrastructure/information/ProcessInformation.cs index 7a57bd8e20..0dd241af01 100644 --- a/src/chocolatey/infrastructure/information/ProcessInformation.cs +++ b/src/chocolatey/infrastructure/information/ProcessInformation.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Runtime.InteropServices; +using System.Security.Principal; +using chocolatey.infrastructure.platforms; + namespace chocolatey.infrastructure.information { - using System; - using System.Runtime.InteropServices; - using System.Security.Principal; - using platforms; - public sealed class ProcessInformation { public static bool UserIsAdministrator() diff --git a/src/chocolatey/infrastructure/information/VersionInformation.cs b/src/chocolatey/infrastructure/information/VersionInformation.cs index 810a816dbd..74998248ce 100644 --- a/src/chocolatey/infrastructure/information/VersionInformation.cs +++ b/src/chocolatey/infrastructure/information/VersionInformation.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Diagnostics; +using chocolatey.infrastructure.adapters; + namespace chocolatey.infrastructure.information { - using System; - using System.Diagnostics; - using adapters; - public sealed class VersionInformation { public static string GetCurrentAssemblyVersion(IAssembly assembly = null) diff --git a/src/chocolatey/infrastructure/licensing/ChocolateyLicense.cs b/src/chocolatey/infrastructure/licensing/ChocolateyLicense.cs index 47ab4858ab..5c77cacbf9 100644 --- a/src/chocolatey/infrastructure/licensing/ChocolateyLicense.cs +++ b/src/chocolatey/infrastructure/licensing/ChocolateyLicense.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using chocolatey.infrastructure.adapters; +using System; +using DateTime = System.DateTime; + namespace chocolatey.infrastructure.licensing { - using adapters; - using System; - using DateTime = System.DateTime; - public sealed class ChocolateyLicense { public string Id { get; set; } diff --git a/src/chocolatey/infrastructure/licensing/License.cs b/src/chocolatey/infrastructure/licensing/License.cs index 85e27214eb..2ae5585f51 100644 --- a/src/chocolatey/infrastructure/licensing/License.cs +++ b/src/chocolatey/infrastructure/licensing/License.cs @@ -14,14 +14,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.information; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.registration; + namespace chocolatey.infrastructure.licensing { - using System; - using app; - using information; - using logging; - using registration; - public static class License { public static ChocolateyLicense ValidateLicense() diff --git a/src/chocolatey/infrastructure/licensing/LicenseValidation.cs b/src/chocolatey/infrastructure/licensing/LicenseValidation.cs index 746dbd7a7d..6efbbfb22b 100644 --- a/src/chocolatey/infrastructure/licensing/LicenseValidation.cs +++ b/src/chocolatey/infrastructure/licensing/LicenseValidation.cs @@ -14,14 +14,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.IO; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.logging; +using Rhino.Licensing; + namespace chocolatey.infrastructure.licensing { - using System; - using System.IO; - using app; - using logging; - using Rhino.Licensing; - public sealed class LicenseValidation { private const string PublicKey = diff --git a/src/chocolatey/infrastructure/logging/AggregateLog.cs b/src/chocolatey/infrastructure/logging/AggregateLog.cs index 87b7d0c4dd..76580dbdd5 100644 --- a/src/chocolatey/infrastructure/logging/AggregateLog.cs +++ b/src/chocolatey/infrastructure/logging/AggregateLog.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; + namespace chocolatey.infrastructure.logging { - using System; - using System.Collections.Generic; - public sealed class AggregateLog : ILog, ILog { public IEnumerable Loggers { get; private set; } diff --git a/src/chocolatey/infrastructure/logging/ILog.cs b/src/chocolatey/infrastructure/logging/ILog.cs index babfcf270d..e53645932b 100644 --- a/src/chocolatey/infrastructure/logging/ILog.cs +++ b/src/chocolatey/infrastructure/logging/ILog.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; + namespace chocolatey.infrastructure.logging { - using System; - /// /// Custom interface for logging messages /// diff --git a/src/chocolatey/infrastructure/logging/Log.cs b/src/chocolatey/infrastructure/logging/Log.cs index 2a9715f070..1871f72f22 100644 --- a/src/chocolatey/infrastructure/logging/Log.cs +++ b/src/chocolatey/infrastructure/logging/Log.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; + namespace chocolatey.infrastructure.logging { - using System; - /// /// Logger type initialization /// diff --git a/src/chocolatey/infrastructure/logging/Log4NetAppenderConfiguration.cs b/src/chocolatey/infrastructure/logging/Log4NetAppenderConfiguration.cs index 0df9a9a504..9f24d86383 100644 --- a/src/chocolatey/infrastructure/logging/Log4NetAppenderConfiguration.cs +++ b/src/chocolatey/infrastructure/logging/Log4NetAppenderConfiguration.cs @@ -14,26 +14,26 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.IO; +using System.Linq; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.app; +using log4net; +using log4net.Appender; +using log4net.Config; +using log4net.Core; +using log4net.Filter; +using log4net.Layout; +using log4net.Repository; +using log4net.Repository.Hierarchy; +using chocolatey.infrastructure.platforms; +using Console = chocolatey.infrastructure.adapters.Console; + namespace chocolatey.infrastructure.logging { - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.IO; - using System.Linq; - using adapters; - using app; - using log4net; - using log4net.Appender; - using log4net.Config; - using log4net.Core; - using log4net.Filter; - using log4net.Layout; - using log4net.Repository; - using log4net.Repository.Hierarchy; - using platforms; - using Console = adapters.Console; - public sealed class Log4NetAppenderConfiguration { private static readonly log4net.ILog _logger = LogManager.GetLogger(typeof(Log4NetAppenderConfiguration)); diff --git a/src/chocolatey/infrastructure/logging/Log4NetLog.cs b/src/chocolatey/infrastructure/logging/Log4NetLog.cs index 3b7708b0b6..4573093e3f 100644 --- a/src/chocolatey/infrastructure/logging/Log4NetLog.cs +++ b/src/chocolatey/infrastructure/logging/Log4NetLog.cs @@ -15,16 +15,15 @@ // limitations under the License. using log4net.Config; +using System; +using System.Runtime; +using log4net; +using log4net.Core; [assembly: XmlConfigurator(Watch = true)] namespace chocolatey.infrastructure.logging { - using System; - using System.Runtime; - using log4net; - using log4net.Core; - /// /// Log4net logger implementing special ILog class /// diff --git a/src/chocolatey/infrastructure/logging/LogSinkLog.cs b/src/chocolatey/infrastructure/logging/LogSinkLog.cs index 58093cc447..99e7859b14 100644 --- a/src/chocolatey/infrastructure/logging/LogSinkLog.cs +++ b/src/chocolatey/infrastructure/logging/LogSinkLog.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; + namespace chocolatey.infrastructure.logging { - using System; - using System.Collections.Generic; - public sealed class LogSinkLog : ILog, ILog { private readonly IList _messages = new List(); diff --git a/src/chocolatey/infrastructure/logging/NullLog.cs b/src/chocolatey/infrastructure/logging/NullLog.cs index c4ecc4b438..c59702a913 100644 --- a/src/chocolatey/infrastructure/logging/NullLog.cs +++ b/src/chocolatey/infrastructure/logging/NullLog.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; + namespace chocolatey.infrastructure.logging { - using System; - /// /// The default logger until one is set. /// diff --git a/src/chocolatey/infrastructure/logging/TraceLog.cs b/src/chocolatey/infrastructure/logging/TraceLog.cs index dddcf47eb7..b8eb31cb48 100644 --- a/src/chocolatey/infrastructure/logging/TraceLog.cs +++ b/src/chocolatey/infrastructure/logging/TraceLog.cs @@ -14,15 +14,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Diagnostics; +using System.Net; +using System.Reflection; +using System.Threading; +using log4net.Util; + namespace chocolatey.infrastructure.logging { - using System; - using System.Diagnostics; - using System.Net; - using System.Reflection; - using System.Threading; - using log4net.Util; - public class TraceLog : TraceListener { public TraceLog() diff --git a/src/chocolatey/infrastructure/platforms/Platform.cs b/src/chocolatey/infrastructure/platforms/Platform.cs index f15e8109ed..1127192146 100644 --- a/src/chocolatey/infrastructure/platforms/Platform.cs +++ b/src/chocolatey/infrastructure/platforms/Platform.cs @@ -14,15 +14,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.ComponentModel; +using System.Runtime.InteropServices; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.filesystem; +using Environment = chocolatey.infrastructure.adapters.Environment; + namespace chocolatey.infrastructure.platforms { - using System; - using System.ComponentModel; - using System.Runtime.InteropServices; - using adapters; - using filesystem; - using Environment = adapters.Environment; - /// /// OS Platform detection /// diff --git a/src/chocolatey/infrastructure/powershell/PoshHost.cs b/src/chocolatey/infrastructure/powershell/PoshHost.cs index 5294b81a3a..5e1dd5e54a 100644 --- a/src/chocolatey/infrastructure/powershell/PoshHost.cs +++ b/src/chocolatey/infrastructure/powershell/PoshHost.cs @@ -14,16 +14,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Globalization; +using System.Management.Automation.Host; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.domain; +using chocolatey.infrastructure.app.services; + namespace chocolatey.infrastructure.powershell { - using System; - using System.Globalization; - using System.Management.Automation.Host; - using app; - using app.configuration; - using app.domain; - using app.services; - public class PoshHost : PSHost { private readonly ChocolateyConfiguration _configuration; diff --git a/src/chocolatey/infrastructure/powershell/PoshHostRawUserInterface.cs b/src/chocolatey/infrastructure/powershell/PoshHostRawUserInterface.cs index 17ed8f272b..1be44f29a7 100644 --- a/src/chocolatey/infrastructure/powershell/PoshHostRawUserInterface.cs +++ b/src/chocolatey/infrastructure/powershell/PoshHostRawUserInterface.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Management.Automation.Host; +using chocolatey.infrastructure.adapters; +using Console = chocolatey.infrastructure.adapters.Console; + namespace chocolatey.infrastructure.powershell { - using System; - using System.Management.Automation.Host; - using adapters; - using Console = adapters.Console; - public class PoshHostRawUserInterface : PSHostRawUserInterface { private static readonly Lazy _console = new Lazy(() => new Console()); diff --git a/src/chocolatey/infrastructure/powershell/PoshHostUserInterface.cs b/src/chocolatey/infrastructure/powershell/PoshHostUserInterface.cs index 65c5425973..837e65ac1a 100644 --- a/src/chocolatey/infrastructure/powershell/PoshHostUserInterface.cs +++ b/src/chocolatey/infrastructure/powershell/PoshHostUserInterface.cs @@ -14,21 +14,21 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Globalization; +using System.Management.Automation; +using System.Management.Automation.Host; +using System.Security; +using System.Text; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.commandline; +using chocolatey.infrastructure.logging; +using Console = chocolatey.infrastructure.adapters.Console; + namespace chocolatey.infrastructure.powershell { - using System; - using System.Collections.Generic; - using System.Collections.ObjectModel; - using System.Globalization; - using System.Management.Automation; - using System.Management.Automation.Host; - using System.Security; - using System.Text; - using app.configuration; - using commandline; - using logging; - using Console = adapters.Console; - public class PoshHostUserInterface : PSHostUserInterface { private readonly ChocolateyConfiguration _configuration; diff --git a/src/chocolatey/infrastructure/registration/AssemblyResolution.cs b/src/chocolatey/infrastructure/registration/AssemblyResolution.cs index 900211e403..94275fb0c1 100644 --- a/src/chocolatey/infrastructure/registration/AssemblyResolution.cs +++ b/src/chocolatey/infrastructure/registration/AssemblyResolution.cs @@ -14,20 +14,20 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Concurrent; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Threading; +using chocolatey.infrastructure.adapters; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.app.runners; +using chocolatey.infrastructure.filesystem; +using Assembly = chocolatey.infrastructure.adapters.Assembly; + namespace chocolatey.infrastructure.registration { - using System; - using System.Collections.Concurrent; - using System.IO; - using System.Linq; - using System.Reflection; - using System.Threading; - using adapters; - using chocolatey.infrastructure.app; - using chocolatey.infrastructure.app.runners; - using filesystem; - using Assembly = adapters.Assembly; - public class AssemblyResolution { private const int LockResolutionTimeoutSeconds = 5; diff --git a/src/chocolatey/infrastructure/registration/Bootstrap.cs b/src/chocolatey/infrastructure/registration/Bootstrap.cs index fcd42985b3..0fd2de998f 100644 --- a/src/chocolatey/infrastructure/registration/Bootstrap.cs +++ b/src/chocolatey/infrastructure/registration/Bootstrap.cs @@ -14,14 +14,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using chocolatey.infrastructure.app; +using log4net; +using chocolatey.infrastructure.logging; +using ILog = log4net.ILog; + namespace chocolatey.infrastructure.registration { - using System; - using app; - using log4net; - using logging; - using ILog = log4net.ILog; - /// /// Application bootstrapping - sets up logging and errors for the app domain /// diff --git a/src/chocolatey/infrastructure/registration/HttpsSecurity.cs b/src/chocolatey/infrastructure/registration/HttpsSecurity.cs index f04347da68..033d3435b6 100644 --- a/src/chocolatey/infrastructure/registration/HttpsSecurity.cs +++ b/src/chocolatey/infrastructure/registration/HttpsSecurity.cs @@ -1,12 +1,12 @@ -namespace chocolatey.infrastructure.registration +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Text; +using System.Threading.Tasks; + +namespace chocolatey.infrastructure.registration { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Text; - using System.Threading.Tasks; - public static class HttpsSecurity { /// diff --git a/src/chocolatey/infrastructure/registration/SecurityProtocol.cs b/src/chocolatey/infrastructure/registration/SecurityProtocol.cs index e9071245fc..829f924fcd 100644 --- a/src/chocolatey/infrastructure/registration/SecurityProtocol.cs +++ b/src/chocolatey/infrastructure/registration/SecurityProtocol.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Net; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.logging; + namespace chocolatey.infrastructure.registration { - using System; - using System.Net; - using app.configuration; - using logging; - [Obsolete("This type is deprecated and will be removed in v3.")] public sealed class SecurityProtocol { diff --git a/src/chocolatey/infrastructure/registration/SimpleInjectorContainer.cs b/src/chocolatey/infrastructure/registration/SimpleInjectorContainer.cs index 5d03cafde6..98f6a7d19b 100644 --- a/src/chocolatey/infrastructure/registration/SimpleInjectorContainer.cs +++ b/src/chocolatey/infrastructure/registration/SimpleInjectorContainer.cs @@ -14,20 +14,20 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using chocolatey.infrastructure.app; +using chocolatey.infrastructure.app.registration; +using chocolatey.infrastructure.information; +using chocolatey.infrastructure.licensing; +using chocolatey.infrastructure.logging; +using SimpleInjector; + namespace chocolatey.infrastructure.registration { - using System; - using System.Collections.Generic; - using System.Collections.ObjectModel; - using System.Linq; - using System.Reflection; - using app; - using app.registration; - using chocolatey.infrastructure.information; - using chocolatey.infrastructure.licensing; - using logging; - using SimpleInjector; - /// /// The inversion container /// diff --git a/src/chocolatey/infrastructure/registration/SimpleInjectorContainerResolutionBehavior.cs b/src/chocolatey/infrastructure/registration/SimpleInjectorContainerResolutionBehavior.cs index 6b66bf9cee..4c3be31b78 100644 --- a/src/chocolatey/infrastructure/registration/SimpleInjectorContainerResolutionBehavior.cs +++ b/src/chocolatey/infrastructure/registration/SimpleInjectorContainerResolutionBehavior.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Linq; +using System.Reflection; +using SimpleInjector.Advanced; + namespace chocolatey.infrastructure.registration { - using System; - using System.Linq; - using System.Reflection; - using SimpleInjector.Advanced; - /// /// /// diff --git a/src/chocolatey/infrastructure/results/IResult.cs b/src/chocolatey/infrastructure/results/IResult.cs index ebc275240a..fae4c5f919 100644 --- a/src/chocolatey/infrastructure/results/IResult.cs +++ b/src/chocolatey/infrastructure/results/IResult.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Collections.Generic; + namespace chocolatey.infrastructure.results { - using System.Collections.Generic; - /// /// Outcome from some work performed. /// diff --git a/src/chocolatey/infrastructure/results/PackageResult.cs b/src/chocolatey/infrastructure/results/PackageResult.cs index 98230d3541..06a0a612e5 100644 --- a/src/chocolatey/infrastructure/results/PackageResult.cs +++ b/src/chocolatey/infrastructure/results/PackageResult.cs @@ -14,18 +14,18 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using chocolatey.infrastructure.app.domain; +using NuGet.Packaging; +using NuGet.Packaging.Core; +using NuGet.Protocol.Core.Types; +using NuGet.Protocol; +using NuGet.Versioning; + namespace chocolatey.infrastructure.results { - using System; - using System.Collections.Generic; - using System.Linq; - using app.domain; - using NuGet.Packaging; - using NuGet.Packaging.Core; - using NuGet.Protocol.Core.Types; - using NuGet.Protocol; - using NuGet.Versioning; - /// /// Outcome of package installation /// diff --git a/src/chocolatey/infrastructure/results/Result.cs b/src/chocolatey/infrastructure/results/Result.cs index d0ce6d8991..23e23f4597 100644 --- a/src/chocolatey/infrastructure/results/Result.cs +++ b/src/chocolatey/infrastructure/results/Result.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; + namespace chocolatey.infrastructure.results { - using System; - using System.Collections.Generic; - using System.Linq; - /// /// Outcome from some work performed /// diff --git a/src/chocolatey/infrastructure/rules/IMetadataRule.cs b/src/chocolatey/infrastructure/rules/IMetadataRule.cs index e37b387e56..d441f0d599 100644 --- a/src/chocolatey/infrastructure/rules/IMetadataRule.cs +++ b/src/chocolatey/infrastructure/rules/IMetadataRule.cs @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using chocolatey.infrastructure.app.attributes; +using NuGet.Packaging; + namespace chocolatey.infrastructure.rules { - using System; - using System.Collections.Generic; - using chocolatey.infrastructure.app.attributes; - using NuGet.Packaging; - [MultiService] public interface IMetadataRule { diff --git a/src/chocolatey/infrastructure/services/EventSubscriptionManagerService.cs b/src/chocolatey/infrastructure/services/EventSubscriptionManagerService.cs index c787c55496..8c2703b26a 100644 --- a/src/chocolatey/infrastructure/services/EventSubscriptionManagerService.cs +++ b/src/chocolatey/infrastructure/services/EventSubscriptionManagerService.cs @@ -14,15 +14,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Reactive.Linq; +using System.Reactive.Subjects; +using chocolatey.infrastructure.events; +using chocolatey.infrastructure.guards; +using chocolatey.infrastructure.logging; + namespace chocolatey.infrastructure.services { - using System; - using System.Reactive.Linq; - using System.Reactive.Subjects; - using events; - using guards; - using logging; - /// /// Implementation of IEventSubscriptionManagerService /// diff --git a/src/chocolatey/infrastructure/services/IDateTimeService.cs b/src/chocolatey/infrastructure/services/IDateTimeService.cs index 2e28c1ace6..7c6ef78029 100644 --- a/src/chocolatey/infrastructure/services/IDateTimeService.cs +++ b/src/chocolatey/infrastructure/services/IDateTimeService.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; + namespace chocolatey.infrastructure.services { - using System; - /// /// This handles date/time information /// diff --git a/src/chocolatey/infrastructure/services/IEventSubscriptionManagerService.cs b/src/chocolatey/infrastructure/services/IEventSubscriptionManagerService.cs index 6fa94c7849..3af73630c3 100644 --- a/src/chocolatey/infrastructure/services/IEventSubscriptionManagerService.cs +++ b/src/chocolatey/infrastructure/services/IEventSubscriptionManagerService.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using chocolatey.infrastructure.events; + namespace chocolatey.infrastructure.services { - using System; - using events; - /// /// Interface for EventSubscriptionManagerService /// diff --git a/src/chocolatey/infrastructure/services/IRegularExpressionService.cs b/src/chocolatey/infrastructure/services/IRegularExpressionService.cs index 4c44fd5dbc..87103ab21d 100644 --- a/src/chocolatey/infrastructure/services/IRegularExpressionService.cs +++ b/src/chocolatey/infrastructure/services/IRegularExpressionService.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Text.RegularExpressions; + namespace chocolatey.infrastructure.services { - using System; - using System.Text.RegularExpressions; - /// /// Regular expressions helper /// diff --git a/src/chocolatey/infrastructure/services/IRuleService.cs b/src/chocolatey/infrastructure/services/IRuleService.cs index 51a6c003ac..61bb1c8851 100644 --- a/src/chocolatey/infrastructure/services/IRuleService.cs +++ b/src/chocolatey/infrastructure/services/IRuleService.cs @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using chocolatey.infrastructure.rules; + namespace chocolatey.infrastructure.services { - using System; - using System.Collections.Generic; - using chocolatey.infrastructure.rules; - public interface IRuleService { IEnumerable ValidateRules(string filePath); diff --git a/src/chocolatey/infrastructure/services/IXmlService.cs b/src/chocolatey/infrastructure/services/IXmlService.cs index 19cb89d53b..e8c965ce25 100644 --- a/src/chocolatey/infrastructure/services/IXmlService.cs +++ b/src/chocolatey/infrastructure/services/IXmlService.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; + namespace chocolatey.infrastructure.services { - using System; - public interface IXmlService { /// diff --git a/src/chocolatey/infrastructure/services/RegularExpressionService.cs b/src/chocolatey/infrastructure/services/RegularExpressionService.cs index 122bac4973..3ac6cebcde 100644 --- a/src/chocolatey/infrastructure/services/RegularExpressionService.cs +++ b/src/chocolatey/infrastructure/services/RegularExpressionService.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Text.RegularExpressions; + namespace chocolatey.infrastructure.services { - using System; - using System.Text.RegularExpressions; - /// /// Regular Expressions helper /// diff --git a/src/chocolatey/infrastructure/services/SystemDateTimeService.cs b/src/chocolatey/infrastructure/services/SystemDateTimeService.cs index 5a39b090b6..5675d5ba54 100644 --- a/src/chocolatey/infrastructure/services/SystemDateTimeService.cs +++ b/src/chocolatey/infrastructure/services/SystemDateTimeService.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; + namespace chocolatey.infrastructure.services { - using System; - /// /// Uses information from the system /// diff --git a/src/chocolatey/infrastructure/services/SystemDateTimeUtcService.cs b/src/chocolatey/infrastructure/services/SystemDateTimeUtcService.cs index bef5625d8f..5ee556c523 100644 --- a/src/chocolatey/infrastructure/services/SystemDateTimeUtcService.cs +++ b/src/chocolatey/infrastructure/services/SystemDateTimeUtcService.cs @@ -14,10 +14,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; + namespace chocolatey.infrastructure.services { - using System; - /// /// Uses information from the system /// diff --git a/src/chocolatey/infrastructure/services/XmlService.cs b/src/chocolatey/infrastructure/services/XmlService.cs index 44f6cc52eb..385a8d7934 100644 --- a/src/chocolatey/infrastructure/services/XmlService.cs +++ b/src/chocolatey/infrastructure/services/XmlService.cs @@ -14,19 +14,19 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Diagnostics; +using System.IO; +using System.Text; +using System.Xml; +using System.Xml.Serialization; +using chocolatey.infrastructure.cryptography; +using chocolatey.infrastructure.filesystem; +using chocolatey.infrastructure.tolerance; +using chocolatey.infrastructure.synchronization; + namespace chocolatey.infrastructure.services { - using System; - using System.Diagnostics; - using System.IO; - using System.Text; - using System.Xml; - using System.Xml.Serialization; - using cryptography; - using filesystem; - using tolerance; - using synchronization; - /// /// XML interaction /// diff --git a/src/chocolatey/infrastructure/synchronization/GlobalMutex.cs b/src/chocolatey/infrastructure/synchronization/GlobalMutex.cs index bbbe3863c0..aec8a0911b 100644 --- a/src/chocolatey/infrastructure/synchronization/GlobalMutex.cs +++ b/src/chocolatey/infrastructure/synchronization/GlobalMutex.cs @@ -14,15 +14,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Security.AccessControl; +using System.Security.Principal; +using System.Threading; +using chocolatey.infrastructure.logging; +using chocolatey.infrastructure.platforms; + namespace chocolatey.infrastructure.synchronization { - using System; - using System.Security.AccessControl; - using System.Security.Principal; - using System.Threading; - using logging; - using platforms; - /// /// global mutex used for synchronizing multiple processes based on appguid /// diff --git a/src/chocolatey/infrastructure/tasks/ITask.cs b/src/chocolatey/infrastructure/tasks/ITask.cs index 06bc3928bb..c091baba53 100644 --- a/src/chocolatey/infrastructure/tasks/ITask.cs +++ b/src/chocolatey/infrastructure/tasks/ITask.cs @@ -14,11 +14,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +using chocolatey.infrastructure.app.attributes; +using System; + namespace chocolatey.infrastructure.tasks { - using chocolatey.infrastructure.app.attributes; - using System; - /// /// Interface for all runners. /// diff --git a/src/chocolatey/infrastructure/tokens/TokenReplacer.cs b/src/chocolatey/infrastructure/tokens/TokenReplacer.cs index 93777687cd..9427091829 100644 --- a/src/chocolatey/infrastructure/tokens/TokenReplacer.cs +++ b/src/chocolatey/infrastructure/tokens/TokenReplacer.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text.RegularExpressions; + namespace chocolatey.infrastructure.tokens { - using System; - using System.Collections.Generic; - using System.Reflection; - using System.Text.RegularExpressions; - public sealed class TokenReplacer { public static string ReplaceTokens(TConfig configuration, string textToReplace, string tokenPrefix = "[[", string tokenSuffix = "]]") diff --git a/src/chocolatey/infrastructure/tolerance/FaultTolerance.cs b/src/chocolatey/infrastructure/tolerance/FaultTolerance.cs index a41a7f39f1..d99d7e0b7e 100644 --- a/src/chocolatey/infrastructure/tolerance/FaultTolerance.cs +++ b/src/chocolatey/infrastructure/tolerance/FaultTolerance.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Threading; +using chocolatey.infrastructure.configuration; +using chocolatey.infrastructure.logging; + namespace chocolatey.infrastructure.tolerance { - using System; - using System.Threading; - using configuration; - using logging; - /// /// Provides methods that are able to tolerate faults and recover /// diff --git a/src/chocolatey/infrastructure/validations/IValidation.cs b/src/chocolatey/infrastructure/validations/IValidation.cs index b335f18cde..531b85abe3 100644 --- a/src/chocolatey/infrastructure/validations/IValidation.cs +++ b/src/chocolatey/infrastructure/validations/IValidation.cs @@ -14,13 +14,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; +using System.Collections.Generic; +using chocolatey.infrastructure.app.configuration; +using chocolatey.infrastructure.app.attributes; + namespace chocolatey.infrastructure.validations { - using System; - using System.Collections.Generic; - using app.configuration; - using chocolatey.infrastructure.app.attributes; - /// /// Interface for all validations /// diff --git a/src/chocolatey/infrastructure/xml/XmlCData.cs b/src/chocolatey/infrastructure/xml/XmlCData.cs index 14e7e6ea43..395d279b49 100644 --- a/src/chocolatey/infrastructure/xml/XmlCData.cs +++ b/src/chocolatey/infrastructure/xml/XmlCData.cs @@ -14,12 +14,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System.Xml; +using System.Xml.Schema; +using System.Xml.Serialization; + namespace chocolatey.infrastructure.xml { - using System.Xml; - using System.Xml.Schema; - using System.Xml.Serialization; - /// /// Xml CData autoconversion /// From 8c422301e4589b879d866e710d1261abf0bdab4e Mon Sep 17 00:00:00 2001 From: Rain Sallow Date: Thu, 4 Apr 2024 13:32:41 -0400 Subject: [PATCH 07/18] (maint) Fix IDE0032 warnings Use auto-property --- .../configuration/ConfigurationOptions.cs | 21 +++++------- .../nuget/ChocolateyNuGetProjectContext.cs | 16 ++------- .../infrastructure/adapters/Assembly.cs | 31 +++++++---------- .../infrastructure/adapters/Process.cs | 34 ++++++++----------- .../commands/PowershellExecutor.cs | 10 ++---- .../registration/SimpleInjectorContainer.cs | 9 ++--- 6 files changed, 42 insertions(+), 79 deletions(-) diff --git a/src/chocolatey/infrastructure.app/configuration/ConfigurationOptions.cs b/src/chocolatey/infrastructure.app/configuration/ConfigurationOptions.cs index 17fbf160da..61c30aaac9 100644 --- a/src/chocolatey/infrastructure.app/configuration/ConfigurationOptions.cs +++ b/src/chocolatey/infrastructure.app/configuration/ConfigurationOptions.cs @@ -38,7 +38,7 @@ public static void InitializeWith(Lazy console) public static void ClearOptions() { - _optionSet.Clear(); + OptionSet.Clear(); } private static IConsole Console @@ -46,12 +46,7 @@ private static IConsole Console get { return _console.Value; } } - private static readonly OptionSet _optionSet = new OptionSet(); - - public static OptionSet OptionSet - { - get { return _optionSet; } - } + public static OptionSet OptionSet { get; } = new OptionSet(); /// /// Parses arguments and updates the configuration @@ -72,9 +67,9 @@ public static void ParseArgumentsAndUpdateConfiguration(ICollection args IList unparsedArguments = new List(); // add help only once - if (_optionSet.Count == 0) + if (OptionSet.Count == 0) { - _optionSet + OptionSet .Add("?|help|h", "Prints out the help menu.", option => configuration.HelpRequested = option != null) @@ -85,16 +80,16 @@ public static void ParseArgumentsAndUpdateConfiguration(ICollection args if (setOptions != null) { - setOptions(_optionSet); + setOptions(OptionSet); } try { - unparsedArguments = _optionSet.Parse(args); + unparsedArguments = OptionSet.Parse(args); } catch (OptionException) { - ShowHelp(_optionSet, helpMessage); + ShowHelp(OptionSet, helpMessage); configuration.UnsuccessfulParsing = true; } @@ -146,7 +141,7 @@ public static void ParseArgumentsAndUpdateConfiguration(ICollection args return; } - ShowHelp(_optionSet, helpMessage); + ShowHelp(OptionSet, helpMessage); } else { diff --git a/src/chocolatey/infrastructure.app/nuget/ChocolateyNuGetProjectContext.cs b/src/chocolatey/infrastructure.app/nuget/ChocolateyNuGetProjectContext.cs index 2648278f55..5ba695b0c5 100644 --- a/src/chocolatey/infrastructure.app/nuget/ChocolateyNuGetProjectContext.cs +++ b/src/chocolatey/infrastructure.app/nuget/ChocolateyNuGetProjectContext.cs @@ -23,7 +23,7 @@ public ChocolateyNuGetProjectContext(ChocolateyConfiguration config, ILogger log //TODO, set client policy correctly here with settings, fix in chocolatey implementation of ISettings for this purpose var chocolateyNugetSettings = new ChocolateyNuGetSettings(config); var clientPolicyContext = ClientPolicyContext.GetClientPolicy(chocolateyNugetSettings, logger); - _extractionContext = new PackageExtractionContext( + PackageExtractionContext = new PackageExtractionContext( PackageSaveMode.Nupkg | PackageSaveMode.Nuspec | PackageSaveMode.Files, XmlDocFileSaveMode.None, clientPolicyContext, @@ -32,8 +32,6 @@ public ChocolateyNuGetProjectContext(ChocolateyConfiguration config, ILogger log _logger = logger; } - private PackageExtractionContext _extractionContext; - public void Log(MessageLevel level, string message, params object[] args) { switch (level) @@ -74,17 +72,7 @@ public FileConflictAction ResolveFileConflict(string message) return FileConflictAction.OverwriteAll; } - public PackageExtractionContext PackageExtractionContext - { - get - { - return _extractionContext; - } - set - { - _extractionContext = value; - } - } + public PackageExtractionContext PackageExtractionContext { get; set; } public ISourceControlManagerProvider SourceControlManagerProvider => null; public ExecutionContext ExecutionContext => null; diff --git a/src/chocolatey/infrastructure/adapters/Assembly.cs b/src/chocolatey/infrastructure/adapters/Assembly.cs index f24bee499b..6f9335b8ba 100644 --- a/src/chocolatey/infrastructure/adapters/Assembly.cs +++ b/src/chocolatey/infrastructure/adapters/Assembly.cs @@ -23,72 +23,67 @@ namespace chocolatey.infrastructure.adapters { public sealed class Assembly : IAssembly { - private readonly System.Reflection.Assembly _assembly; - private Assembly(System.Reflection.Assembly assembly) { - _assembly = assembly; + UnderlyingType = assembly; } public string FullName { - get { return _assembly.FullName; } + get { return UnderlyingType.FullName; } } public string Location { - get { return _assembly.Location; } + get { return UnderlyingType.Location; } } public string CodeBase { - get { return _assembly.CodeBase; } + get { return UnderlyingType.CodeBase; } } [EditorBrowsable(EditorBrowsableState.Never)] - public System.Reflection.Assembly UnderlyingType - { - get { return _assembly; } - } + public System.Reflection.Assembly UnderlyingType { get; } public string[] GetManifestResourceNames() { - return _assembly.GetManifestResourceNames(); + return UnderlyingType.GetManifestResourceNames(); } public Stream GetManifestResourceStream(string name) { - return _assembly.GetManifestResourceStream(name); + return UnderlyingType.GetManifestResourceStream(name); } public Stream GetManifestResourceStream(Type type, string name) { - return _assembly.GetManifestResourceStream(type, name); + return UnderlyingType.GetManifestResourceStream(type, name); } public AssemblyName GetName() { - return _assembly.GetName(); + return UnderlyingType.GetName(); } public Type GetType(String name) { - return _assembly.GetType(name); + return UnderlyingType.GetType(name); } public Type GetType(String name, bool throwOnError) { - return _assembly.GetType(name,throwOnError); + return UnderlyingType.GetType(name,throwOnError); } public Type GetType(String name, bool throwOnError, bool ignoreCase) { - return _assembly.GetType(name,throwOnError, ignoreCase); + return UnderlyingType.GetType(name,throwOnError, ignoreCase); } public Type[] GetTypes() { - return _assembly.GetTypes(); + return UnderlyingType.GetTypes(); } public static IAssembly Load(byte[] rawAssembly) diff --git a/src/chocolatey/infrastructure/adapters/Process.cs b/src/chocolatey/infrastructure/adapters/Process.cs index 3ce5c3d32a..6032cab2d3 100644 --- a/src/chocolatey/infrastructure/adapters/Process.cs +++ b/src/chocolatey/infrastructure/adapters/Process.cs @@ -21,67 +21,63 @@ namespace chocolatey.infrastructure.adapters { public sealed class Process : IProcess { - private readonly System.Diagnostics.Process _process; public event EventHandler OutputDataReceived; public event EventHandler ErrorDataReceived; public Process() { - _process = new System.Diagnostics.Process(); - _process.ErrorDataReceived += (sender, args) => ErrorDataReceived.Invoke(sender, args); - _process.OutputDataReceived += (sender, args) => OutputDataReceived.Invoke(sender, args); + UnderlyingType = new System.Diagnostics.Process(); + UnderlyingType.ErrorDataReceived += (sender, args) => ErrorDataReceived.Invoke(sender, args); + UnderlyingType.OutputDataReceived += (sender, args) => OutputDataReceived.Invoke(sender, args); } public ProcessStartInfo StartInfo { - get { return _process.StartInfo; } - set { _process.StartInfo = value; } + get { return UnderlyingType.StartInfo; } + set { UnderlyingType.StartInfo = value; } } public bool EnableRaisingEvents { - get { return _process.EnableRaisingEvents; } - set { _process.EnableRaisingEvents = value; } + get { return UnderlyingType.EnableRaisingEvents; } + set { UnderlyingType.EnableRaisingEvents = value; } } public int ExitCode { - get { return _process.ExitCode; } + get { return UnderlyingType.ExitCode; } } - public System.Diagnostics.Process UnderlyingType - { - get { return _process; } - } + public System.Diagnostics.Process UnderlyingType { get; } public void Start() { - _process.Start(); + UnderlyingType.Start(); } public void BeginErrorReadLine() { - _process.BeginErrorReadLine(); + UnderlyingType.BeginErrorReadLine(); } public void BeginOutputReadLine() { - _process.BeginOutputReadLine(); + UnderlyingType.BeginOutputReadLine(); } public void WaitForExit() { - _process.WaitForExit(); + UnderlyingType.WaitForExit(); } public bool WaitForExit(int milliseconds) { - return _process.WaitForExit(milliseconds); + return UnderlyingType.WaitForExit(milliseconds); } public void Dispose() { - _process.Dispose(); + UnderlyingType.Dispose(); } } } diff --git a/src/chocolatey/infrastructure/commands/PowershellExecutor.cs b/src/chocolatey/infrastructure/commands/PowershellExecutor.cs index 0bd0163251..e6b02e9153 100644 --- a/src/chocolatey/infrastructure/commands/PowershellExecutor.cs +++ b/src/chocolatey/infrastructure/commands/PowershellExecutor.cs @@ -27,14 +27,8 @@ namespace chocolatey.infrastructure.commands { public sealed class PowershellExecutor { - private static bool _allowUseWindow = true; - [EditorBrowsable(EditorBrowsableState.Never)] - public static bool AllowUseWindow - { - get { return _allowUseWindow; } - set { _allowUseWindow = value; } - } + public static bool AllowUseWindow { get; set; } = true; private static readonly IList _powershellLocations = new List { @@ -68,7 +62,7 @@ Action stdErrAction stdOutAction: stdOutAction, stdErrAction: stdErrAction, updateProcessPath: true, - allowUseWindow: _allowUseWindow + allowUseWindow: AllowUseWindow ); } diff --git a/src/chocolatey/infrastructure/registration/SimpleInjectorContainer.cs b/src/chocolatey/infrastructure/registration/SimpleInjectorContainer.cs index 98f6a7d19b..df6e8b36e1 100644 --- a/src/chocolatey/infrastructure/registration/SimpleInjectorContainer.cs +++ b/src/chocolatey/infrastructure/registration/SimpleInjectorContainer.cs @@ -38,16 +38,11 @@ public static class SimpleInjectorContainer private const string RegisterComponentsMethod = "RegisterComponents"; #if DEBUG - private static bool _verifyContainer = true; #else private static bool _verifyContainer = false; #endif - public static bool VerifyContainer - { - get { return _verifyContainer; } - set { _verifyContainer = value; } - } + public static bool VerifyContainer { get; set; } = true; /// /// Add a component registry class to the container. @@ -85,7 +80,7 @@ private static Container Initialize() LoadComponentRegistry(componentRegistry, container, extensions); } - if (_verifyContainer) + if (VerifyContainer) { container.Verify(); } From cbde0602ca24882378dd1c069599e88ce5a3ada1 Mon Sep 17 00:00:00 2001 From: Rain Sallow Date: Thu, 4 Apr 2024 13:35:38 -0400 Subject: [PATCH 08/18] (maint) Fix IDE0049 warnings Simplify type names -> primitives keywords --- .../AutomaticUninstallerServiceSpecs.cs | 22 +++++++++---------- .../builders/ConfigurationBuilder.cs | 2 +- .../configuration/EnvironmentSettings.cs | 2 +- .../infrastructure.app/nuget/NugetCommon.cs | 2 +- .../services/NugetService.cs | 2 +- .../infrastructure/adapters/Assembly.cs | 6 ++--- .../infrastructure/adapters/Console.cs | 14 ++++++------ .../infrastructure/adapters/IAssembly.cs | 6 ++--- .../commandline/InteractivePrompt.cs | 2 +- .../commands/ExternalCommandArgsBuilder.cs | 4 ++-- .../powershell/PoshHostUserInterface.cs | 6 ++--- .../registration/SimpleInjectorContainer.cs | 2 +- 12 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/chocolatey.tests/infrastructure.app/services/AutomaticUninstallerServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/AutomaticUninstallerServiceSpecs.cs index 5785b34083..87101f939a 100644 --- a/src/chocolatey.tests/infrastructure.app/services/AutomaticUninstallerServiceSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/services/AutomaticUninstallerServiceSpecs.cs @@ -123,7 +123,7 @@ public void Should_not_get_package_information() public void Should_not_call_command_executor() { CommandExecutor.Verify( - c => c.Execute(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny()), + c => c.Execute(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny()), Times.Never); } } @@ -153,7 +153,7 @@ public void Should_log_why_it_skips_auto_uninstaller() public void Should_not_call_command_executor() { CommandExecutor.Verify( - c => c.Execute(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny()), + c => c.Execute(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny()), Times.Never); } } @@ -181,7 +181,7 @@ public void Should_log_why_it_skips_auto_uninstaller() public void Should_not_call_command_executor() { CommandExecutor.Verify( - c => c.Execute(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny()), + c => c.Execute(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny()), Times.Never); } } @@ -209,7 +209,7 @@ public void Should_log_why_it_skips_auto_uninstaller() public void Should_not_call_command_executor() { CommandExecutor.Verify( - c => c.Execute(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny()), + c => c.Execute(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny()), Times.Never); } } @@ -237,7 +237,7 @@ public void Should_log_why_it_skips_auto_uninstaller() public void Should_not_call_command_executor() { CommandExecutor.Verify( - c => c.Execute(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny()), + c => c.Execute(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny()), Times.Never); } } @@ -267,7 +267,7 @@ public void Should_log_why_it_skips_auto_uninstaller() public void Should_not_call_command_executor() { CommandExecutor.Verify( - c => c.Execute(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny()), + c => c.Execute(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny()), Times.Never); } } @@ -348,7 +348,7 @@ public void Should_log_why_it_skips_auto_uninstaller() public void Should_not_call_command_executor() { CommandExecutor.Verify( - c => c.Execute(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny()), + c => c.Execute(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny()), Times.Never); } } @@ -377,7 +377,7 @@ public void Should_log_why_it_skips_auto_uninstaller() public void Should_not_call_command_executor() { CommandExecutor.Verify( - c => c.Execute(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny()), + c => c.Execute(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny()), Times.Never); } } @@ -409,7 +409,7 @@ public void Should_log_why_it_skips_auto_uninstaller() public void Should_not_call_command_executor() { CommandExecutor.Verify( - c => c.Execute(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny()), + c => c.Execute(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny()), Times.Never); } } @@ -440,7 +440,7 @@ public void Should_log_why_it_skips_auto_uninstaller() public void Should_not_call_command_executor() { CommandExecutor.Verify( - c => c.Execute(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny()), + c => c.Execute(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny()), Times.Never); } } @@ -658,7 +658,7 @@ public void Should_log_why_it_skips_auto_uninstaller() public void Should_not_call_command_executor() { CommandExecutor.Verify( - c => c.Execute(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny()), + c => c.Execute(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny()), Times.Never); } } diff --git a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs index 2ff3449421..68378c7eae 100644 --- a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs +++ b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs @@ -552,7 +552,7 @@ private static void SetLicensedOptions(ChocolateyConfiguration config, Chocolate BindingFlags.InvokeMethod, null, componentClass, - new Object[] { config, configFileSettings } + new object[] { config, configFileSettings } ); } catch (Exception ex) diff --git a/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs b/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs index 2dbd8b6570..a3e40b7d48 100644 --- a/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs +++ b/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs @@ -201,7 +201,7 @@ private static void SetLicensedEnvironment(ChocolateyConfiguration config) BindingFlags.InvokeMethod, null, componentClass, - new Object[] { config } + new object[] { config } ); } catch (Exception ex) diff --git a/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs b/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs index 0f4ae9f781..837ed85257 100644 --- a/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs +++ b/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs @@ -109,7 +109,7 @@ public static IEnumerable GetRemoteRepositories(ChocolateyConf "chocolatey".Log().Debug("Using proxy server '{0}'.".FormatWith(configuration.Proxy.Location)); var proxy = new System.Net.WebProxy(configuration.Proxy.Location, true); - if (!String.IsNullOrWhiteSpace(configuration.Proxy.User) && !String.IsNullOrWhiteSpace(configuration.Proxy.EncryptedPassword)) + if (!string.IsNullOrWhiteSpace(configuration.Proxy.User) && !string.IsNullOrWhiteSpace(configuration.Proxy.EncryptedPassword)) { proxy.Credentials = new NetworkCredential(configuration.Proxy.User, NugetEncryptionUtility.DecryptString(configuration.Proxy.EncryptedPassword)); } diff --git a/src/chocolatey/infrastructure.app/services/NugetService.cs b/src/chocolatey/infrastructure.app/services/NugetService.cs index e5fa5de9ba..da7f22a5fd 100644 --- a/src/chocolatey/infrastructure.app/services/NugetService.cs +++ b/src/chocolatey/infrastructure.app/services/NugetService.cs @@ -625,7 +625,7 @@ public virtual ConcurrentDictionary Install(ChocolateyCon NOTE: When you specify explicit sources, it overrides default sources. If the package version is a prerelease and you didn't specify `--pre`, the package may not be found.{2}{3}".FormatWith(packageName, config.Sources, string.IsNullOrWhiteSpace(config.Version) - ? String.Empty + ? string.Empty : @" Version was specified as '{0}'. It is possible that version does not exist for '{1}' at the source specified.".FormatWith(config.Version, packageName), diff --git a/src/chocolatey/infrastructure/adapters/Assembly.cs b/src/chocolatey/infrastructure/adapters/Assembly.cs index 6f9335b8ba..9ad93f9a8b 100644 --- a/src/chocolatey/infrastructure/adapters/Assembly.cs +++ b/src/chocolatey/infrastructure/adapters/Assembly.cs @@ -66,17 +66,17 @@ public AssemblyName GetName() return UnderlyingType.GetName(); } - public Type GetType(String name) + public Type GetType(string name) { return UnderlyingType.GetType(name); } - public Type GetType(String name, bool throwOnError) + public Type GetType(string name, bool throwOnError) { return UnderlyingType.GetType(name,throwOnError); } - public Type GetType(String name, bool throwOnError, bool ignoreCase) + public Type GetType(string name, bool throwOnError, bool ignoreCase) { return UnderlyingType.GetType(name,throwOnError, ignoreCase); } diff --git a/src/chocolatey/infrastructure/adapters/Console.cs b/src/chocolatey/infrastructure/adapters/Console.cs index 4c50b576ac..c2b9ff1f4d 100644 --- a/src/chocolatey/infrastructure/adapters/Console.cs +++ b/src/chocolatey/infrastructure/adapters/Console.cs @@ -443,7 +443,7 @@ private struct CONSOLE_SCREEN_BUFFER_INFO /// A CoOrd structure that contains the column and row coordinates of the cursor in the console screen buffer. internal COORD dwCursorPosition; /// The attributes of the characters written to a screen buffer by the WriteFile and WriteConsole functions, or echoed to a screen buffer by the ReadFile and ReadConsole functions. - internal System.Int16 wAttributes; + internal short wAttributes; /// A SmallRect structure that contains the console screen buffer coordinates of the upper-left and lower-right corners of the display window. internal SMALL_RECT srWindow; /// A CoOrd structure that contains the maximum size of the console window, in character columns and rows, given the current screen buffer size and font and the screen size. @@ -461,9 +461,9 @@ private struct CONSOLE_SCREEN_BUFFER_INFO private struct COORD { /// The horizontal coordinate or column value. - internal System.Int16 X; + internal short X; /// The vertical coordinate or row value. - internal System.Int16 Y; + internal short Y; } /// @@ -475,13 +475,13 @@ private struct COORD private struct SMALL_RECT { /// The x-coordinate of the upper left corner of the rectangle. - internal System.Int16 Left; + internal short Left; /// The y-coordinate of the upper left corner of the rectangle. - internal System.Int16 Top; + internal short Top; /// The x-coordinate of the lower right corner of the rectangle. - internal System.Int16 Right; + internal short Right; /// The y-coordinate of the lower right corner of the rectangle. - internal System.Int16 Bottom; + internal short Bottom; } private enum StdHandle diff --git a/src/chocolatey/infrastructure/adapters/IAssembly.cs b/src/chocolatey/infrastructure/adapters/IAssembly.cs index 73a96be9e2..93db3b98c3 100644 --- a/src/chocolatey/infrastructure/adapters/IAssembly.cs +++ b/src/chocolatey/infrastructure/adapters/IAssembly.cs @@ -80,11 +80,11 @@ public interface IAssembly AssemblyName GetName(); - Type GetType(String name); + Type GetType(string name); - Type GetType(String name, bool throwOnError); + Type GetType(string name, bool throwOnError); - Type GetType(String name, bool throwOnError, bool ignoreCase); + Type GetType(string name, bool throwOnError, bool ignoreCase); Type[] GetTypes(); diff --git a/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs b/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs index 76da2bc402..17fb13223b 100644 --- a/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs +++ b/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs @@ -70,7 +70,7 @@ public static string PromptForConfirmation(string prompt, IEnumerable ch Ensure .That(() => choices) .Meets( - c => !c.Any(String.IsNullOrWhiteSpace), + c => !c.Any(string.IsNullOrWhiteSpace), (name, value) => { throw new ApplicationException("Some choices are empty. Please ensure you provide no empty choices."); }); Ensure diff --git a/src/chocolatey/infrastructure/commands/ExternalCommandArgsBuilder.cs b/src/chocolatey/infrastructure/commands/ExternalCommandArgsBuilder.cs index 03141d9ecb..be6fa5c6f3 100644 --- a/src/chocolatey/infrastructure/commands/ExternalCommandArgsBuilder.cs +++ b/src/chocolatey/infrastructure/commands/ExternalCommandArgsBuilder.cs @@ -92,12 +92,12 @@ private static void FillArgsDictionary(Dictionary propertyValues var arg = configToArgNames[propName]; var propType = prop.PropertyType; var propValue = prop.GetValue(obj, null).ToStringSafe().QuoteIfContainsSpaces(); - if (propType == typeof (Boolean) && propValue.IsEqualTo(bool.FalseString)) + if (propType == typeof (bool) && propValue.IsEqualTo(bool.FalseString)) { continue; } - if (string.IsNullOrWhiteSpace(arg.ArgumentValue) && propType != typeof (Boolean)) + if (string.IsNullOrWhiteSpace(arg.ArgumentValue) && propType != typeof (bool)) { if (string.IsNullOrWhiteSpace(propValue)) { diff --git a/src/chocolatey/infrastructure/powershell/PoshHostUserInterface.cs b/src/chocolatey/infrastructure/powershell/PoshHostUserInterface.cs index 837e65ac1a..8126a2e78e 100644 --- a/src/chocolatey/infrastructure/powershell/PoshHostUserInterface.cs +++ b/src/chocolatey/infrastructure/powershell/PoshHostUserInterface.cs @@ -213,7 +213,7 @@ public override Dictionary Prompt(string caption, string messa /// private static string[] GetHotkeyAndLabel(string input) { - var result = new[] { String.Empty, String.Empty }; + var result = new[] { string.Empty, string.Empty }; //Do not use StringSplitOptions.RemoveEmptyEntries, it causes issues here string[] fragments = input.Split('&'); if (fragments.Length == 2) @@ -251,14 +251,14 @@ public override int PromptForChoice(string caption, string message, Collection Date: Thu, 4 Apr 2024 13:46:34 -0400 Subject: [PATCH 09/18] (maint) fix IDE0007 warnings Use var instead of explicit type --- src/chocolatey.console/Program.cs | 2 +- src/chocolatey.tests.integration/Scenario.cs | 10 +-- .../filesystem/DotNetFileSystemSpecs.cs | 4 +- .../scenarios/InstallScenarios.cs | 2 +- .../scenarios/UpgradeScenarios.cs | 2 +- src/chocolatey.tests/MockLogger.cs | 4 +- .../commands/ChocolateyPushCommandSpecs.cs | 2 +- .../nuget/NugetCommonSpecs.cs | 4 +- .../services/TemplateServiceSpecs.cs | 8 +- .../commandline/InteractivePromptSpecs.cs | 40 +++++----- .../infrastructure/guards/EnsureSpecs.cs | 12 +-- src/chocolatey/AssemblyExtensions.cs | 4 +- src/chocolatey/EnumExtensions.cs | 2 +- src/chocolatey/EnumerableExtensions.cs | 4 +- src/chocolatey/GetChocolatey.cs | 4 +- src/chocolatey/LogExtensions.cs | 2 +- src/chocolatey/StringExtensions.cs | 2 +- .../builders/ConfigurationBuilder.cs | 4 +- .../commands/ChocolateyApiKeyCommand.cs | 4 +- .../commands/ChocolateyConfigCommand.cs | 2 +- .../commands/ChocolateyFeatureCommand.cs | 2 +- .../commands/ChocolateyListCommand.cs | 4 +- .../commands/ChocolateyPinCommand.cs | 4 +- .../commands/ChocolateyPushCommand.cs | 2 +- .../commands/ChocolateySourceCommand.cs | 2 +- .../commands/ChocolateyTemplateCommand.cs | 2 +- .../configuration/EnvironmentSettings.cs | 4 +- .../ChocolateyNugetCredentialProvider.cs | 4 +- .../infrastructure.app/nuget/NugetList.cs | 10 +-- .../infrastructure.app/nuget/NugetPack.cs | 2 +- .../runners/ConsoleApplication.cs | 2 +- .../services/AutomaticUninstallerService.cs | 2 +- .../services/ChocolateyPackageService.cs | 16 ++-- .../services/ConfigTransformService.cs | 2 +- .../services/FilesService.cs | 2 +- .../services/NugetService.cs | 74 +++++++++---------- .../services/PendingRebootService.cs | 2 +- .../services/PowershellService.cs | 14 ++-- .../services/RegistryService.cs | 6 +- .../services/ShimGenerationService.cs | 6 +- .../commandline/InteractivePrompt.cs | 8 +- .../commands/CommandExecutor.cs | 2 +- .../commands/PowershellExecutor.cs | 2 +- .../extractors/AssemblyFileExtractor.cs | 2 +- .../filesystem/DotNetFileSystem.cs | 2 +- .../infrastructure/filesystem/FileSystem.cs | 4 +- .../information/ExtensionInformation.cs | 4 +- .../information/ProcessInformation.cs | 2 +- .../information/VersionInformation.cs | 4 +- .../licensing/LicenseValidation.cs | 2 +- .../infrastructure/logging/TraceLog.cs | 2 +- .../infrastructure/platforms/Platform.cs | 2 +- .../powershell/PoshHostUserInterface.cs | 18 ++--- .../registration/AssemblyResolution.cs | 2 +- .../infrastructure/registration/Bootstrap.cs | 2 +- .../registration/SimpleInjectorContainer.cs | 2 +- .../infrastructure/tokens/TokenReplacer.cs | 6 +- .../tolerance/FaultTolerance.cs | 4 +- 58 files changed, 175 insertions(+), 175 deletions(-) diff --git a/src/chocolatey.console/Program.cs b/src/chocolatey.console/Program.cs index 4428b162f0..cee7124520 100644 --- a/src/chocolatey.console/Program.cs +++ b/src/chocolatey.console/Program.cs @@ -58,7 +58,7 @@ private static void Main(string[] args) { AddAssemblyResolver(); - string loggingLocation = ApplicationParameters.LoggingLocation; + var loggingLocation = ApplicationParameters.LoggingLocation; //no file system at this point if (!Directory.Exists(loggingLocation)) { diff --git a/src/chocolatey.tests.integration/Scenario.cs b/src/chocolatey.tests.integration/Scenario.cs index 520d2b9f4e..0cbd200f79 100644 --- a/src/chocolatey.tests.integration/Scenario.cs +++ b/src/chocolatey.tests.integration/Scenario.cs @@ -56,11 +56,11 @@ public static IEnumerable GetInstalledPackagePaths() public static void Reset(ChocolateyConfiguration config) { - string packagesInstallPath = GetPackageInstallPath(); - string badPackagesPath = GetPackageInstallPath() + "-bad"; - string backupPackagesPath = GetPackageInstallPath() + "-bkp"; - string shimsPath = ApplicationParameters.ShimsLocation; - string hooksPath = ApplicationParameters.HooksLocation; + var packagesInstallPath = GetPackageInstallPath(); + var badPackagesPath = GetPackageInstallPath() + "-bad"; + var backupPackagesPath = GetPackageInstallPath() + "-bkp"; + var shimsPath = ApplicationParameters.ShimsLocation; + var hooksPath = ApplicationParameters.HooksLocation; _fileSystem.DeleteDirectoryChecked(config.CacheLocation, recursive: true, overrideAttributes: true); _fileSystem.DeleteDirectoryChecked(config.Sources, recursive: true, overrideAttributes: true); diff --git a/src/chocolatey.tests.integration/infrastructure/filesystem/DotNetFileSystemSpecs.cs b/src/chocolatey.tests.integration/infrastructure/filesystem/DotNetFileSystemSpecs.cs index 857e44ea2f..84bf2398c8 100644 --- a/src/chocolatey.tests.integration/infrastructure/filesystem/DotNetFileSystemSpecs.cs +++ b/src/chocolatey.tests.integration/infrastructure/filesystem/DotNetFileSystemSpecs.cs @@ -125,7 +125,7 @@ public void GetFiles_should_return_string_array_of_files() [Fact] public void GetFiles_should_return_files_that_meet_the_pattern() { - string filePath = FileSystem.CombinePaths(ContextPath, "chocolateyInstall.ps1"); + var filePath = FileSystem.CombinePaths(ContextPath, "chocolateyInstall.ps1"); FileSystem.WriteFile(filePath, "yo"); var actual = FileSystem.GetFiles(ContextPath, "chocolateyInstall.ps1", SearchOption.AllDirectories).ToList(); @@ -139,7 +139,7 @@ public void GetFiles_should_return_files_that_meet_the_pattern() [Platform(Exclude = "Mono")] public void GetFiles_should_return_files_that_meet_the_pattern_regardless_of_case() { - string filePath = FileSystem.CombinePaths(ContextPath, "chocolateyInstall.ps1"); + var filePath = FileSystem.CombinePaths(ContextPath, "chocolateyInstall.ps1"); FileSystem.WriteFile(filePath, "yo"); var actual = FileSystem.GetFiles(ContextPath, "chocolateyinstall.ps1", SearchOption.AllDirectories).ToList(); diff --git a/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs b/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs index 896b5c47fb..a7639013a2 100644 --- a/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs @@ -3013,7 +3013,7 @@ public void Should_create_a_hooks_folder_for_the_package() public void Should_install_hook_scripts_to_folder() { var hookScripts = new List { "pre-install-all.ps1", "post-install-all.ps1", "pre-upgrade-all.ps1", "post-upgrade-all.ps1", "pre-uninstall-all.ps1", "post-uninstall-all.ps1" }; - foreach (string scriptName in hookScripts) + foreach (var scriptName in hookScripts) { var hookScriptPath = Path.Combine(Scenario.GetTopLevel(), "hooks", Configuration.PackageNames.Replace(".hook", string.Empty), scriptName); File.ReadAllText(hookScriptPath).Should().Contain("Write-Output"); diff --git a/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs b/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs index ad93b8407c..cb0aa4ce3f 100644 --- a/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs @@ -3974,7 +3974,7 @@ public void Should_have_a_hooks_folder_for_the_package() public void Should_install_hook_scripts_to_folder() { var hookScripts = new List { "pre-install-all.ps1", "post-install-all.ps1", "pre-upgrade-all.ps1", "post-upgrade-all.ps1", "pre-uninstall-all.ps1", "post-uninstall-all.ps1" }; - foreach (string scriptName in hookScripts) + foreach (var scriptName in hookScripts) { var hookScriptPath = Path.Combine(Scenario.GetTopLevel(), "hooks", Configuration.PackageNames.Replace(".hook", string.Empty), scriptName); File.ReadAllText(hookScriptPath).Should().Contain("Write-Output"); diff --git a/src/chocolatey.tests/MockLogger.cs b/src/chocolatey.tests/MockLogger.cs index a17f368ec3..4ef454d9bc 100644 --- a/src/chocolatey.tests/MockLogger.cs +++ b/src/chocolatey.tests/MockLogger.cs @@ -58,7 +58,7 @@ public bool ContainsMessage(string expectedMessage, LogLevel level) public int ContainsMessageCount(string expectedMessage) { - int messageCount = 0; + var messageCount = 0; foreach (var messageLevel in Messages) { foreach (var message in messageLevel.Value.OrEmpty()) @@ -75,7 +75,7 @@ public int ContainsMessageCount(string expectedMessage) public int ContainsMessageCount(string expectedMessage, LogLevel level) { - int messageCount = 0; + var messageCount = 0; foreach (var message in MessagesFor(level).OrEmpty()) { if (message.Contains(expectedMessage)) diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPushCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPushCommandSpecs.cs index b42ba380c8..892b9b0284 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPushCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyPushCommandSpecs.cs @@ -135,7 +135,7 @@ public void Reset() public void Should_allow_a_path_to_the_nupkg_to_be_passed_in() { Reset(); - string nupkgPath = "./some/path/to.nupkg"; + var nupkgPath = "./some/path/to.nupkg"; _unparsedArgs.Add(nupkgPath); _because(); Configuration.Input.Should().Be(nupkgPath); diff --git a/src/chocolatey.tests/infrastructure.app/nuget/NugetCommonSpecs.cs b/src/chocolatey.tests/infrastructure.app/nuget/NugetCommonSpecs.cs index b6de1d9ea1..2310a1a30a 100644 --- a/src/chocolatey.tests/infrastructure.app/nuget/NugetCommonSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/nuget/NugetCommonSpecs.cs @@ -174,8 +174,8 @@ public void Should_set_user_agent_string() _because(); // Change this when the NuGet version is updated. - string nugetClientVersion = "6.4.1"; - string expectedUserAgentString = "{0}/{1} via NuGet Client/{2}".FormatWith(ApplicationParameters.UserAgent, _configuration.Information.ChocolateyProductVersion, nugetClientVersion); + var nugetClientVersion = "6.4.1"; + var expectedUserAgentString = "{0}/{1} via NuGet Client/{2}".FormatWith(ApplicationParameters.UserAgent, _configuration.Information.ChocolateyProductVersion, nugetClientVersion); UserAgent.UserAgentString.Should().StartWith(expectedUserAgentString); } } diff --git a/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs index ef99df6201..dd12c47423 100644 --- a/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs @@ -189,8 +189,8 @@ public override void BeforeEachSpec() [Fact] public void Should_throw_exception() { - bool errored = false; - string errorMessage = string.Empty; + var errored = false; + var errorMessage = string.Empty; try { @@ -212,8 +212,8 @@ public void Should_throw_exception_even_with_outputdirectory() { _config.OutputDirectory = "c:\\packages"; - bool errored = false; - string errorMessage = string.Empty; + var errored = false; + var errorMessage = string.Empty; try { diff --git a/src/chocolatey.tests/infrastructure/commandline/InteractivePromptSpecs.cs b/src/chocolatey.tests/infrastructure/commandline/InteractivePromptSpecs.cs index db3d4949ba..4a476d0fa3 100644 --- a/src/chocolatey.tests/infrastructure/commandline/InteractivePromptSpecs.cs +++ b/src/chocolatey.tests/infrastructure/commandline/InteractivePromptSpecs.cs @@ -62,7 +62,7 @@ public override void Because() public void Should_error_when_the_choicelist_is_null() { Choices = null; - bool errored = false; + var errored = false; Console.Setup(c => c.ReadLine()).Returns(""); //Enter pressed try { @@ -81,8 +81,8 @@ public void Should_error_when_the_choicelist_is_null() public void Should_error_when_the_choicelist_is_empty() { Choices = new List(); - bool errored = false; - string errorMessage = string.Empty; + var errored = false; + var errorMessage = string.Empty; Console.Setup(c => c.ReadLine()).Returns(""); //Enter pressed try { @@ -107,7 +107,7 @@ public void Should_error_when_the_prompt_input_is_null() "bob" }; PromptValue = null; - bool errored = false; + var errored = false; Console.Setup(c => c.ReadLine()).Returns(""); //Enter pressed try { @@ -130,8 +130,8 @@ public void Should_error_when_the_default_choice_is_not_in_list() "bob" }; _defaultChoice = "maybe"; - bool errored = false; - string errorMessage = string.Empty; + var errored = false; + var errorMessage = string.Empty; Console.Setup(c => c.ReadLine()).Returns(""); //Enter pressed string result = null; try @@ -257,7 +257,7 @@ public override void AfterObservations() [Fact] public void Should_error_when_no_answer_given() { - bool errored = false; + var errored = false; Console.Setup(c => c.ReadLine()).Returns(""); //Enter pressed try @@ -291,7 +291,7 @@ public void Should_return_second_choice_when_2_is_given() [Fact] public void Should_error_when_any_choice_not_available_is_given() { - bool errored = false; + var errored = false; Console.Setup(c => c.ReadLine()).Returns("3"); //Enter pressed try @@ -429,7 +429,7 @@ public void Should_return_second_choice_when_2_is_given() [Fact] public void Should_error_when_any_choice_not_available_is_given() { - bool errored = false; + var errored = false; Console.Setup(c => c.ReadLine()).Returns("3"); //Enter pressed try @@ -459,7 +459,7 @@ public override void Because() public void Should_error_when_the_choicelist_is_null() { Choices = null; - bool errored = false; + var errored = false; Console.Setup(c => c.ReadLine()).Returns(""); //Enter pressed try { @@ -478,8 +478,8 @@ public void Should_error_when_the_choicelist_is_null() public void Should_error_when_the_choicelist_is_empty() { Choices = new List(); - bool errored = false; - string errorMessage = string.Empty; + var errored = false; + var errorMessage = string.Empty; Console.Setup(c => c.ReadLine()).Returns(""); //Enter pressed try { @@ -504,8 +504,8 @@ public void Should_error_when_the_prompt_input_is_null() "bob" }; PromptValue = null; - bool errored = false; - string errorMessage = string.Empty; + var errored = false; + var errorMessage = string.Empty; Console.Setup(c => c.ReadLine()).Returns(""); //Enter pressed try { @@ -530,8 +530,8 @@ public void Should_error_when_the_choicelist_contains_empty_values() "bob", "" }; - bool errored = false; - string errorMessage = string.Empty; + var errored = false; + var errorMessage = string.Empty; Console.Setup(c => c.ReadLine()).Returns(""); //Enter pressed try { @@ -556,8 +556,8 @@ public void Should_error_when_the_choicelist_has_multiple_items_with_same_first_ "sally", "suzy" }; - bool errored = false; - string errorMessage = string.Empty; + var errored = false; + var errorMessage = string.Empty; Console.Setup(c => c.ReadLine()).Returns(""); //Enter pressed try { @@ -593,7 +593,7 @@ public override void AfterObservations() [Fact] public void Should_error_when_no_answer_given() { - bool errored = false; + var errored = false; Console.Setup(c => c.ReadLine()).Returns(""); //Enter pressed try @@ -643,7 +643,7 @@ public void Should_return_no_choice_when_n_is_given() [Fact] public void Should_error_when_any_choice_not_available_is_given() { - bool errored = false; + var errored = false; Console.Setup(c => c.ReadLine()).Returns("yup"); //Enter pressed try diff --git a/src/chocolatey.tests/infrastructure/guards/EnsureSpecs.cs b/src/chocolatey.tests/infrastructure/guards/EnsureSpecs.cs index fd168da681..b2cbece82e 100644 --- a/src/chocolatey.tests/infrastructure/guards/EnsureSpecs.cs +++ b/src/chocolatey.tests/infrastructure/guards/EnsureSpecs.cs @@ -149,7 +149,7 @@ public override void Because() [Fact] public void When_testing_a_string_against_is_not_null_should_pass() { - string test = "value"; + var test = "value"; Ensure.That(() => test).NotNull(); } @@ -230,7 +230,7 @@ public void When_testing_an_uninstantiated_class_against_is_not_null_should_thro [Fact] public void When_testing_meets_with_null_ensureFunction_against_string_value_should_throw_ArgumentNullException_on_ensureFunction() { - string test = "bob"; + var test = "bob"; object exceptionType = null; var exceptionMessage = string.Empty; try @@ -252,7 +252,7 @@ public void When_testing_meets_with_null_ensureFunction_against_string_value_sho [Fact] public void When_testing_meets_with_null_exceptionAction_against_string_value_that_passes_should_throw_ArgumentNullException_on_exceptionAction() { - string test = "bob"; + var test = "bob"; object exceptionType = null; var exceptionMessage = string.Empty; try @@ -275,7 +275,7 @@ public void When_testing_meets_with_null_exceptionAction_against_string_value_th [Fact] public void When_testing_meets_with_null_exceptionAction_against_string_value_that_fails_should_throw_ArgumentNullException_on_exceptionAction() { - string test = "bob"; + var test = "bob"; object exceptionType = null; var exceptionMessage = string.Empty; try @@ -373,7 +373,7 @@ public class When_testing_Ensure_meets_against_a_string_value_that_passes : Ensu public override void Because() { - string test = "bob"; + var test = "bob"; try { @@ -425,7 +425,7 @@ public class When_testing_Ensure_meets_against_a_string_value_that_fails : Ensur public override void Because() { - string test = "BOB"; + var test = "BOB"; try { diff --git a/src/chocolatey/AssemblyExtensions.cs b/src/chocolatey/AssemblyExtensions.cs index 6dd0bc8fc9..1209c8dfd2 100644 --- a/src/chocolatey/AssemblyExtensions.cs +++ b/src/chocolatey/AssemblyExtensions.cs @@ -38,7 +38,7 @@ public static class AssemblyExtensions /// public static string GetManifestString(this IAssembly assembly, string manifestResourceStreamLocation) { - string manifestFileText = ""; + var manifestFileText = ""; using (Stream manifestFileStream = assembly.GetManifestResourceStream(manifestResourceStreamLocation)) { @@ -90,7 +90,7 @@ public static string GetPublicKeyTokenString(this AssemblyName assemblyName) return string.Empty; } - byte[] publicKeyToken = assemblyName.GetPublicKeyToken(); + var publicKeyToken = assemblyName.GetPublicKeyToken(); if (publicKeyToken == null || publicKeyToken.Length == 0) { diff --git a/src/chocolatey/EnumExtensions.cs b/src/chocolatey/EnumExtensions.cs index 4cd7989e17..63ec59434a 100644 --- a/src/chocolatey/EnumExtensions.cs +++ b/src/chocolatey/EnumExtensions.cs @@ -32,7 +32,7 @@ public static class EnumExtensions /// The enumeration item. public static string DescriptionOrValue(this Enum enumeration) { - string description = enumeration.ToString(); + var description = enumeration.ToString(); Type type = enumeration.GetType(); MemberInfo[] memberInfo = type.GetMember(description); diff --git a/src/chocolatey/EnumerableExtensions.cs b/src/chocolatey/EnumerableExtensions.cs index e9e6c5cfbc..a65ad58ab9 100644 --- a/src/chocolatey/EnumerableExtensions.cs +++ b/src/chocolatey/EnumerableExtensions.cs @@ -66,8 +66,8 @@ public static string Join(this IEnumerable source, string separator) /// public static IEnumerable LastDistinct(this IEnumerable source, IEqualityComparer equalityComparer, IComparer comparer) { - bool first = true; - bool maxElementHasValue = false; + var first = true; + var maxElementHasValue = false; var previousElement = default(T); var maxElement = default(T); diff --git a/src/chocolatey/GetChocolatey.cs b/src/chocolatey/GetChocolatey.cs index a4fbbc7f4d..0e5236fd59 100644 --- a/src/chocolatey/GetChocolatey.cs +++ b/src/chocolatey/GetChocolatey.cs @@ -101,7 +101,7 @@ public GetChocolatey(bool initializeLogging) _container = SimpleInjectorContainer.Container; if (initializeLogging) { - string loggingLocation = ApplicationParameters.LoggingLocation; + var loggingLocation = ApplicationParameters.LoggingLocation; var fileSystem = _container.GetInstance(); fileSystem.EnsureDirectoryExists(loggingLocation); @@ -491,7 +491,7 @@ private ChocolateyConfiguration CreateConfiguration(IList args) private void EnsureEnvironment() { - string chocolateyInstall = string.Empty; + var chocolateyInstall = string.Empty; #if !DEBUG chocolateyInstall = Environment.GetEnvironmentVariable(ApplicationParameters.ChocolateyInstallEnvironmentVariableName, EnvironmentVariableTarget.Machine); diff --git a/src/chocolatey/LogExtensions.cs b/src/chocolatey/LogExtensions.cs index f3ff4f4442..2749764528 100644 --- a/src/chocolatey/LogExtensions.cs +++ b/src/chocolatey/LogExtensions.cs @@ -57,7 +57,7 @@ public static void ResetLoggers() /// Instance of a logger for the object. public static ILog Log(this T type) { - string objectName = typeof (T).FullName; + var objectName = typeof (T).FullName; return Log(objectName); } diff --git a/src/chocolatey/StringExtensions.cs b/src/chocolatey/StringExtensions.cs index 818d252334..9fc0df8ef0 100644 --- a/src/chocolatey/StringExtensions.cs +++ b/src/chocolatey/StringExtensions.cs @@ -192,7 +192,7 @@ public static SecureString ToSecureStringSafe(this string input) return secureString; } - foreach (char character in input) + foreach (var character in input) { secureString.AppendChar(character); } diff --git a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs index 68378c7eae..b29a148423 100644 --- a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs +++ b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs @@ -411,7 +411,7 @@ private static void SetGlobalOptions(IList args, ChocolateyConfiguration "CommandExecutionTimeout (in seconds) - The time to allow a command to finish before timing out. Overrides the default execution timeout in the configuration of {0} seconds. Supply '0' to disable the timeout.".FormatWith(config.CommandExecutionTimeoutSeconds.ToStringSafe()), option => { - int timeout = 0; + var timeout = 0; var timeoutString = option.UnquoteSafe(); int.TryParse(timeoutString, out timeout); if (timeout > 0 || timeoutString.IsEqualTo("0")) @@ -545,7 +545,7 @@ private static void SetLicensedOptions(ChocolateyConfiguration config, Chocolate } try { - object componentClass = Activator.CreateInstance(licensedConfigBuilder); + var componentClass = Activator.CreateInstance(licensedConfigBuilder); licensedConfigBuilder.InvokeMember( SetConfigurationMethod, diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs index 40da00fb0d..88d8f08894 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyApiKeyCommand.cs @@ -63,7 +63,7 @@ public virtual void ParseAdditionalArguments(IList unparsedArguments, Ch } var command = ApiKeyCommandType.Unknown; - string unparsedCommand = unparsedArguments.DefaultIfEmpty(string.Empty).FirstOrDefault(); + var unparsedCommand = unparsedArguments.DefaultIfEmpty(string.Empty).FirstOrDefault(); if (!Enum.TryParse(unparsedCommand, true, out command) || command == ApiKeyCommandType.Unknown) { @@ -194,7 +194,7 @@ public virtual void Run(ChocolateyConfiguration configuration) default: _configSettingsService.GetApiKey(configuration, (key) => { - string authenticatedString = string.IsNullOrWhiteSpace(key.Key) ? string.Empty : "(Authenticated)"; + var authenticatedString = string.IsNullOrWhiteSpace(key.Key) ? string.Empty : "(Authenticated)"; if (configuration.RegularOutput) { diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs index ae6c00f61d..3bcc4632d2 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyConfigCommand.cs @@ -58,7 +58,7 @@ public virtual void ParseAdditionalArguments(IList unparsedArguments, Ch { configuration.Input = string.Join(" ", unparsedArguments); var command = ConfigCommandType.Unknown; - string unparsedCommand = unparsedArguments.DefaultIfEmpty(string.Empty).FirstOrDefault().ToStringSafe().Replace("-", string.Empty); + var unparsedCommand = unparsedArguments.DefaultIfEmpty(string.Empty).FirstOrDefault().ToStringSafe().Replace("-", string.Empty); Enum.TryParse(unparsedCommand, true, out command); if (command == ConfigCommandType.Unknown) { diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs index c0adf6f6c3..40084c69ae 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyFeatureCommand.cs @@ -55,7 +55,7 @@ public virtual void ParseAdditionalArguments(IList unparsedArguments, Ch configuration.Input = string.Join(" ", unparsedArguments); var command = FeatureCommandType.Unknown; - string unparsedCommand = unparsedArguments.DefaultIfEmpty(string.Empty).FirstOrDefault(); + var unparsedCommand = unparsedArguments.DefaultIfEmpty(string.Empty).FirstOrDefault(); Enum.TryParse(unparsedCommand, true, out command); if (command == FeatureCommandType.Unknown) { diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs index e1650bf0d1..178ffd4bd6 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs @@ -151,8 +151,8 @@ public virtual void ParseAdditionalArguments(IList unparsedArguments, Ch foreach (var argument in unparsedArguments) { - bool isUnsupportedArgument = _unsupportedArguments.Contains(argument, StringComparer.OrdinalIgnoreCase); - bool isUnsupportedRegistryProgramsArgument = _unsupportedIncludeRegistryProgramsArguments.Contains(argument, StringComparer.OrdinalIgnoreCase); + var isUnsupportedArgument = _unsupportedArguments.Contains(argument, StringComparer.OrdinalIgnoreCase); + var isUnsupportedRegistryProgramsArgument = _unsupportedIncludeRegistryProgramsArguments.Contains(argument, StringComparer.OrdinalIgnoreCase); if (isUnsupportedArgument || isUnsupportedRegistryProgramsArgument) { diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs index 0cd37d4e3f..a8ca34318c 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs @@ -69,7 +69,7 @@ public virtual void ParseAdditionalArguments(IList unparsedArguments, Ch } var command = PinCommandType.Unknown; - string unparsedCommand = unparsedArguments.DefaultIfEmpty(string.Empty).FirstOrDefault(); + var unparsedCommand = unparsedArguments.DefaultIfEmpty(string.Empty).FirstOrDefault(); Enum.TryParse(unparsedCommand, true, out command); if (command == PinCommandType.Unknown) @@ -210,7 +210,7 @@ public virtual void SetPin(ChocolateyConfiguration config) var pkgInfo = _packageInfoService.Get(installedPackage.PackageMetadata); - bool changeMessage = pkgInfo.IsPinned != addingAPin; + var changeMessage = pkgInfo.IsPinned != addingAPin; pkgInfo.IsPinned = addingAPin; _packageInfoService.Save(pkgInfo); diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs index 50c08fcb8f..91c6512320 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyPushCommand.cs @@ -98,7 +98,7 @@ public virtual void Validate(ChocolateyConfiguration configuration) { if (remoteSource.Scheme == "http" && remoteSource.Host != "localhost") { - string errorMessage = + var errorMessage = @"WARNING! The specified source '{0}' is not secure. Sending apikey over insecure channels leaves your data susceptible to hackers. Please update your source to a more secure source and try again. diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs index 231b6e153c..dc5975fa52 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateySourceCommand.cs @@ -88,7 +88,7 @@ public virtual void ParseAdditionalArguments(IList unparsedArguments, Ch } var command = SourceCommandType.Unknown; - string unparsedCommand = unparsedArguments.DefaultIfEmpty(string.Empty).FirstOrDefault(); + var unparsedCommand = unparsedArguments.DefaultIfEmpty(string.Empty).FirstOrDefault(); Enum.TryParse(unparsedCommand, true, out command); if (command == SourceCommandType.Unknown) { diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyTemplateCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyTemplateCommand.cs index 9f2d8fd801..6a141f9059 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyTemplateCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyTemplateCommand.cs @@ -59,7 +59,7 @@ public virtual void ParseAdditionalArguments(IList unparsedArguments, Ch } var command = TemplateCommandType.Unknown; - string unparsedCommand = unparsedArguments.DefaultIfEmpty(string.Empty).FirstOrDefault(); + var unparsedCommand = unparsedArguments.DefaultIfEmpty(string.Empty).FirstOrDefault(); Enum.TryParse(unparsedCommand, true, out command); if (command == TemplateCommandType.Unknown) diff --git a/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs b/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs index a3e40b7d48..6bbc714172 100644 --- a/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs +++ b/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs @@ -194,7 +194,7 @@ private static void SetLicensedEnvironment(ChocolateyConfiguration config) } try { - object componentClass = Activator.CreateInstance(licensedEnvironmentSettings); + var componentClass = Activator.CreateInstance(licensedEnvironmentSettings); licensedEnvironmentSettings.InvokeMember( SetEnvironmentMethod, @@ -357,7 +357,7 @@ private static string GetProcessOnlyItems(string currentValues, IEnumerable> SearchPackagesAsyn var cacheContext = new ChocolateySourceCacheContext(configuration); var packageRepositoryResources = NugetCommon.GetRepositoryResources(configuration, nugetLogger, filesystem, cacheContext); - string searchTermLower = configuration.Input.ToLowerSafe(); + var searchTermLower = configuration.Input.ToLowerSafe(); - SearchFilter searchFilter = new SearchFilter(configuration.Prerelease); + var searchFilter = new SearchFilter(configuration.Prerelease); searchFilter.IncludeDelisted = configuration.ListCommand.LocalOnly; searchFilter.OrderBy = SearchOrderBy.Id; diff --git a/src/chocolatey/infrastructure.app/nuget/NugetPack.cs b/src/chocolatey/infrastructure.app/nuget/NugetPack.cs index 3615343f8a..fda053c7c9 100644 --- a/src/chocolatey/infrastructure.app/nuget/NugetPack.cs +++ b/src/chocolatey/infrastructure.app/nuget/NugetPack.cs @@ -33,7 +33,7 @@ public static bool BuildPackage(PackageBuilder builder, IFileSystem fileSystem, ExcludeFiles(builder.Files); // Track if the package file was already present on disk - bool isExistingPackage = fileSystem.FileExists(outputPath); + var isExistingPackage = fileSystem.FileExists(outputPath); try { using (Stream stream = fileSystem.CreateFile(outputPath)) diff --git a/src/chocolatey/infrastructure.app/runners/ConsoleApplication.cs b/src/chocolatey/infrastructure.app/runners/ConsoleApplication.cs index dc11f10b09..43e8b886fa 100644 --- a/src/chocolatey/infrastructure.app/runners/ConsoleApplication.cs +++ b/src/chocolatey/infrastructure.app/runners/ConsoleApplication.cs @@ -47,7 +47,7 @@ public void Run(string[] args, ChocolateyConfiguration config, Container contain IList commandArgs = new List(); //shift the first arg off - int count = 0; + var count = 0; foreach (var arg in args) { if (count == 0) diff --git a/src/chocolatey/infrastructure.app/services/AutomaticUninstallerService.cs b/src/chocolatey/infrastructure.app/services/AutomaticUninstallerService.cs index b960879436..7aad58871f 100644 --- a/src/chocolatey/infrastructure.app/services/AutomaticUninstallerService.cs +++ b/src/chocolatey/infrastructure.app/services/AutomaticUninstallerService.cs @@ -280,7 +280,7 @@ Automatic Uninstaller due to licensed enhancements and Package if (!installer.ValidUninstallExitCodes.Contains(exitCode)) { Environment.ExitCode = exitCode; - string logMessage = " Auto uninstaller failed. Please remove machine installation manually.{0} Exit code was {1}".FormatWith(Environment.NewLine, exitCode); + var logMessage = " Auto uninstaller failed. Please remove machine installation manually.{0} Exit code was {1}".FormatWith(Environment.NewLine, exitCode); this.Log().Error(() => logMessage.EscapeCurlyBraces()); packageResult.Messages.Add(new ResultMessage(config.Features.FailOnAutoUninstaller ? ResultType.Error : ResultType.Warn, logMessage)); } diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs index ad60ee05f4..dc9516e19f 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs @@ -463,7 +463,7 @@ public virtual void HandlePackageResult(PackageResult packageResult, ChocolateyC var pkgInfo = GetPackageInformation(packageResult, config); // initialize this here so it can be used for the install location later - bool powerShellRan = false; + var powerShellRan = false; if (packageResult.Success && config.Information.PlatformType == PlatformType.Windows) { @@ -1633,7 +1633,7 @@ private void HandleExtensionPackages(ChocolateyConfiguration config, PackageResu () => _fileSystem.CopyDirectory(extensionFolderToCopy, packageExtensionsInstallDirectory, overwriteExisting: true), "Attempted to copy{0} '{1}'{0} to '{2}'{0} but had an error".FormatWith(Environment.NewLine, extensionFolderToCopy, packageExtensionsInstallDirectory)); - string logMessage = " Installed/updated {0} extensions.".FormatWith(extensionsFolderName); + var logMessage = " Installed/updated {0} extensions.".FormatWith(extensionsFolderName); this.Log().Warn(logMessage); packageResult.Messages.Add(new ResultMessage(ResultType.Note, logMessage)); @@ -1641,7 +1641,7 @@ private void HandleExtensionPackages(ChocolateyConfiguration config, PackageResu } else { - string logMessage = " Uninstalled {0} extensions.".FormatWith(extensionsFolderName); + var logMessage = " Uninstalled {0} extensions.".FormatWith(extensionsFolderName); this.Log().Warn(logMessage); packageResult.Messages.Add(new ResultMessage(ResultType.Note, logMessage)); } @@ -1732,7 +1732,7 @@ private void HandleTemplatePackages(ChocolateyConfiguration config, PackageResul }, "Attempted to copy{0} '{1}'{0} to '{2}'{0} but had an error".FormatWith(Environment.NewLine, templatesFolderToCopy, installTemplatePath)); - string logMessage = " Installed/updated {0} template.".FormatWith(templateFolderName); + var logMessage = " Installed/updated {0} template.".FormatWith(templateFolderName); this.Log().Warn(logMessage); packageResult.Messages.Add(new ResultMessage(ResultType.Note, logMessage)); @@ -1740,7 +1740,7 @@ private void HandleTemplatePackages(ChocolateyConfiguration config, PackageResul } else { - string logMessage = " Uninstalled {0} template.".FormatWith(templateFolderName); + var logMessage = " Uninstalled {0} template.".FormatWith(templateFolderName); this.Log().Warn(logMessage); packageResult.Messages.Add(new ResultMessage(ResultType.Note, logMessage)); } @@ -1756,7 +1756,7 @@ private void EnsureBadPackagesPathIsClean(ChocolateyConfiguration config, Packag FaultTolerance.TryCatchWithLoggingException( () => { - string badPackageInstallPath = packageResult.InstallLocation.Replace(ApplicationParameters.PackagesLocation, ApplicationParameters.PackageFailuresLocation); + var badPackageInstallPath = packageResult.InstallLocation.Replace(ApplicationParameters.PackagesLocation, ApplicationParameters.PackageFailuresLocation); if (_fileSystem.DirectoryExists(badPackageInstallPath)) { _fileSystem.DeleteDirectory(badPackageInstallPath, recursive: true); @@ -2101,7 +2101,7 @@ private void HandleHookPackages(ChocolateyConfiguration config, PackageResult pa }, "Attempted to copy{0} '{1}'{0} to '{2}'{0} but had an error".FormatWith(Environment.NewLine, hookFolderToCopy, installHookPath)); - string logMessage = " Installed/updated {0} hook.".FormatWith(hookFolderName); + var logMessage = " Installed/updated {0} hook.".FormatWith(hookFolderName); this.Log().Warn(logMessage); packageResult.Messages.Add(new ResultMessage(ResultType.Note, logMessage)); @@ -2109,7 +2109,7 @@ private void HandleHookPackages(ChocolateyConfiguration config, PackageResult pa } else { - string logMessage = " Uninstalled {0} hook.".FormatWith(hookFolderName); + var logMessage = " Uninstalled {0} hook.".FormatWith(hookFolderName); this.Log().Warn(logMessage); packageResult.Messages.Add(new ResultMessage(ResultType.Note, logMessage)); } diff --git a/src/chocolatey/infrastructure.app/services/ConfigTransformService.cs b/src/chocolatey/infrastructure.app/services/ConfigTransformService.cs index d700026fdd..ba0f4ae789 100644 --- a/src/chocolatey/infrastructure.app/services/ConfigTransformService.cs +++ b/src/chocolatey/infrastructure.app/services/ConfigTransformService.cs @@ -116,7 +116,7 @@ public void Run(PackageResult packageResult, ChocolateyConfiguration config) this.Log().Debug(() => "Creating backup configuration file for '{0}'.".FormatWith(targetFile)); _fileSystem.CopyFile(targetFile, backupTargetFile, overwriteExisting: true); - bool succeeded = transformation.Apply(document); + var succeeded = transformation.Apply(document); if (succeeded) { this.Log().Debug(() => "Transform applied successfully for '{0}'".FormatWith(targetFile)); diff --git a/src/chocolatey/infrastructure.app/services/FilesService.cs b/src/chocolatey/infrastructure.app/services/FilesService.cs index f6d9bf244f..386749efc4 100644 --- a/src/chocolatey/infrastructure.app/services/FilesService.cs +++ b/src/chocolatey/infrastructure.app/services/FilesService.cs @@ -167,7 +167,7 @@ public PackageFiles CaptureSnapshot(string directory, ChocolateyConfiguration co this.Log().Debug(() => "Capturing package files in '{0}'".FormatWith(directory)); //gather all files in the folder var files = _fileSystem.GetFiles(directory, pattern: "*.*", option: SearchOption.AllDirectories); - foreach (string file in files.OrEmpty().Where(f => !f.EndsWith(ApplicationParameters.PackagePendingFileName))) + foreach (var file in files.OrEmpty().Where(f => !f.EndsWith(ApplicationParameters.PackagePendingFileName))) { packageFiles.Files.Add(GetPackageFile(file)); } diff --git a/src/chocolatey/infrastructure.app/services/NugetService.cs b/src/chocolatey/infrastructure.app/services/NugetService.cs index da7f22a5fd..8811788002 100644 --- a/src/chocolatey/infrastructure.app/services/NugetService.cs +++ b/src/chocolatey/infrastructure.app/services/NugetService.cs @@ -121,7 +121,7 @@ public virtual int Count(ChocolateyConfiguration config) } } - int? pageValue = config.ListCommand.Page; + var pageValue = config.ListCommand.Page; try { var sourceCacheContext = new ChocolateySourceCacheContext(config); @@ -144,7 +144,7 @@ public virtual void ListDryRun(ChocolateyConfiguration config) public virtual IEnumerable List(ChocolateyConfiguration config) { - int count = 0; + var count = 0; var sources = config.Sources; var prerelease = config.Prerelease; @@ -349,7 +349,7 @@ public virtual string GetPackageFileOrThrow(ChocolateyConfiguration config, stri return filesFound.FirstOrDefault(); }; - string filePath = !string.IsNullOrWhiteSpace(config.Input) ? config.Input : getLocalFiles.Invoke(_fileSystem); + var filePath = !string.IsNullOrWhiteSpace(config.Input) ? config.Input : getLocalFiles.Invoke(_fileSystem); Ensure.That(() => filePath).Meets((file) => _fileSystem.GetFileExtension(file).IsEqualTo(extension) && _fileSystem.FileExists(file), (name, value) => { throw new ArgumentException("File specified is either not found or not a {0} file. '{1}'".FormatWith(extension, value)); }); @@ -393,18 +393,18 @@ public virtual void Pack(ChocolateyConfiguration config) var propertyProvider = new DictionaryPropertyProvider(properties); //Allows empty directories to be distributed in templates via .template packages, issue #1003 - bool includeEmptyDirectories = true; + var includeEmptyDirectories = true; //No need to be deterministic, it's ok to include timestamps - bool deterministic = false; + var deterministic = false; var builder = new PackageBuilder(nuspecFilePath, nuspecDirectory, propertyProvider.GetPropertyValue, includeEmptyDirectories, deterministic, _nugetLogger); if (!string.IsNullOrWhiteSpace(config.Version)) { builder.Version = new NuGetVersion(config.Version); } - string outputFile = builder.Id + "." + builder.Version.ToNormalizedStringChecked() + NuGetConstants.PackageExtension; - string outputFolder = config.OutputDirectory ?? _fileSystem.GetCurrentDirectory(); - string outputPath = _fileSystem.CombinePaths(outputFolder, outputFile); + var outputFile = builder.Id + "." + builder.Version.ToNormalizedStringChecked() + NuGetConstants.PackageExtension; + var outputFolder = config.OutputDirectory ?? _fileSystem.GetCurrentDirectory(); + var outputPath = _fileSystem.CombinePaths(outputFolder, outputFile); config.Sources = outputFolder; @@ -428,14 +428,14 @@ public virtual void Pack(ChocolateyConfiguration config) public void PushDryRun(ChocolateyConfiguration config) { - string nupkgFilePath = GetPackageFileOrThrow(config, NuGetConstants.PackageExtension); + var nupkgFilePath = GetPackageFileOrThrow(config, NuGetConstants.PackageExtension); this.Log().Info(() => "Would have attempted to push '{0}' to source '{1}'.".FormatWith(_fileSystem.GetFileName(nupkgFilePath), config.Sources)); } public virtual void Push(ChocolateyConfiguration config) { - string nupkgFilePath = GetPackageFileOrThrow(config, NuGetConstants.PackageExtension); - string nupkgFileName = _fileSystem.GetFileName(nupkgFilePath); + var nupkgFilePath = GetPackageFileOrThrow(config, NuGetConstants.PackageExtension); + var nupkgFileName = _fileSystem.GetFileName(nupkgFilePath); if (config.RegularOutput) { this.Log().Info(() => "Attempting to push {0} to {1}".FormatWith(nupkgFileName, config.Sources)); @@ -561,7 +561,7 @@ public virtual ConcurrentDictionary Install(ChocolateyCon config.CreateBackup(); - foreach (string packageName in packageNames.OrEmpty()) + foreach (var packageName in packageNames.OrEmpty()) { // We need to ensure we are using a clean configuration file // before we start reading it. @@ -577,13 +577,13 @@ public virtual ConcurrentDictionary Install(ChocolateyCon if (Platform.GetPlatform() != PlatformType.Windows && !packageName.EndsWith(".template")) { - string logMessage = "{0} is not a supported package on non-Windows systems.{1}Only template packages are currently supported.".FormatWith(packageName, Environment.NewLine); + var logMessage = "{0} is not a supported package on non-Windows systems.{1}Only template packages are currently supported.".FormatWith(packageName, Environment.NewLine); this.Log().Warn(ChocolateyLoggers.Important, logMessage); } if (installedPackage != null && (version == null || version == installedPackage.PackageMetadata.Version) && !config.Force) { - string logMessage = "{0} v{1} already installed.{2} Use --force to reinstall, specify a version to install, or try upgrade.".FormatWith(installedPackage.Name, installedPackage.Version, Environment.NewLine); + var logMessage = "{0} v{1} already installed.{2} Use --force to reinstall, specify a version to install, or try upgrade.".FormatWith(installedPackage.Name, installedPackage.Version, Environment.NewLine); var nullResult = packageResultsToReturn.GetOrAdd(packageName, installedPackage); nullResult.Messages.Add(new ResultMessage(ResultType.Warn, logMessage)); nullResult.Messages.Add(new ResultMessage(ResultType.Inconclusive, logMessage)); @@ -604,7 +604,7 @@ public virtual ConcurrentDictionary Install(ChocolateyCon if (installedPackage != null && version != null && version < installedPackage.PackageMetadata.Version && !config.AllowDowngrade) { - string logMessage = "A newer version of {0} (v{1}) is already installed.{2} Use --allow-downgrade or --force to attempt to install older versions.".FormatWith(installedPackage.Name, installedPackage.Version, Environment.NewLine); + var logMessage = "A newer version of {0} (v{1}) is already installed.{2} Use --allow-downgrade or --force to attempt to install older versions.".FormatWith(installedPackage.Name, installedPackage.Version, Environment.NewLine); var nullResult = packageResultsToReturn.GetOrAdd(packageName, installedPackage); nullResult.Messages.Add(new ResultMessage(ResultType.Error, logMessage)); this.Log().Error(ChocolateyLoggers.Important, logMessage); @@ -730,7 +730,7 @@ Version was specified as '{0}'. It is possible that version { var forcedResult = packageResultsToReturn.GetOrAdd(packageToUninstall.Identity.Id, packageToUninstall); forcedResult.Messages.Add(new ResultMessage(ResultType.Note, "Removing old version")); - string logMessage = "{0}:{1} {2}".FormatWith("Unable to remove existing package", Environment.NewLine, ex.Message); + var logMessage = "{0}:{1} {2}".FormatWith("Unable to remove existing package", Environment.NewLine, ex.Message); this.Log().Warn(logMessage); forcedResult.Messages.Add(new ResultMessage(ResultType.Inconclusive, logMessage)); } @@ -785,7 +785,7 @@ Version was specified as '{0}'. It is possible that version .GetAwaiter().GetResult(); } - bool shouldAddForcedResultMessage = false; + var shouldAddForcedResultMessage = false; var packageToUninstall = packagesToUninstall.FirstOrDefault(p => p.PackageMetadata.Id.Equals(packageDependencyInfo.Id, StringComparison.OrdinalIgnoreCase)); if (packageToUninstall != null) @@ -806,7 +806,7 @@ Version was specified as '{0}'. It is possible that version { var forcedResult = packageResultsToReturn.GetOrAdd(packageToUninstall.Name, packageToUninstall); forcedResult.Messages.Add(new ResultMessage(ResultType.Note, "Backing up and removing old version")); - string logMessage = "{0}:{1} {2}".FormatWith("Unable to remove existing package prior to forced reinstall", Environment.NewLine, ex.Message); + var logMessage = "{0}:{1} {2}".FormatWith("Unable to remove existing package prior to forced reinstall", Environment.NewLine, ex.Message); this.Log().Warn(logMessage); forcedResult.Messages.Add(new ResultMessage(ResultType.Inconclusive, logMessage)); forcedResult.Messages.Add(new ResultMessage(ResultType.Error, logMessage)); @@ -1027,7 +1027,7 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon config.CreateBackup(); - foreach (string packageName in config.PackageNames.Split(new[] { ApplicationParameters.PackageNamesSeparator }, StringSplitOptions.RemoveEmptyEntries).OrEmpty()) + foreach (var packageName in config.PackageNames.Split(new[] { ApplicationParameters.PackageNamesSeparator }, StringSplitOptions.RemoveEmptyEntries).OrEmpty()) { // We need to ensure we are using a clean configuration file // before we start reading it. @@ -1051,7 +1051,7 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon { if (config.UpgradeCommand.FailOnNotInstalled) { - string failLogMessage = "{0} is not installed. Cannot upgrade a non-existent package.".FormatWith(packageName); + var failLogMessage = "{0} is not installed. Cannot upgrade a non-existent package.".FormatWith(packageName); var result = packageResultsToReturn.GetOrAdd(packageName, new PackageResult(packageName, null, null)); result.Messages.Add(new ResultMessage(ResultType.Error, failLogMessage)); if (config.RegularOutput) @@ -1064,7 +1064,7 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon if (config.Features.SkipPackageUpgradesWhenNotInstalled) { - string warnLogMessage = "{0} is not installed and skip non-installed option selected. Skipping...".FormatWith(packageName); + var warnLogMessage = "{0} is not installed and skip non-installed option selected. Skipping...".FormatWith(packageName); var result = packageResultsToReturn.GetOrAdd(packageName, new PackageResult(packageName, null, null)); result.Messages.Add(new ResultMessage(ResultType.Warn, warnLogMessage)); if (config.RegularOutput) @@ -1075,7 +1075,7 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon continue; } - string logMessage = @"{0} is not installed. Installing...".FormatWith(packageName); + var logMessage = @"{0} is not installed. Installing...".FormatWith(packageName); localPackageListValid = false; if (config.RegularOutput) @@ -1103,7 +1103,7 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon } var pkgInfo = _packageInfoService.Get(installedPackage.PackageMetadata); - bool isPinned = pkgInfo != null && pkgInfo.IsPinned; + var isPinned = pkgInfo != null && pkgInfo.IsPinned; if (isPinned && config.OutdatedCommand.IgnorePinned) { @@ -1116,7 +1116,7 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon if (version != null && version < installedPackage.PackageMetadata.Version && !config.AllowDowngrade) { - string logMessage = "A newer version of {0} (v{1}) is already installed.{2} Use --allow-downgrade or --force to attempt to upgrade to older versions.".FormatWith(installedPackage.PackageMetadata.Id, installedPackage.Version, Environment.NewLine); + var logMessage = "A newer version of {0} (v{1}) is already installed.{2} Use --allow-downgrade or --force to attempt to upgrade to older versions.".FormatWith(installedPackage.PackageMetadata.Id, installedPackage.Version, Environment.NewLine); var nullResult = packageResultsToReturn.GetOrAdd(packageName, new PackageResult(installedPackage.PackageMetadata, pathResolver.GetInstallPath(installedPackage.PackageMetadata.Id))); nullResult.Messages.Add(new ResultMessage(ResultType.Error, logMessage)); this.Log().Error(ChocolateyLoggers.Important, logMessage); @@ -1141,7 +1141,7 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon continue; } - string logMessage = "{0} was not found with the source(s) listed.{1} If you specified a particular version and are receiving this message, it is possible that the package name exists but the version does not.{1} Version: \"{2}\"; Source(s): \"{3}\"".FormatWith(packageName, Environment.NewLine, config.Version, config.Sources); + var logMessage = "{0} was not found with the source(s) listed.{1} If you specified a particular version and are receiving this message, it is possible that the package name exists but the version does not.{1} Version: \"{2}\"; Source(s): \"{3}\"".FormatWith(packageName, Environment.NewLine, config.Version, config.Sources); var unfoundResult = packageResultsToReturn.GetOrAdd(packageName, new PackageResult(packageName, version.ToFullStringChecked(), null)); if (config.UpgradeCommand.FailOnUnfound) @@ -1173,7 +1173,7 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon var packageResult = packageResultsToReturn.GetOrAdd(packageName, new PackageResult(availablePackage, pathResolver.GetInstallPath(availablePackage.Identity))); if (installedPackage.PackageMetadata.Version > availablePackage.Identity.Version && (!config.AllowDowngrade || (config.AllowDowngrade && version == null))) { - string logMessage = "{0} v{1} is newer than the most recent.".FormatWith(installedPackage.PackageMetadata.Id, installedPackage.Version); + var logMessage = "{0} v{1} is newer than the most recent.".FormatWith(installedPackage.PackageMetadata.Id, installedPackage.Version); packageResult.Messages.Add(new ResultMessage(ResultType.Inconclusive, logMessage)); if (!config.UpgradeCommand.NotifyOnlyAvailableUpgrades) @@ -1193,7 +1193,7 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon if (installedPackage.PackageMetadata.Version == availablePackage.Identity.Version) { - string logMessage = "{0} v{1} is the latest version available based on your source(s).".FormatWith(installedPackage.PackageMetadata.Id, installedPackage.Version); + var logMessage = "{0} v{1} is the latest version available based on your source(s).".FormatWith(installedPackage.PackageMetadata.Id, installedPackage.Version); if (!config.Force) { @@ -1228,7 +1228,7 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon { if (availablePackage.Identity.Version > installedPackage.PackageMetadata.Version) { - string logMessage = "You have {0} v{1} installed. Version {2} is available based on your source(s).".FormatWith(installedPackage.PackageMetadata.Id, installedPackage.Version, availablePackage.Identity.Version); + var logMessage = "You have {0} v{1} installed. Version {2} is available based on your source(s).".FormatWith(installedPackage.PackageMetadata.Id, installedPackage.Version, availablePackage.Identity.Version); packageResult.Messages.Add(new ResultMessage(ResultType.Note, logMessage)); if (config.RegularOutput) @@ -1243,7 +1243,7 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon if (isPinned) { - string logMessage = "{0} is pinned. Skipping pinned package.".FormatWith(packageName); + var logMessage = "{0} is pinned. Skipping pinned package.".FormatWith(packageName); packageResult.Messages.Add(new ResultMessage(ResultType.Warn, logMessage)); packageResult.Messages.Add(new ResultMessage(ResultType.Inconclusive, logMessage)); if (config.RegularOutput) @@ -1376,7 +1376,7 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon { var forcedResult = packageResultsToReturn.GetOrAdd(packageToUninstall.Identity.Id, packageToUninstall); forcedResult.Messages.Add(new ResultMessage(ResultType.Note, "Removing old version")); - string logMessage = "{0}:{1} {2}".FormatWith("Unable to remove existing package", Environment.NewLine, ex.Message); + var logMessage = "{0}:{1} {2}".FormatWith("Unable to remove existing package", Environment.NewLine, ex.Message); this.Log().Warn(logMessage); forcedResult.Messages.Add(new ResultMessage(ResultType.Inconclusive, logMessage)); } @@ -1538,7 +1538,7 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon { var forcedResult = packageResultsToReturn.GetOrAdd(packageToUninstall.Name, packageToUninstall); forcedResult.Messages.Add(new ResultMessage(ResultType.Note, "Backing up and removing old version")); - string logMessage = "{0}:{1} {2}".FormatWith("Unable to remove existing package prior to upgrade", Environment.NewLine, ex.Message); + var logMessage = "{0}:{1} {2}".FormatWith("Unable to remove existing package prior to upgrade", Environment.NewLine, ex.Message); this.Log().Warn(logMessage); //forcedResult.Messages.Add(new ResultMessage(ResultType.Inconclusive, logMessage)); forcedResult.Messages.Add(new ResultMessage(ResultType.Error, logMessage)); @@ -1693,13 +1693,13 @@ public virtual ConcurrentDictionary GetOutdated(Chocolate var installedPackage = allPackages.FirstOrDefault(p => string.Equals(p.Name, packageName, StringComparison.OrdinalIgnoreCase)); var pkgInfo = _packageInfoService.Get(installedPackage.PackageMetadata); - bool isPinned = pkgInfo.IsPinned; + var isPinned = pkgInfo.IsPinned; // if the package is pinned and we are skipping pinned, // move on quickly if (isPinned && config.OutdatedCommand.IgnorePinned) { - string pinnedLogMessage = "{0} is pinned. Skipping pinned package.".FormatWith(packageName); + var pinnedLogMessage = "{0} is pinned. Skipping pinned package.".FormatWith(packageName); var pinnedPackageResult = outdatedPackages.GetOrAdd(packageName, new PackageResult(installedPackage.PackageMetadata, pathResolver.GetInstallPath(installedPackage.PackageMetadata.Id))); pinnedPackageResult.Messages.Add(new ResultMessage(ResultType.Debug, pinnedLogMessage)); pinnedPackageResult.Messages.Add(new ResultMessage(ResultType.Inconclusive, pinnedLogMessage)); @@ -1722,7 +1722,7 @@ public virtual ConcurrentDictionary GetOutdated(Chocolate continue; } - string unfoundLogMessage = "{0} was not found with the source(s) listed.{1} Source(s): \"{2}\"".FormatWith(packageName, Environment.NewLine, config.Sources); + var unfoundLogMessage = "{0} was not found with the source(s) listed.{1} Source(s): \"{2}\"".FormatWith(packageName, Environment.NewLine, config.Sources); var unfoundResult = outdatedPackages.GetOrAdd(packageName, new PackageResult(installedPackage.PackageMetadata, pathResolver.GetInstallPath(installedPackage.PackageMetadata.Id))); unfoundResult.Messages.Add(new ResultMessage(ResultType.Warn, unfoundLogMessage)); unfoundResult.Messages.Add(new ResultMessage(ResultType.Inconclusive, unfoundLogMessage)); @@ -1738,7 +1738,7 @@ public virtual ConcurrentDictionary GetOutdated(Chocolate var packageResult = outdatedPackages.GetOrAdd(packageName, new PackageResult(latestPackage, pathResolver.GetInstallPath(latestPackage.Identity))); - string logMessage = "You have {0} v{1} installed. Version {2} is available based on your source(s).{3} Source(s): \"{4}\"".FormatWith(installedPackage.Name, installedPackage.Version, latestPackage.Identity.Version, Environment.NewLine, config.Sources); + var logMessage = "You have {0} v{1} installed. Version {2} is available based on your source(s).{3} Source(s): \"{4}\"".FormatWith(installedPackage.Name, installedPackage.Version, latestPackage.Identity.Version, Environment.NewLine, config.Sources); packageResult.Messages.Add(new ResultMessage(ResultType.Note, logMessage)); this.Log().Info("{0}|{1}|{2}|{3}".FormatWith(installedPackage.Name, installedPackage.Version, latestPackage.Identity.Version, isPinned.ToStringSafe().ToLowerSafe())); @@ -2283,7 +2283,7 @@ public virtual ConcurrentDictionary Uninstall(ChocolateyC var packageVersionsToRemove = new List(); - foreach (string packageName in config.PackageNames.Split(new[] { ApplicationParameters.PackageNamesSeparator }, StringSplitOptions.RemoveEmptyEntries).OrEmpty()) + foreach (var packageName in config.PackageNames.Split(new[] { ApplicationParameters.PackageNamesSeparator }, StringSplitOptions.RemoveEmptyEntries).OrEmpty()) { // We need to ensure we are using a clean configuration file // before we start reading it. @@ -2302,7 +2302,7 @@ public virtual ConcurrentDictionary Uninstall(ChocolateyC if (installedPackageVersions.Count == 0) { - string logMessage = "{0} is not installed. Cannot uninstall a non-existent package.".FormatWith(packageName); + var logMessage = "{0} is not installed. Cannot uninstall a non-existent package.".FormatWith(packageName); var missingResult = packageResultsToReturn.GetOrAdd(packageName, new PackageResult(packageName, null, null)); missingResult.Messages.Add(new ResultMessage(ResultType.Error, logMessage)); diff --git a/src/chocolatey/infrastructure.app/services/PendingRebootService.cs b/src/chocolatey/infrastructure.app/services/PendingRebootService.cs index c32fc8b747..e526217a6e 100644 --- a/src/chocolatey/infrastructure.app/services/PendingRebootService.cs +++ b/src/chocolatey/infrastructure.app/services/PendingRebootService.cs @@ -69,7 +69,7 @@ private bool IsPendingComputerRename() var activeName = GetRegistryKeyString(path.FormatWith("ActiveComputerName"), "ComputerName"); var pendingName = GetRegistryKeyString(path.FormatWith("ComputerName"), "ComputerName"); - bool result = !string.IsNullOrWhiteSpace(activeName) && + var result = !string.IsNullOrWhiteSpace(activeName) && !string.IsNullOrWhiteSpace(pendingName) && activeName != pendingName; diff --git a/src/chocolatey/infrastructure.app/services/PowershellService.cs b/src/chocolatey/infrastructure.app/services/PowershellService.cs index 1cf567e9ef..3ef71aaa99 100644 --- a/src/chocolatey/infrastructure.app/services/PowershellService.cs +++ b/src/chocolatey/infrastructure.app/services/PowershellService.cs @@ -88,7 +88,7 @@ private string GetPackageScriptForAction(PackageResult packageResult, CommandNam private IEnumerable GetHookScripts(ChocolateyConfiguration configuration, PackageResult packageResult, CommandNameType command, bool isPreHook) { - List hookScriptPaths = new List(); + var hookScriptPaths = new List(); // If skipping hook scripts, return an empty list if (configuration.SkipHookScripts) @@ -252,7 +252,7 @@ public bool RunAction(ChocolateyConfiguration configuration, PackageResult packa foreach (var hookScriptPath in hookPreScriptPathList.Concat(hookPostScriptPathList).OrEmpty()) { this.Log().Debug(ChocolateyLoggers.Important, "Contents of '{0}':".FormatWith(chocoPowerShellScript)); - string hookScriptContents = _fileSystem.ReadFile(hookScriptPath); + var hookScriptContents = _fileSystem.ReadFile(hookScriptPath); this.Log().Debug(() => hookScriptContents.EscapeCurlyBraces()); } @@ -262,12 +262,12 @@ public bool RunAction(ChocolateyConfiguration configuration, PackageResult packa var package = packageResult.SearchMetadata; PreparePowerShellEnvironment(package, configuration, packageDirectory); - bool shouldRun = !configuration.PromptForConfirmation; + var shouldRun = !configuration.PromptForConfirmation; if (!string.IsNullOrEmpty(chocoPowerShellScript)) { this.Log().Debug(ChocolateyLoggers.Important, "Contents of '{0}':".FormatWith(chocoPowerShellScript)); - string chocoPowerShellScriptContents = _fileSystem.ReadFile(chocoPowerShellScript); + var chocoPowerShellScriptContents = _fileSystem.ReadFile(chocoPowerShellScript); // leave this way, doesn't take it through formatting. this.Log().Debug(() => chocoPowerShellScriptContents.EscapeCurlyBraces()); @@ -644,7 +644,7 @@ public PowerShellExecutionResults RunHost(ChocolateyConfiguration config, string var result = new PowerShellExecutionResults(); - string commandToRun = WrapScriptWithModule(chocoPowerShellScript, hookPreScriptPathList, hookPostScriptPathList, config); + var commandToRun = WrapScriptWithModule(chocoPowerShellScript, hookPreScriptPathList, hookPostScriptPathList, config); var host = new PoshHost(config); this.Log().Debug(() => "Calling built-in PowerShell host with ['{0}']".FormatWith(commandToRun.EscapeCurlyBraces())); @@ -672,7 +672,7 @@ public PowerShellExecutionResults RunHost(ChocolateyConfiguration config, string // Write-Output pipeline.Output.DataReady += (sender, args) => { - PipelineReader reader = sender as PipelineReader; + var reader = sender as PipelineReader; if (reader != null) { @@ -686,7 +686,7 @@ public PowerShellExecutionResults RunHost(ChocolateyConfiguration config, string // Write-Error pipeline.Error.DataReady += (sender, args) => { - PipelineReader reader = sender as PipelineReader; + var reader = sender as PipelineReader; if (reader != null) { diff --git a/src/chocolatey/infrastructure.app/services/RegistryService.cs b/src/chocolatey/infrastructure.app/services/RegistryService.cs index ed5a850e8b..13debb4245 100644 --- a/src/chocolatey/infrastructure.app/services/RegistryService.cs +++ b/src/chocolatey/infrastructure.app/services/RegistryService.cs @@ -361,7 +361,7 @@ private string GetMsiUserDataKey(string name) return string.Empty; } - for (int i = 0; i < 3; i++) + for (var i = 0; i < 3; i++) { var fullGroup = match.Groups["ReverseFull{0}".FormatWith(i + 1)]; if (fullGroup != null) @@ -369,13 +369,13 @@ private string GetMsiUserDataKey(string name) _userDataKey.Append(fullGroup.Value.ToCharArray().Reverse().ToArray()); } } - for (int i = 0; i < 2; i++) + for (var i = 0; i < 2; i++) { var pairsGroup = match.Groups["ReversePairs{0}".FormatWith(i + 1)]; if (pairsGroup != null) { var pairValue = pairsGroup.Value; - for (int j = 0; j < pairValue.Length - 1; j++) + for (var j = 0; j < pairValue.Length - 1; j++) { _userDataKey.Append("{1}{0}".FormatWith(pairValue[j], pairValue[j + 1])); j++; diff --git a/src/chocolatey/infrastructure.app/services/ShimGenerationService.cs b/src/chocolatey/infrastructure.app/services/ShimGenerationService.cs index 9b7ffaab5e..eb431305ae 100644 --- a/src/chocolatey/infrastructure.app/services/ShimGenerationService.cs +++ b/src/chocolatey/infrastructure.app/services/ShimGenerationService.cs @@ -89,14 +89,14 @@ public void Install(ChocolateyConfiguration configuration, PackageResult package //gather all .exes in the folder var exeFiles = _fileSystem.GetFiles(packageResult.InstallLocation, pattern: "*.exe", option: SearchOption.AllDirectories); - foreach (string file in exeFiles.OrEmpty()) + foreach (var file in exeFiles.OrEmpty()) { if (_fileSystem.FileExists(file + ".ignore")) { continue; } - bool isGui = _fileSystem.FileExists(file + ".gui"); + var isGui = _fileSystem.FileExists(file + ".gui"); //todo: #2586 v2 be able to determine gui automatically var args = ExternalCommandArgsBuilder.BuildArguments(configuration, _shimGenArguments); @@ -146,7 +146,7 @@ public void Uninstall(ChocolateyConfiguration configuration, PackageResult packa { //gather all .exes in the folder var exeFiles = _fileSystem.GetFiles(packageResult.InstallLocation, pattern: "*.exe", option: SearchOption.AllDirectories); - foreach (string file in exeFiles.OrEmpty()) + foreach (var file in exeFiles.OrEmpty()) { if (_fileSystem.FileExists(file + ".ignore")) { diff --git a/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs b/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs index 17fb13223b..93ec8b965f 100644 --- a/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs +++ b/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs @@ -93,7 +93,7 @@ public static string PromptForConfirmation(string prompt, IEnumerable ch "chocolatey".Log().Info(shortPrompt ? ChocolateyLoggers.LogFileOnly : ChocolateyLoggers.Important, prompt); - int counter = 1; + var counter = 1; IDictionary choiceDictionary = new Dictionary(); foreach (var choice in choices.OrEmpty()) { @@ -135,7 +135,7 @@ public static string PromptForConfirmation(string prompt, IEnumerable ch return defaultChoice; } - int selected = -1; + var selected = -1; if (!int.TryParse(selection, out selected) || selected <= 0 || selected > (counter - 1)) { // check to see if value was passed @@ -189,7 +189,7 @@ public static string GetPassword(bool interactive) { password = password.Substring(0, password.Length - 1); // get the location of the cursor - int pos = System.Console.CursorLeft; + var pos = System.Console.CursorLeft; // move the cursor to the left by one character System.Console.SetCursorPosition(pos - 1, System.Console.CursorTop); // replace it with space @@ -200,7 +200,7 @@ public static string GetPassword(bool interactive) info = possibleNonInteractive ? Console.ReadKey(TimeoutInSeconds * 1000) : Console.ReadKey(true); } } - for (int i = 0; i < password.Length; i++) + for (var i = 0; i < password.Length; i++) { Console.Write("*"); } diff --git a/src/chocolatey/infrastructure/commands/CommandExecutor.cs b/src/chocolatey/infrastructure/commands/CommandExecutor.cs index 5ab7b1304e..36b9edb95e 100644 --- a/src/chocolatey/infrastructure/commands/CommandExecutor.cs +++ b/src/chocolatey/infrastructure/commands/CommandExecutor.cs @@ -157,7 +157,7 @@ public static int ExecuteStatic(string process, bool waitForExit ) { - int exitCode = -1; + var exitCode = -1; if (updateProcessPath) { process = FileSystem.GetFullPath(process); diff --git a/src/chocolatey/infrastructure/commands/PowershellExecutor.cs b/src/chocolatey/infrastructure/commands/PowershellExecutor.cs index e6b02e9153..4f753d7aae 100644 --- a/src/chocolatey/infrastructure/commands/PowershellExecutor.cs +++ b/src/chocolatey/infrastructure/commands/PowershellExecutor.cs @@ -52,7 +52,7 @@ Action stdErrAction _powershell = GetPowerShellLocation(fileSystem); } //-NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%DIR%chocolatey.ps1' %PS_ARGS%" - string arguments = "-NoProfile -NoLogo -ExecutionPolicy Bypass -Command \"{0}\"".FormatWith(command); + var arguments = "-NoProfile -NoLogo -ExecutionPolicy Bypass -Command \"{0}\"".FormatWith(command); return CommandExecutor.ExecuteStatic( _powershell, diff --git a/src/chocolatey/infrastructure/extractors/AssemblyFileExtractor.cs b/src/chocolatey/infrastructure/extractors/AssemblyFileExtractor.cs index 0509542cf1..e649219fc1 100644 --- a/src/chocolatey/infrastructure/extractors/AssemblyFileExtractor.cs +++ b/src/chocolatey/infrastructure/extractors/AssemblyFileExtractor.cs @@ -48,7 +48,7 @@ public static void ExtractTextFileFromAssembly(IFileSystem fileSystem, IAssembly var fileText = assembly.GetManifestString(manifestLocation); if (string.IsNullOrWhiteSpace(fileText)) { - string errorMessage = "Could not find a file in the manifest resource stream of '{0}' at '{1}'.".FormatWith(assembly.FullName, manifestLocation); + var errorMessage = "Could not find a file in the manifest resource stream of '{0}' at '{1}'.".FormatWith(assembly.FullName, manifestLocation); "chocolatey".Log().Error(() => errorMessage); throw new FileNotFoundException(errorMessage); } diff --git a/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs b/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs index 8b7520b2c0..73bf1890da 100644 --- a/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs +++ b/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs @@ -425,7 +425,7 @@ public bool CopyFileUnsafe(string sourceFilePath, string destinationFilePath, bo EnsureDirectoryExists(GetDirectoryName(destinationFilePath), ignoreError: true); //Private Declare Function apiCopyFile Lib "kernel32" Alias "CopyFileA" _ - int success = CopyFileW(sourceFilePath, destinationFilePath, overwriteExisting ? 0 : 1); + var success = CopyFileW(sourceFilePath, destinationFilePath, overwriteExisting ? 0 : 1); //if (success == 0) //{ // var error = Marshal.GetLastWin32Error(); diff --git a/src/chocolatey/infrastructure/filesystem/FileSystem.cs b/src/chocolatey/infrastructure/filesystem/FileSystem.cs index 486693b6c8..30eae25b0c 100644 --- a/src/chocolatey/infrastructure/filesystem/FileSystem.cs +++ b/src/chocolatey/infrastructure/filesystem/FileSystem.cs @@ -24,9 +24,9 @@ public static class FileSystem public static byte[] ReadFileBytes(string filePath) { byte[] fileBytes = null; - using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) + using (var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { - using (BinaryReader binaryReader = new BinaryReader(fs)) + using (var binaryReader = new BinaryReader(fs)) { fileBytes = binaryReader.ReadBytes((int)fs.Length); } diff --git a/src/chocolatey/infrastructure/information/ExtensionInformation.cs b/src/chocolatey/infrastructure/information/ExtensionInformation.cs index 26962c4cb4..84d8fa2c2f 100644 --- a/src/chocolatey/infrastructure/information/ExtensionInformation.cs +++ b/src/chocolatey/infrastructure/information/ExtensionInformation.cs @@ -36,7 +36,7 @@ public ExtensionInformation(IAssembly assembly) public override bool Equals(object obj) { - ExtensionInformation information = obj as ExtensionInformation; + var information = obj as ExtensionInformation; return !ReferenceEquals(information, null) && Name == information.Name && Version == information.Version; @@ -47,7 +47,7 @@ public override int GetHashCode() // We do this in an uncheched statement so there won't be any arithmetic exceptions unchecked { - int hashCode = 14; + var hashCode = 14; hashCode = (hashCode * 6) + EqualityComparer.Default.GetHashCode(Name) + EqualityComparer.Default.GetHashCode(Version); diff --git a/src/chocolatey/infrastructure/information/ProcessInformation.cs b/src/chocolatey/infrastructure/information/ProcessInformation.cs index 0dd241af01..a19f7c9d97 100644 --- a/src/chocolatey/infrastructure/information/ProcessInformation.cs +++ b/src/chocolatey/infrastructure/information/ProcessInformation.cs @@ -69,7 +69,7 @@ public static bool UserIsAdministrator() "chocolatey".Log().Debug(@"User may be subject to UAC, checking for a split token (not 100% effective)."); - int tokenInfLength = Marshal.SizeOf(typeof(int)); + var tokenInfLength = Marshal.SizeOf(typeof(int)); IntPtr tokenInformation = Marshal.AllocHGlobal(tokenInfLength); try diff --git a/src/chocolatey/infrastructure/information/VersionInformation.cs b/src/chocolatey/infrastructure/information/VersionInformation.cs index 74998248ce..f3016dcb3a 100644 --- a/src/chocolatey/infrastructure/information/VersionInformation.cs +++ b/src/chocolatey/infrastructure/information/VersionInformation.cs @@ -30,7 +30,7 @@ public static string GetCurrentAssemblyVersion(IAssembly assembly = null) assembly = Assembly.GetExecutingAssembly(); } - string location = assembly != null ? assembly.Location : string.Empty; + var location = assembly != null ? assembly.Location : string.Empty; if (!string.IsNullOrEmpty(location)) { @@ -61,7 +61,7 @@ public static string GetCurrentInformationalVersion(IAssembly assembly = null) assembly = Assembly.GetExecutingAssembly(); } - string location = assembly != null ? assembly.Location : string.Empty; + var location = assembly != null ? assembly.Location : string.Empty; if (!string.IsNullOrEmpty(location)) { diff --git a/src/chocolatey/infrastructure/licensing/LicenseValidation.cs b/src/chocolatey/infrastructure/licensing/LicenseValidation.cs index 6efbbfb22b..abcb1347ed 100644 --- a/src/chocolatey/infrastructure/licensing/LicenseValidation.cs +++ b/src/chocolatey/infrastructure/licensing/LicenseValidation.cs @@ -37,7 +37,7 @@ public static ChocolateyLicense Validate() var regularLogOutput = ShouldLogErrorsToConsole(); - string licenseFile = ApplicationParameters.LicenseFileLocation; + var licenseFile = ApplicationParameters.LicenseFileLocation; var userLicenseFile = ApplicationParameters.UserLicenseFileLocation; if (File.Exists(userLicenseFile)) { diff --git a/src/chocolatey/infrastructure/logging/TraceLog.cs b/src/chocolatey/infrastructure/logging/TraceLog.cs index b8eb31cb48..abe1c2c86e 100644 --- a/src/chocolatey/infrastructure/logging/TraceLog.cs +++ b/src/chocolatey/infrastructure/logging/TraceLog.cs @@ -64,7 +64,7 @@ private void EnableNetworkLogging() { //// force initialization HttpWebRequest.Create("http://localhost"); - Thread waitForInitializationThread = new Thread(() => + var waitForInitializationThread = new Thread(() => { while (!(bool)isInitialized.GetValue(null)) { diff --git a/src/chocolatey/infrastructure/platforms/Platform.cs b/src/chocolatey/infrastructure/platforms/Platform.cs index 1127192146..7b8411a0d1 100644 --- a/src/chocolatey/infrastructure/platforms/Platform.cs +++ b/src/chocolatey/infrastructure/platforms/Platform.cs @@ -121,7 +121,7 @@ private static string GetWindowsVersionName(Version version) //https://msdn.microsoft.com/en-us/library/windows/desktop/ms724832.aspx //switch doesn't like a double, but a string is fine?! - string majorMinor = version.Major + "." + version.Minor; + var majorMinor = version.Major + "." + version.Minor; switch (majorMinor) { case "10.0": diff --git a/src/chocolatey/infrastructure/powershell/PoshHostUserInterface.cs b/src/chocolatey/infrastructure/powershell/PoshHostUserInterface.cs index 8126a2e78e..ca56b4f0a1 100644 --- a/src/chocolatey/infrastructure/powershell/PoshHostUserInterface.cs +++ b/src/chocolatey/infrastructure/powershell/PoshHostUserInterface.cs @@ -174,7 +174,7 @@ public override Dictionary Prompt(string caption, string messa } else { - string[] label = GetHotkeyAndLabel(field.Label); + var label = GetHotkeyAndLabel(field.Label); this.Log().Warn(label[1].EscapeCurlyBraces()); } @@ -215,7 +215,7 @@ private static string[] GetHotkeyAndLabel(string input) { var result = new[] { string.Empty, string.Empty }; //Do not use StringSplitOptions.RemoveEmptyEntries, it causes issues here - string[] fragments = input.Split('&'); + var fragments = input.Split('&'); if (fragments.Length == 2) { if (fragments[1].Length > 0) @@ -245,11 +245,11 @@ public override int PromptForChoice(string caption, string message, Collection(TConfig configuration, string textTo var regex = new Regex("{0}(?\\w+){1}".FormatWith(Regex.Escape(tokenPrefix), Regex.Escape(tokenSuffix))); - string output = regex.Replace(textToReplace, m => + var output = regex.Replace(textToReplace, m => { - string key = ""; + var key = ""; var originalKey = m.Groups["key"].Value; key = originalKey.ToLowerSafe(); @@ -49,7 +49,7 @@ public static string ReplaceTokens(TConfig configuration, string textTo return tokenPrefix + originalKey + tokenSuffix; } - string value = dictionary[key]; + var value = dictionary[key]; return value; }); diff --git a/src/chocolatey/infrastructure/tolerance/FaultTolerance.cs b/src/chocolatey/infrastructure/tolerance/FaultTolerance.cs index d99d7e0b7e..906e37af9d 100644 --- a/src/chocolatey/infrastructure/tolerance/FaultTolerance.cs +++ b/src/chocolatey/infrastructure/tolerance/FaultTolerance.cs @@ -100,7 +100,7 @@ public static T Retry(int numberOfTries, Func function, int waitDurationMi logLocation = ChocolateyLoggers.LogFileOnly; } - for (int i = 1; i <= numberOfTries; i++) + for (var i = 1; i <= numberOfTries; i++) { try { @@ -115,7 +115,7 @@ public static T Retry(int numberOfTries, Func function, int waitDurationMi throw; } - int retryWait = waitDurationMilliseconds + (i*increaseRetryByMilliseconds); + var retryWait = waitDurationMilliseconds + (i*increaseRetryByMilliseconds); var exceptionMessage = debugging ? ex.ToString() : ex.Message; From 61aa6eb0bcd95ff447e7be9b44df59388c72a1df Mon Sep 17 00:00:00 2001 From: Rain Sallow Date: Thu, 4 Apr 2024 14:01:59 -0400 Subject: [PATCH 10/18] (maint) Fix IDE0028 warnings Simplify colleciton initialisation --- .../commands/ExternalCommandArgsBuilderSpecs.cs | 15 +++++++++------ .../infrastructure/filesystem/DotNetFileSystem.cs | 8 +++++--- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/chocolatey.tests/infrastructure/commands/ExternalCommandArgsBuilderSpecs.cs b/src/chocolatey.tests/infrastructure/commands/ExternalCommandArgsBuilderSpecs.cs index e27b445453..ea8bc38129 100644 --- a/src/chocolatey.tests/infrastructure/commands/ExternalCommandArgsBuilderSpecs.cs +++ b/src/chocolatey.tests/infrastructure/commands/ExternalCommandArgsBuilderSpecs.cs @@ -85,13 +85,16 @@ public void Should_skip_a_parameter_that_does_not_match_the_case_of_the_property [Fact] public void Should_add_a_parameter_that_does_not_match_the_case_of_the_property_name_when_dictionary_ignores_case() { - IDictionary ignoreCaseDictionary = new Dictionary(StringComparer.InvariantCultureIgnoreCase); - ignoreCaseDictionary.Add( - "sources", - new ExternalCommandArgument + IDictionary ignoreCaseDictionary = new Dictionary(StringComparer.InvariantCultureIgnoreCase) + { { - ArgumentOption = "-source " - }); + "sources", + new ExternalCommandArgument + { + ArgumentOption = "-source " + } + } + }; ExternalCommandArgsBuilder.BuildArguments(Configuration, ignoreCaseDictionary).Should().Be("-source yo"); } diff --git a/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs b/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs index 73bf1890da..d72321984b 100644 --- a/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs +++ b/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs @@ -169,9 +169,11 @@ public string GetExecutablePath(string executableName) // Gets the path to an executable based on looking in current // working directory, next to the running process, then among the // derivatives of Path and Pathext variables, applied in order. - var searchPaths = new List(); - searchPaths.Add(GetCurrentDirectory()); - searchPaths.Add(GetDirectoryName(GetCurrentAssemblyPath())); + var searchPaths = new List + { + GetCurrentDirectory(), + GetDirectoryName(GetCurrentAssemblyPath()) + }; searchPaths.AddRange(Environment.GetEnvironmentVariable(ApplicationParameters.Environment.Path).ToStringSafe().Split(new[] { GetPathSeparator() }, StringSplitOptions.RemoveEmptyEntries)); foreach (var path in searchPaths.OrEmpty()) From 365c036f9fce7a2487f340cdc1b86bb767741e1e Mon Sep 17 00:00:00 2001 From: Rain Sallow Date: Thu, 4 Apr 2024 14:07:44 -0400 Subject: [PATCH 11/18] (maint) fix IDE0041 warnings Simplify null check --- .../infrastructure.app/domain/RegistryApplicationKey.cs | 2 +- src/chocolatey/infrastructure.app/nuget/NugetList.cs | 8 ++++---- .../infrastructure/information/ExtensionInformation.cs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/chocolatey/infrastructure.app/domain/RegistryApplicationKey.cs b/src/chocolatey/infrastructure.app/domain/RegistryApplicationKey.cs index 210251a23f..86db5de414 100644 --- a/src/chocolatey/infrastructure.app/domain/RegistryApplicationKey.cs +++ b/src/chocolatey/infrastructure.app/domain/RegistryApplicationKey.cs @@ -117,7 +117,7 @@ public override bool Equals(object obj) bool IEquatable.Equals(RegistryApplicationKey other) { - if (ReferenceEquals(other, null)) + if (other is null) { return false; } diff --git a/src/chocolatey/infrastructure.app/nuget/NugetList.cs b/src/chocolatey/infrastructure.app/nuget/NugetList.cs index 71e7dddd2c..ec7ef7aa8f 100644 --- a/src/chocolatey/infrastructure.app/nuget/NugetList.cs +++ b/src/chocolatey/infrastructure.app/nuget/NugetList.cs @@ -424,7 +424,7 @@ public bool Equals(IPackageSearchMetadata x, IPackageSearchMetadata y) return true; } - if (ReferenceEquals(x, null) || ReferenceEquals(y, null)) + if (x is null || y is null) { return false; } @@ -433,7 +433,7 @@ public bool Equals(IPackageSearchMetadata x, IPackageSearchMetadata y) public int GetHashCode(IPackageSearchMetadata obj) { - if (ReferenceEquals(obj, null)) + if (obj is null) { return 0; } @@ -450,7 +450,7 @@ public bool Equals(IPackageSearchMetadata x, IPackageSearchMetadata y) return true; } - if (ReferenceEquals(x, null) || ReferenceEquals(y, null)) + if (x is null || y is null) { return false; } @@ -460,7 +460,7 @@ public bool Equals(IPackageSearchMetadata x, IPackageSearchMetadata y) public int GetHashCode(IPackageSearchMetadata obj) { - if (ReferenceEquals(obj, null)) + if (obj is null) { return 0; } diff --git a/src/chocolatey/infrastructure/information/ExtensionInformation.cs b/src/chocolatey/infrastructure/information/ExtensionInformation.cs index 84d8fa2c2f..25dd40c4fa 100644 --- a/src/chocolatey/infrastructure/information/ExtensionInformation.cs +++ b/src/chocolatey/infrastructure/information/ExtensionInformation.cs @@ -37,7 +37,7 @@ public ExtensionInformation(IAssembly assembly) public override bool Equals(object obj) { var information = obj as ExtensionInformation; - return !ReferenceEquals(information, null) && + return information is object && Name == information.Name && Version == information.Version; } From caf90026ddfd8ec83751b1a09bd16dfcdd2042d4 Mon Sep 17 00:00:00 2001 From: Rain Sallow Date: Thu, 4 Apr 2024 14:25:02 -0400 Subject: [PATCH 12/18] (maint) Fix IDE0040 errors Require accessibility modifiers --- .../services/AutomaticUninstallerServiceSpecs.cs | 6 +++--- .../infrastructure/information/ProcessInformation.cs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/chocolatey.tests/infrastructure.app/services/AutomaticUninstallerServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/AutomaticUninstallerServiceSpecs.cs index 87101f939a..027ec07c8b 100644 --- a/src/chocolatey.tests/infrastructure.app/services/AutomaticUninstallerServiceSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/services/AutomaticUninstallerServiceSpecs.cs @@ -131,7 +131,7 @@ public void Should_not_call_command_executor() public class When_an_autoUninstaller_skip_file_exists : AutomaticUninstallerServiceSpecsBase { private string _skipFileName = ".skipAutoUninstall"; - IEnumerable _fileList = new List() { "c:\\.skipAutoUninstall" }; + private IEnumerable _fileList = new List() { "c:\\.skipAutoUninstall" }; public override void Context() { base.Context(); @@ -665,7 +665,7 @@ public void Should_not_call_command_executor() public class When_AutomaticUninstallerService_is_passed_uninstall_arguments_from_command_line : AutomaticUninstallerServiceSpecsBase { - IInstaller _installerType = new InnoSetupInstaller(); + private IInstaller _installerType = new InnoSetupInstaller(); public override void Context() { @@ -719,7 +719,7 @@ public void Should_call_command_executor_appending_passed_arguments() public class When_AutomaticUninstallerService_is_passed_overriding_uninstall_arguments_from_command_line : AutomaticUninstallerServiceSpecsBase { - IInstaller _installerType = new InnoSetupInstaller(); + private IInstaller _installerType = new InnoSetupInstaller(); public override void Context() { diff --git a/src/chocolatey/infrastructure/information/ProcessInformation.cs b/src/chocolatey/infrastructure/information/ProcessInformation.cs index a19f7c9d97..87c2dbdff0 100644 --- a/src/chocolatey/infrastructure/information/ProcessInformation.cs +++ b/src/chocolatey/infrastructure/information/ProcessInformation.cs @@ -201,7 +201,7 @@ _Out_ PDWORD ReturnLength /// Passed to to specify what /// information about the token to return. /// - enum TokenInformationType + private enum TokenInformationType { TokenUser = 1, TokenGroups, @@ -237,7 +237,7 @@ enum TokenInformationType /// /// The elevation type for a user token. /// - enum TokenElevationType + private enum TokenElevationType { TokenElevationTypeDefault = 1, TokenElevationTypeFull, From 118160264f27777bdd037128ba6fb08c9fdbd456 Mon Sep 17 00:00:00 2001 From: Rain Sallow Date: Thu, 4 Apr 2024 14:29:46 -0400 Subject: [PATCH 13/18] (maint) Fix IDE0017 warnings Simplify object initialisation --- .../AutomaticUninstallerServiceSpecs.cs | 6 ++++-- .../services/NugetServiceSpecs.cs | 18 ++++++++++++------ .../infrastructure.app/nuget/NugetList.cs | 16 ++++++++++------ .../infrastructure/platforms/Platform.cs | 7 ++++--- 4 files changed, 30 insertions(+), 17 deletions(-) diff --git a/src/chocolatey.tests/infrastructure.app/services/AutomaticUninstallerServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/AutomaticUninstallerServiceSpecs.cs index 027ec07c8b..ccdb877ab0 100644 --- a/src/chocolatey.tests/infrastructure.app/services/AutomaticUninstallerServiceSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/services/AutomaticUninstallerServiceSpecs.cs @@ -61,8 +61,10 @@ public override void Context() { chocolatey.infrastructure.commands.CommandExecutor.InitializeWith(new Lazy(() => FileSystem.Object), () => Process.Object); - Service = new AutomaticUninstallerService(PackageInfoService.Object, FileSystem.Object, RegistryService.Object, CommandExecutor.Object); - Service.WaitForCleanup = false; + Service = new AutomaticUninstallerService(PackageInfoService.Object, FileSystem.Object, RegistryService.Object, CommandExecutor.Object) + { + WaitForCleanup = false + }; Config.Features.AutoUninstaller = true; Config.PromptForConfirmation = false; Config.PackageNames = "regular"; diff --git a/src/chocolatey.tests/infrastructure.app/services/NugetServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/NugetServiceSpecs.cs index 570405b0a2..e9221657d7 100644 --- a/src/chocolatey.tests/infrastructure.app/services/NugetServiceSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/services/NugetServiceSpecs.cs @@ -67,8 +67,10 @@ public override void Context() { base.Context(); Package.Setup(x => x.Id).Returns("bob"); - _packageInfo = new ChocolateyPackageInformation(Package.Object); - _packageInfo.FilesSnapshot = new PackageFiles(); + _packageInfo = new ChocolateyPackageInformation(Package.Object) + { + FilesSnapshot = new PackageFiles() + }; _packageFiles = new PackageFiles(); FileSystem.Setup(x => x.DirectoryExists(It.IsAny())).Returns(true); } @@ -127,10 +129,12 @@ public void Should_backup_a_changed_file() FilePath }; FileSystem.Setup(x => x.GetFiles(It.IsAny(), It.IsAny(), SearchOption.AllDirectories)).Returns(fileSystemFiles); - var updatedPackageFiles = new PackageFiles(); - updatedPackageFiles.Files = new List + var updatedPackageFiles = new PackageFiles + { + Files = new List { packageFileWithUpdatedChecksum + } }; FilesService.Setup(x => x.CaptureSnapshot(It.IsAny(), _config)).Returns(updatedPackageFiles); @@ -151,8 +155,10 @@ public override void Context() { base.Context(); Package.Setup(x => x.Id).Returns("bob"); - _packageInfo = new ChocolateyPackageInformation(Package.Object); - _packageInfo.FilesSnapshot = new PackageFiles(); + _packageInfo = new ChocolateyPackageInformation(Package.Object) + { + FilesSnapshot = new PackageFiles() + }; _packageFiles = new List(); FileSystem.Setup(x => x.DirectoryExists(It.IsAny())).Returns(true); } diff --git a/src/chocolatey/infrastructure.app/nuget/NugetList.cs b/src/chocolatey/infrastructure.app/nuget/NugetList.cs index ec7ef7aa8f..522e5e5e6e 100644 --- a/src/chocolatey/infrastructure.app/nuget/NugetList.cs +++ b/src/chocolatey/infrastructure.app/nuget/NugetList.cs @@ -52,9 +52,11 @@ public static int GetCount(ChocolateyConfiguration configuration, ILogger nugetL var packageRepositoriesResources = NugetCommon.GetRepositoryResources(configuration, nugetLogger, filesystem, cacheContext); var searchTermLower = configuration.Input.ToLowerSafe(); - var searchFilter = new SearchFilter(configuration.Prerelease); - searchFilter.IncludeDelisted = configuration.ListCommand.LocalOnly; - searchFilter.OrderBy = SearchOrderBy.DownloadCount; + var searchFilter = new SearchFilter(configuration.Prerelease) + { + IncludeDelisted = configuration.ListCommand.LocalOnly, + OrderBy = SearchOrderBy.DownloadCount + }; var totalCount = 0; foreach (var searchResource in packageRepositoriesResources.SearchResources()) @@ -74,9 +76,11 @@ private async static Task> SearchPackagesAsyn var packageRepositoryResources = NugetCommon.GetRepositoryResources(configuration, nugetLogger, filesystem, cacheContext); var searchTermLower = configuration.Input.ToLowerSafe(); - var searchFilter = new SearchFilter(configuration.Prerelease); - searchFilter.IncludeDelisted = configuration.ListCommand.LocalOnly; - searchFilter.OrderBy = SearchOrderBy.Id; + var searchFilter = new SearchFilter(configuration.Prerelease) + { + IncludeDelisted = configuration.ListCommand.LocalOnly, + OrderBy = SearchOrderBy.Id + }; if (configuration.ListCommand.OrderByPopularity) { diff --git a/src/chocolatey/infrastructure/platforms/Platform.cs b/src/chocolatey/infrastructure/platforms/Platform.cs index 7b8411a0d1..07febf749b 100644 --- a/src/chocolatey/infrastructure/platforms/Platform.cs +++ b/src/chocolatey/infrastructure/platforms/Platform.cs @@ -109,9 +109,10 @@ private static string GetWindowsVersionName(Version version) var name = "Windows"; var isServer = false; - var osVersionInfo = new OSVERSIONINFOEX(); - - osVersionInfo.dwOSVersionInfoSize = Marshal.SizeOf(typeof (OSVERSIONINFOEX)); + var osVersionInfo = new OSVERSIONINFOEX + { + dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFOEX)) + }; var success = GetVersionEx(ref osVersionInfo); if (success) { From ce11404b3ed2a8d0687d7468ff96e4fc81b2094e Mon Sep 17 00:00:00 2001 From: Rain Sallow Date: Thu, 4 Apr 2024 16:42:37 -0400 Subject: [PATCH 14/18] (maint) Fix IDE0060 errors unused method parameters --- src/chocolatey.console/Program.cs | 4 ++-- .../commands/ChocolateyListCommandSpecs.cs | 2 ++ src/chocolatey/ILogExtensions.cs | 6 +++++- src/chocolatey/LogExtensions.cs | 2 ++ .../builders/ConfigurationBuilder.cs | 6 ++++-- .../commands/ChocolateyCommandBase.cs | 12 ++++++------ .../configuration/EnvironmentSettings.cs | 2 ++ .../nuget/ChocolateyNuGetSettings.cs | 2 ++ .../nuget/ChocolateyNugetCredentialProvider.cs | 3 ++- .../infrastructure.app/nuget/NugetCommon.cs | 2 ++ .../services/ChocolateyPackageService.cs | 10 +++++----- .../infrastructure/registration/SecurityProtocol.cs | 4 ++-- 12 files changed, 36 insertions(+), 19 deletions(-) diff --git a/src/chocolatey.console/Program.cs b/src/chocolatey.console/Program.cs index cee7124520..c85b0b21bf 100644 --- a/src/chocolatey.console/Program.cs +++ b/src/chocolatey.console/Program.cs @@ -110,7 +110,7 @@ private static void Main(string[] args) ReportVersionAndExitIfRequested(args, config); - TrapExitScenarios(config); + TrapExitScenarios(); if (config.RegularOutput) { @@ -249,7 +249,7 @@ private static void ReportVersionAndExitIfRequested(string[] args, ChocolateyCon } } - private static void TrapExitScenarios(ChocolateyConfiguration config) + private static void TrapExitScenarios() { ExitScenarioHandler.SetHandler(); } diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyListCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyListCommandSpecs.cs index 068cffd7a5..376964edc1 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyListCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyListCommandSpecs.cs @@ -139,7 +139,9 @@ public override void Because() [NUnit.Framework.TestCase("--localonly")] [NUnit.Framework.TestCase("-li")] [NUnit.Framework.TestCase("-lai")] + #pragma warning disable IDE0060 // Unused argument public void Should_throw_on_unsupported_argument(string argument) + #pragma warning restore IDE0060 // Unused argument { Configuration.RegularOutput = true; var errored = false; diff --git a/src/chocolatey/ILogExtensions.cs b/src/chocolatey/ILogExtensions.cs index b10f2374bd..cf3fcfbbc4 100644 --- a/src/chocolatey/ILogExtensions.cs +++ b/src/chocolatey/ILogExtensions.cs @@ -31,16 +31,20 @@ public static class ILogExtensions public static bool LogTraceMessages = true; [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] + #pragma warning disable IDE0060 // Unused method parameter public static void Trace(this ILog logger, string message, params object[] formatting) + #pragma warning restore IDE0060 // Unused method parameter { - if (LogTraceMessages) + if (LogTraceMessages) { ChocolateyLoggers.Trace.ToStringSafe().Log().Debug(message, formatting); } } [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] + #pragma warning disable IDE0060 // Unused method parameter public static void Trace(this ILog logger, Func message) + #pragma warning restore IDE0060 // Unused method parameter { if (LogTraceMessages) { diff --git a/src/chocolatey/LogExtensions.cs b/src/chocolatey/LogExtensions.cs index 2749764528..0533424312 100644 --- a/src/chocolatey/LogExtensions.cs +++ b/src/chocolatey/LogExtensions.cs @@ -55,7 +55,9 @@ public static void ResetLoggers() /// /// The type to get the logger for. /// Instance of a logger for the object. + #pragma warning disable IDE0060 // Unused method parameter public static ILog Log(this T type) + #pragma warning restore IDE0060 // Unused method parameter { var objectName = typeof (T).FullName; return Log(objectName); diff --git a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs index b29a148423..5c629fb2c2 100644 --- a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs +++ b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs @@ -77,14 +77,16 @@ public static bool AreCompatibilityChecksDisabled(IFileSystem filesystem, IXmlSe /// The container. /// The license. /// Notify warn logging action + #pragma warning disable IDE0060 // Unused method parameter public static void SetupConfiguration(IList args, ChocolateyConfiguration config, Container container, ChocolateyLicense license, Action notifyWarnLoggingAction) + #pragma warning restore IDE0060 // Unused method parameter { var fileSystem = container.GetInstance(); var xmlService = container.GetInstance(); var configFileSettings = GetConfigFileSettings(fileSystem, xmlService); // must be done prior to setting the file configuration AddOrRemoveLicensedSource(license, configFileSettings); - SetFileConfiguration(config, configFileSettings, fileSystem, notifyWarnLoggingAction); + SetFileConfiguration(config, configFileSettings, fileSystem); ConfigurationOptions.ClearOptions(); SetGlobalOptions(args, config, container); SetEnvironmentOptions(config); @@ -153,7 +155,7 @@ private static void AddOrRemoveLicensedSource(ChocolateyLicense license, ConfigF configFileSettings.Sources.RemoveWhere(s => s.Id.IsEqualTo(configSource.Id) && !NugetEncryptionUtility.DecryptString(s.Password).IsEqualTo(license.Id)); } - private static void SetFileConfiguration(ChocolateyConfiguration config, ConfigFileSettings configFileSettings, IFileSystem fileSystem, Action notifyWarnLoggingAction) + private static void SetFileConfiguration(ChocolateyConfiguration config, ConfigFileSettings configFileSettings, IFileSystem fileSystem) { SetSourcesInPriorityOrder(config, configFileSettings); SetMachineSources(config, configFileSettings); diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyCommandBase.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyCommandBase.cs index e772359d0b..7d5c107e0b 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyCommandBase.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyCommandBase.cs @@ -101,7 +101,7 @@ write proper scripts and integrations. var normalExitCodes = GetNormalExitCodes(configuration).ToArray(); var enhancedExitCodes = GetEnhancedExitCodes(configuration).ToArray(); - var additionalExitCodeDescription = GetAdditionalExitCodeDescription(configuration); + var additionalExitCodeDescription = GetAdditionalExitCodeDescription(); if (normalExitCodes.Length > 0 || enhancedExitCodes.Length > 0 || !string.IsNullOrEmpty(additionalExitCodeDescription)) { @@ -139,7 +139,7 @@ file a ticket so we can document it at this.Log().Info(string.Empty); } - var additionalHelpContent = GetAdditionalHelpContent(configuration); + var additionalHelpContent = GetAdditionalHelpContent(); if (!string.IsNullOrEmpty(additionalHelpContent)) { @@ -149,7 +149,7 @@ file a ticket so we can document it at this.Log().Info(ChocolateyLoggers.Important, "Options and Switches"); - var optionsAndSwitchesContent = GetOptionsAndSwitchesDescription(configuration); + var optionsAndSwitchesContent = GetOptionsAndSwitchesDescription(); if (!string.IsNullOrEmpty(optionsAndSwitchesContent)) { @@ -239,17 +239,17 @@ protected virtual void WarnForRemovedOptions(IEnumerable unparsedOptions } } - private string GetAdditionalExitCodeDescription(ChocolateyConfiguration configuration) + private string GetAdditionalExitCodeDescription() { return string.Empty; } - private string GetAdditionalHelpContent(ChocolateyConfiguration configuration) + private string GetAdditionalHelpContent() { return string.Empty; } - private string GetOptionsAndSwitchesDescription(ChocolateyConfiguration configuration) + private string GetOptionsAndSwitchesDescription() { return string.Empty; } diff --git a/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs b/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs index 6bbc714172..fbff9b712f 100644 --- a/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs +++ b/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs @@ -45,7 +45,9 @@ private static IEnvironment Environment get { return _environmentInitializer.Value; } } + #pragma warning disable IDE0060 // Unused method parameter public static void ResetEnvironmentVariables(ChocolateyConfiguration config) + #pragma warning restore IDE0060 // Unused method parameter { Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyPackageInstallLocation, null); Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyPackageInstallerType, null); diff --git a/src/chocolatey/infrastructure.app/nuget/ChocolateyNuGetSettings.cs b/src/chocolatey/infrastructure.app/nuget/ChocolateyNuGetSettings.cs index 9152bbb910..0097be7a0d 100644 --- a/src/chocolatey/infrastructure.app/nuget/ChocolateyNuGetSettings.cs +++ b/src/chocolatey/infrastructure.app/nuget/ChocolateyNuGetSettings.cs @@ -15,7 +15,9 @@ public class ChocolateyNuGetSettings : ISettings private const string ConfigSectionName = "config"; //private SettingSection _configSettingSection; + #pragma warning disable IDE0060 // unused method parameter public ChocolateyNuGetSettings(ChocolateyConfiguration config) + #pragma warning restore IDE0060 // unused method parameter { //new SettingSection //_clientCertItem = diff --git a/src/chocolatey/infrastructure.app/nuget/ChocolateyNugetCredentialProvider.cs b/src/chocolatey/infrastructure.app/nuget/ChocolateyNugetCredentialProvider.cs index c97c5372da..402553d260 100644 --- a/src/chocolatey/infrastructure.app/nuget/ChocolateyNugetCredentialProvider.cs +++ b/src/chocolatey/infrastructure.app/nuget/ChocolateyNugetCredentialProvider.cs @@ -159,8 +159,9 @@ public Task GetAsync(Uri uri, IWebProxy proxy, CredentialReq return Task.FromResult(new CredentialResponse(new NetworkCredential(source.Username, NugetEncryptionUtility.DecryptString(source.EncryptedPassword)))); } - + #pragma warning disable IDE0060 // unused method parameter public ICredentials GetUserCredentials(Uri uri, IWebProxy proxy, CredentialRequestType credentialType) + #pragma warning restore IDE0060 // unused method parameter { if (!_config.Information.IsInteractive) { diff --git a/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs b/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs index 837ed85257..fe0d3acab0 100644 --- a/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs +++ b/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs @@ -96,7 +96,9 @@ public static SourceRepository GetLocalRepository() return Repository.Factory.GetCoreV3(nugetSource); } + #pragma warning disable IDE0060 // unused method parameter (nugetLogger) public static IEnumerable GetRemoteRepositories(ChocolateyConfiguration configuration, ILogger nugetLogger, IFileSystem filesystem) + #pragma warning restore IDE0060 // unused method parameter (nugetLogger) { // Set user agent for all NuGet library calls. Should not affect any HTTP calls that Chocolatey itself would make. UserAgent.SetUserAgentString(new UserAgentStringBuilder("{0}/{1} via NuGet Client".FormatWith(ApplicationParameters.UserAgent, configuration.Information.ChocolateyProductVersion))); diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs index dc9516e19f..642c16301a 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs @@ -538,7 +538,7 @@ public virtual void HandlePackageResult(PackageResult packageResult, ChocolateyC HandleExtensionPackages(config, packageResult); HandleTemplatePackages(config, packageResult); HandleHookPackages(config, packageResult); - pkgInfo.Arguments = CaptureArguments(config, packageResult); + pkgInfo.Arguments = CaptureArguments(config); pkgInfo.IsPinned = config.PinPackage; } @@ -567,7 +567,7 @@ public virtual void HandlePackageResult(PackageResult packageResult, ChocolateyC } UpdatePackageInformation(pkgInfo); - EnsureBadPackagesPathIsClean(config, packageResult); + EnsureBadPackagesPathIsClean(packageResult); EventManager.Publish(new HandlePackageResultCompletedMessage(packageResult, config, commandName)); UnmarkPackagePending(packageResult, config); @@ -650,7 +650,7 @@ protected virtual void UpdatePackageInformation(ChocolateyPackageInformation pkg _packageInfoService.Save(pkgInfo); } - private string CaptureArguments(ChocolateyConfiguration config, PackageResult packageResult) + private string CaptureArguments(ChocolateyConfiguration config) { var arguments = new StringBuilder(); @@ -1563,7 +1563,7 @@ private void UninstallCleanup(ChocolateyConfiguration config, PackageResult pack _packageInfoService.Remove(packageResult.PackageMetadata); } - EnsureBadPackagesPathIsClean(config, packageResult); + EnsureBadPackagesPathIsClean(packageResult); RemoveBackupIfExists(packageResult); HandleExtensionPackages(config, packageResult); HandleTemplatePackages(config, packageResult); @@ -1746,7 +1746,7 @@ private void HandleTemplatePackages(ChocolateyConfiguration config, PackageResul } } - private void EnsureBadPackagesPathIsClean(ChocolateyConfiguration config, PackageResult packageResult) + private void EnsureBadPackagesPathIsClean(PackageResult packageResult) { if (packageResult.InstallLocation == null) { diff --git a/src/chocolatey/infrastructure/registration/SecurityProtocol.cs b/src/chocolatey/infrastructure/registration/SecurityProtocol.cs index 829f924fcd..8e196e8e73 100644 --- a/src/chocolatey/infrastructure/registration/SecurityProtocol.cs +++ b/src/chocolatey/infrastructure/registration/SecurityProtocol.cs @@ -24,9 +24,9 @@ namespace chocolatey.infrastructure.registration [Obsolete("This type is deprecated and will be removed in v3.")] public sealed class SecurityProtocol { -#pragma warning disable IDE0022, IDE1006 +#pragma warning disable IDE0022, IDE0060, IDE1006 public static void set_protocol(ChocolateyConfiguration config, bool provideWarning) => HttpsSecurity.Reset(); -#pragma warning restore IDE0022, IDE1006 +#pragma warning restore IDE0022, IDE0060, IDE1006 } } From 5edbd851f72c94f5f34cbed366753cd87d9b7cf3 Mon Sep 17 00:00:00 2001 From: Rain Sallow Date: Fri, 5 Apr 2024 10:01:26 -0400 Subject: [PATCH 15/18] (maint) Fix IDE0003 errors Avoid using `this` --- .../configuration/ChocolateyConfiguration.cs | 2 +- src/chocolatey/infrastructure.app/events/PostRunMessage.cs | 4 ++-- src/chocolatey/infrastructure.app/events/PreRunMessage.cs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs b/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs index c77b7faa3c..426fa92288 100644 --- a/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs +++ b/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs @@ -108,7 +108,7 @@ public void RevertChanges(bool removeBackup = false) // Runtime type lookup ensures this also fully works with derived classes (for example: licensed configuration) // without needing to re-implement this method / make it overridable. - var t = this.GetType(); + var t = GetType(); var backup = removeBackup ? _configurationBackups.Pop() : _configurationBackups.Peek(); diff --git a/src/chocolatey/infrastructure.app/events/PostRunMessage.cs b/src/chocolatey/infrastructure.app/events/PostRunMessage.cs index 435a5ecc25..46c6b30415 100644 --- a/src/chocolatey/infrastructure.app/events/PostRunMessage.cs +++ b/src/chocolatey/infrastructure.app/events/PostRunMessage.cs @@ -26,7 +26,7 @@ public class PostRunMessage : IMessage public PostRunMessage(ChocolateyConfiguration configuration) { - this.Configuration = configuration; + Configuration = configuration; } } @@ -39,7 +39,7 @@ public class PostRunMessage : IMessage where TCommand : ICommand public PostRunMessage(TCommand command, ChocolateyConfiguration configuration, object[] state) { Command = command; - this.Configuration = configuration; + Configuration = configuration; State = state; } } diff --git a/src/chocolatey/infrastructure.app/events/PreRunMessage.cs b/src/chocolatey/infrastructure.app/events/PreRunMessage.cs index 3e10f83e45..ffa96a87e8 100644 --- a/src/chocolatey/infrastructure.app/events/PreRunMessage.cs +++ b/src/chocolatey/infrastructure.app/events/PreRunMessage.cs @@ -26,7 +26,7 @@ public class PreRunMessage : IMessage public PreRunMessage(ChocolateyConfiguration configuration) { - this.Configuration = configuration; + Configuration = configuration; } } @@ -39,7 +39,7 @@ public class PreRunMessage : IMessage where TCommand : ICommand public PreRunMessage(TCommand command, ChocolateyConfiguration configuration, object[] state) { Command = command; - this.Configuration = configuration; + Configuration = configuration; State = state; } } From 54e44fff95566bb7ec3b4937f48b70f0beb74278 Mon Sep 17 00:00:00 2001 From: Rain Sallow Date: Fri, 5 Apr 2024 16:10:28 -0400 Subject: [PATCH 16/18] (maint) Fix IDE0027 warnings Use block body for accessors --- .../infrastructure.app/nuget/ChocolateySourceCacheContext.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/chocolatey/infrastructure.app/nuget/ChocolateySourceCacheContext.cs b/src/chocolatey/infrastructure.app/nuget/ChocolateySourceCacheContext.cs index 87e28b2462..59639d05a9 100644 --- a/src/chocolatey/infrastructure.app/nuget/ChocolateySourceCacheContext.cs +++ b/src/chocolatey/infrastructure.app/nuget/ChocolateySourceCacheContext.cs @@ -47,7 +47,10 @@ public override string GeneratedTempFolder return _generatedChocolateyTempFolder; } - set => Interlocked.CompareExchange(ref _generatedChocolateyTempFolder, value, comparand: null); + set + { + Interlocked.CompareExchange(ref _generatedChocolateyTempFolder, value, comparand: null); + } } /// From 8b0e4b944f7e11154d0796009b32dc0c8c6995c9 Mon Sep 17 00:00:00 2001 From: Rain Sallow Date: Mon, 8 Apr 2024 14:53:40 -0400 Subject: [PATCH 17/18] (maint) Fix IDE0025 warnings Use block body for properties --- .../scenarios/InstallScenarios.cs | 126 +++++++-- .../scenarios/PackScenarios.cs | 255 +++++++++++++++--- .../scenarios/UpgradeScenarios.cs | 102 ++++++- .../domain/ChocolateyPackageMetadata.cs | 36 ++- .../nuget/ChocolateyNuGetProjectContext.cs | 18 +- 5 files changed, 474 insertions(+), 63 deletions(-) diff --git a/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs b/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs index a7639013a2..b107c8852c 100644 --- a/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs @@ -149,7 +149,13 @@ public class When_installing_a_package_happy_path : ScenariosBase { private PackageResult _packageResult; - protected virtual string TestSemVersion => "1.0.0"; + protected virtual string TestSemVersion + { + get + { + return "1.0.0"; + } + } public override void Context() { @@ -351,13 +357,25 @@ protected string TestVersion() [Categories.SemVer20] public class When_installing_a_package_with_semver_2_0_meta_data : When_installing_a_package_happy_path { - protected override string TestSemVersion => "0.9.9+build.543"; + protected override string TestSemVersion + { + get + { + return "0.9.9+build.543"; + } + } } [Categories.SemVer20] public class When_installing_a_package_with_semver_2_0_pre_release_tag : When_installing_a_package_happy_path { - protected override string TestSemVersion => "1.0.0-alpha.34"; + protected override string TestSemVersion + { + get + { + return "1.0.0-alpha.34"; + } + } } public class When_installing_packages_with_packages_config : ScenariosBase @@ -4169,8 +4187,21 @@ public class When_installing_a_package_with_non_normalized_version : ScenariosBa { private PackageResult _packageResult; - protected virtual string NonNormalizedVersion => "2.02.0.0"; - protected virtual string NormalizedVersion => "2.2.0"; + protected virtual string NonNormalizedVersion + { + get + { + return "2.02.0.0"; + } + } + + protected virtual string NormalizedVersion + { + get + { + return "2.2.0"; + } + } public override void Context() { @@ -4354,8 +4385,21 @@ public void Should_have_a_graphical_shim_that_is_set_for_gui_access() public class When_installing_a_package_specifying_normalized_version : When_installing_a_package_with_non_normalized_version { - protected override string NormalizedVersion => "2.2.0"; - protected override string NonNormalizedVersion => "2.02.0.0"; + protected override string NormalizedVersion + { + get + { + return "2.2.0"; + } + } + + protected override string NonNormalizedVersion + { + get + { + return "2.02.0.0"; + } + } public override void Context() { @@ -4366,8 +4410,21 @@ public override void Context() public class When_installing_a_package_specifying_non_normalized_version : When_installing_a_package_with_non_normalized_version { - protected override string NormalizedVersion => "2.2.0"; - protected override string NonNormalizedVersion => "2.02.0.0"; + protected override string NormalizedVersion + { + get + { + return "2.2.0"; + } + } + + protected override string NonNormalizedVersion + { + get + { + return "2.02.0.0"; + } + } public override void Context() { @@ -4378,14 +4435,40 @@ public override void Context() public class When_installing_a_package_with_multiple_leading_zeros : When_installing_a_package_with_non_normalized_version { - protected override string NormalizedVersion => "4.4.5.1"; - protected override string NonNormalizedVersion => "0004.0004.00005.01"; + protected override string NormalizedVersion + { + get + { + return "4.4.5.1"; + } + } + + protected override string NonNormalizedVersion + { + get + { + return "0004.0004.00005.01"; + } + } } public class When_installing_a_package_with_multiple_leading_zeros_specifying_normalized_version : When_installing_a_package_with_non_normalized_version { - protected override string NormalizedVersion => "4.4.5.1" ; - protected override string NonNormalizedVersion => "0004.0004.00005.01"; + protected override string NormalizedVersion + { + get + { + return "4.4.5.1"; + } + } + + protected override string NonNormalizedVersion + { + get + { + return "0004.0004.00005.01"; + } + } public override void Context() { @@ -4396,8 +4479,21 @@ public override void Context() public class When_installing_a_package_with_multiple_leading_zeros_specifying_non_normalized_version : When_installing_a_package_with_non_normalized_version { - protected override string NormalizedVersion => "4.4.5.1"; - protected override string NonNormalizedVersion => "0004.0004.00005.01"; + protected override string NormalizedVersion + { + get + { + return "4.4.5.1"; + } + } + + protected override string NonNormalizedVersion + { + get + { + return "0004.0004.00005.01"; + } + } public override void Context() { diff --git a/src/chocolatey.tests.integration/scenarios/PackScenarios.cs b/src/chocolatey.tests.integration/scenarios/PackScenarios.cs index 81cbf903cd..4103d6a033 100644 --- a/src/chocolatey.tests.integration/scenarios/PackScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/PackScenarios.cs @@ -122,7 +122,13 @@ protected virtual string PackagePath protected abstract string ExpectedNuspecVersion { get; } - protected virtual string ExpectedPathVersion => ExpectedNuspecVersion; + protected virtual string ExpectedPathVersion + { + get + { + return ExpectedNuspecVersion; + } + } protected virtual string ExpectedSubDirectory { get; } = string.Empty; @@ -198,7 +204,13 @@ protected virtual string GetNuspecContent() public class When_packing_without_specifying_an_output_directory : ScenariosBase { - protected override string ExpectedNuspecVersion => "0.1.0"; + protected override string ExpectedNuspecVersion + { + get + { + return "0.1.0"; + } + } public override void Because() { @@ -209,8 +221,21 @@ public override void Because() public class When_packing_with_an_output_directory : ScenariosBase { - protected override string ExpectedNuspecVersion => "0.1.0"; - protected override string ExpectedSubDirectory => "PackageOutput"; + protected override string ExpectedNuspecVersion + { + get + { + return "0.1.0"; + } + } + + protected override string ExpectedSubDirectory + { + get + { + return "PackageOutput"; + } + } public override void Because() { @@ -222,9 +247,29 @@ public override void Because() [Categories.LegacySemVer] public class When_packing_with_only_major_minor_version : ScenariosBase { - protected override string PackagePath => Path.Combine("PackageOutput", "test-package.0.3.0.nupkg"); - protected override string ExpectedNuspecVersion => "0.3.0"; - protected override string ExpectedSubDirectory => "PackageOutput"; + protected override string PackagePath + { + get + { + return Path.Combine("PackageOutput", "test-package.0.3.0.nupkg"); + } + } + + protected override string ExpectedNuspecVersion + { + get + { + return "0.3.0"; + } + } + + protected override string ExpectedSubDirectory + { + get + { + return "PackageOutput"; + } + } public override void Because() { @@ -241,8 +286,21 @@ protected override string GetNuspecContent() [Categories.LegacySemVer] public class When_packing_with_full_4_part_versioning_scheme : ScenariosBase { - protected override string ExpectedNuspecVersion => "0.5.0.5"; - protected override string ExpectedSubDirectory => "PackageOutput"; + protected override string ExpectedNuspecVersion + { + get + { + return "0.5.0.5"; + } + } + + protected override string ExpectedSubDirectory + { + get + { + return "PackageOutput"; + } + } public override void Because() { @@ -259,9 +317,29 @@ protected override string GetNuspecContent() [Categories.SemVer20] public class When_packaging_with_build_metadata : ScenariosBase { - protected override string ExpectedNuspecVersion => "0.1.0+build.543"; - protected override string ExpectedPathVersion => "0.1.0"; - protected override string ExpectedSubDirectory => "PackageOutput"; + protected override string ExpectedNuspecVersion + { + get + { + return "0.1.0+build.543"; + } + } + + protected override string ExpectedPathVersion + { + get + { + return "0.1.0"; + } + } + + protected override string ExpectedSubDirectory + { + get + { + return "PackageOutput"; + } + } public override void Because() { @@ -278,9 +356,29 @@ protected override string GetNuspecContent() [Categories.SemVer20] public class When_packaging_with_semver_20_pre_release_tag : ScenariosBase { - protected override string ExpectedNuspecVersion => "0.1.0-rc.5+build.999"; - protected override string ExpectedPathVersion => "0.1.0-rc.5"; - protected override string ExpectedSubDirectory => "PackageOutput"; + protected override string ExpectedNuspecVersion + { + get + { + return "0.1.0-rc.5+build.999"; + } + } + + protected override string ExpectedPathVersion + { + get + { + return "0.1.0-rc.5"; + } + } + + protected override string ExpectedSubDirectory + { + get + { + return "PackageOutput"; + } + } public override void Because() { @@ -297,8 +395,21 @@ protected override string GetNuspecContent() [Categories.LegacySemVer] public class When_packaging_with_legacy_pre_release_tag : ScenariosBase { - protected override string ExpectedNuspecVersion => "0.1.0-rc-5"; - protected override string ExpectedSubDirectory => "PackageOutput"; + protected override string ExpectedNuspecVersion + { + get + { + return "0.1.0-rc-5"; + } + } + + protected override string ExpectedSubDirectory + { + get + { + return "PackageOutput"; + } + } public override void Because() { @@ -316,8 +427,21 @@ protected override string GetNuspecContent() public class When_packaging_with_four_part_version_with_trailing_zero : ScenariosBase { private string _originalVersion = "0.1.0.0"; - protected override string ExpectedNuspecVersion => "0.1.0"; - protected override string ExpectedSubDirectory => "PackageOutput"; + protected override string ExpectedNuspecVersion + { + get + { + return "0.1.0"; + } + } + + protected override string ExpectedSubDirectory + { + get + { + return "PackageOutput"; + } + } public override void Because() { @@ -335,8 +459,21 @@ protected override string GetNuspecContent() public class When_packaging_with_leading_zeros_four_part : ScenariosBase { private string _originalVersion = "01.02.03.04"; - protected override string ExpectedNuspecVersion => "1.2.3.4"; - protected override string ExpectedSubDirectory => "PackageOutput"; + protected override string ExpectedNuspecVersion + { + get + { + return "1.2.3.4"; + } + } + + protected override string ExpectedSubDirectory + { + get + { + return "PackageOutput"; + } + } public override void Because() { @@ -354,8 +491,21 @@ protected override string GetNuspecContent() public class When_packaging_with_leading_zeros_three_part : ScenariosBase { private string _originalVersion = "01.02.04"; - protected override string ExpectedNuspecVersion => "1.2.4"; - protected override string ExpectedSubDirectory => "PackageOutput"; + protected override string ExpectedNuspecVersion + { + get + { + return "1.2.4"; + } + } + + protected override string ExpectedSubDirectory + { + get + { + return "PackageOutput"; + } + } public override void Because() { @@ -373,8 +523,21 @@ protected override string GetNuspecContent() public class When_packaging_with_leading_zeros_two_part : ScenariosBase { private string _originalVersion = "01.02"; - protected override string ExpectedNuspecVersion => "1.2.0"; - protected override string ExpectedSubDirectory => "PackageOutput"; + protected override string ExpectedNuspecVersion + { + get + { + return "1.2.0"; + } + } + + protected override string ExpectedSubDirectory + { + get + { + return "PackageOutput"; + } + } public override void Because() { @@ -392,8 +555,21 @@ protected override string GetNuspecContent() public class When_packaging_with_multiple_leading_zeros : ScenariosBase { private string _originalVersion = "0001.0002.0003"; - protected override string ExpectedNuspecVersion => "1.2.3"; - protected override string ExpectedSubDirectory => "PackageOutput"; + protected override string ExpectedNuspecVersion + { + get + { + return "1.2.3"; + } + } + + protected override string ExpectedSubDirectory + { + get + { + return "PackageOutput"; + } + } public override void Because() { @@ -409,7 +585,13 @@ protected override string GetNuspecContent() public class When_packing_with_properties : ScenariosBase { - protected override string ExpectedNuspecVersion => "0.1.0"; + protected override string ExpectedNuspecVersion + { + get + { + return "0.1.0"; + } + } public override void Context() { @@ -510,8 +692,21 @@ public void Should_throw_exception_on_icon_element() public class When_packing_with_min_client_version : ScenariosBase { - protected override string ExpectedNuspecVersion => "0.1.0"; - protected override string ExpectedSubDirectory => "PackageOutput"; + protected override string ExpectedNuspecVersion + { + get + { + return "0.1.0"; + } + } + + protected override string ExpectedSubDirectory + { + get + { + return "PackageOutput"; + } + } // This high version is to ensure that pack does not throw, even if the min client version is well // above both the Chocolatey and NuGet assembly versions. diff --git a/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs b/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs index cb0aa4ce3f..5713174101 100644 --- a/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs @@ -4492,8 +4492,21 @@ public class When_upgrading_an_existing_package_non_normalized_version : Scenari { private PackageResult _packageResult; - protected virtual string NonNormalizedVersion => "2.02.0.0"; - protected virtual string NormalizedVersion => "2.2.0"; + protected virtual string NonNormalizedVersion + { + get + { + return "2.02.0.0"; + } + } + + protected virtual string NormalizedVersion + { + get + { + return "2.2.0"; + } + } public override void Context() { @@ -4633,8 +4646,21 @@ public void Should_have_executed_chocolateyInstall_script_for_new_package() public class When_upgrading_an_existing_package_specifying_normalized_version : When_upgrading_an_existing_package_non_normalized_version { - protected override string NormalizedVersion => "2.2.0"; - protected override string NonNormalizedVersion => "2.02.0.0"; + protected override string NormalizedVersion + { + get + { + return "2.2.0"; + } + } + + protected override string NonNormalizedVersion + { + get + { + return "2.02.0.0"; + } + } public override void Context() { @@ -4645,8 +4671,21 @@ public override void Context() public class When_upgrading_an_existing_package_specifying_non_normalized_version : When_upgrading_an_existing_package_non_normalized_version { - protected override string NormalizedVersion => "2.2.0"; - protected override string NonNormalizedVersion => "2.02.0.0"; + protected override string NormalizedVersion + { + get + { + return "2.2.0"; + } + } + + protected override string NonNormalizedVersion + { + get + { + return "2.02.0.0"; + } + } public override void Context() { @@ -4657,14 +4696,40 @@ public override void Context() public class When_upgrading_an_existing_package_with_multiple_leading_zeros : When_upgrading_an_existing_package_non_normalized_version { - protected override string NormalizedVersion => "4.4.5.1"; - protected override string NonNormalizedVersion => "0004.0004.00005.01"; + protected override string NormalizedVersion + { + get + { + return "4.4.5.1"; + } + } + + protected override string NonNormalizedVersion + { + get + { + return "0004.0004.00005.01"; + } + } } public class When_upgrading_an_existing_package_with_multiple_leading_zeros_specifying_normalized_version : When_upgrading_an_existing_package_non_normalized_version { - protected override string NormalizedVersion => "4.4.5.1"; - protected override string NonNormalizedVersion => "0004.0004.00005.01"; + protected override string NormalizedVersion + { + get + { + return "4.4.5.1"; + } + } + + protected override string NonNormalizedVersion + { + get + { + return "0004.0004.00005.01"; + } + } public override void Context() { @@ -4675,8 +4740,21 @@ public override void Context() public class When_upgrading_an_existing_package_with_multiple_leading_zeros_specifying_non_normalized_version : When_upgrading_an_existing_package_non_normalized_version { - protected override string NormalizedVersion => "4.4.5.1"; - protected override string NonNormalizedVersion => "0004.0004.00005.01"; + protected override string NormalizedVersion + { + get + { + return "4.4.5.1"; + } + } + + protected override string NonNormalizedVersion + { + get + { + return "0004.0004.00005.01"; + } + } public override void Context() { diff --git a/src/chocolatey/infrastructure.app/domain/ChocolateyPackageMetadata.cs b/src/chocolatey/infrastructure.app/domain/ChocolateyPackageMetadata.cs index 448d2d871d..9d52ef9068 100644 --- a/src/chocolatey/infrastructure.app/domain/ChocolateyPackageMetadata.cs +++ b/src/chocolatey/infrastructure.app/domain/ChocolateyPackageMetadata.cs @@ -185,11 +185,39 @@ public ChocolateyPackageMetadata(string packagePath, IFileSystem filesystem) public string Copyright { get; } public string Icon { get; } public string Readme { get; } - public IEnumerable FrameworkReferences => null; - public IEnumerable PackageAssemblyReferences => null; + public IEnumerable FrameworkReferences + { + get + { + return null; + } + } + + public IEnumerable PackageAssemblyReferences + { + get + { + return null; + } + } + public IEnumerable DependencyGroups { get; } - public Version MinClientVersion => null; - public IEnumerable ContentFiles => null; + public Version MinClientVersion + { + get + { + return null; + } + } + + public IEnumerable ContentFiles + { + get + { + return null; + } + } + public IEnumerable PackageTypes { get; } public RepositoryMetadata Repository { get; } public LicenseMetadata LicenseMetadata { get; } diff --git a/src/chocolatey/infrastructure.app/nuget/ChocolateyNuGetProjectContext.cs b/src/chocolatey/infrastructure.app/nuget/ChocolateyNuGetProjectContext.cs index 5ba695b0c5..330a9d16d8 100644 --- a/src/chocolatey/infrastructure.app/nuget/ChocolateyNuGetProjectContext.cs +++ b/src/chocolatey/infrastructure.app/nuget/ChocolateyNuGetProjectContext.cs @@ -74,8 +74,22 @@ public FileConflictAction ResolveFileConflict(string message) public PackageExtractionContext PackageExtractionContext { get; set; } - public ISourceControlManagerProvider SourceControlManagerProvider => null; - public ExecutionContext ExecutionContext => null; + public ISourceControlManagerProvider SourceControlManagerProvider + { + get + { + return null; + } + } + + public ExecutionContext ExecutionContext + { + get + { + return null; + } + } + public XDocument OriginalPackagesConfig { get; set; } public NuGetActionType ActionType { get; set; } public Guid OperationId { get; set; } From 8d2425c4a13e268b6129e2231b32f258a95b3ed6 Mon Sep 17 00:00:00 2001 From: Rain Sallow Date: Tue, 9 Apr 2024 14:32:18 -0400 Subject: [PATCH 18/18] (maint) dotnet format Just to tidy up the whitespace and everything, make everything neat and tidy and consistent. --- .../builders/ConfigurationBuilderSpecs.cs | 2 +- .../scenarios/InfoScenarios.cs | 6 +- .../scenarios/PackScenarios.cs | 2 +- .../scenarios/UpgradeScenarios.cs | 14 +- .../commands/ChocolateyCacheCommandSpecs.cs | 2 +- .../commands/ChocolateyListCommandSpecs.cs | 4 +- .../ChocolateyTemplateCommandSpecs.cs | 8 +- .../ChocolateyConfigSettingsServiceSpecs.cs | 4 +- .../services/NugetServiceSpecs.cs | 4 +- .../services/TemplateServiceSpecs.cs | 52 +-- .../utility/PackageUtilitySpecs.cs | 104 +++--- src/chocolatey/EnumExtensions.cs | 8 +- src/chocolatey/EnumerableExtensions.cs | 2 +- src/chocolatey/ExceptionExtensions.cs | 32 +- src/chocolatey/ILogExtensions.cs | 10 +- src/chocolatey/LogExtensions.cs | 6 +- src/chocolatey/StringExtensions.cs | 2 +- src/chocolatey/TypeExtensions.cs | 2 +- .../ApplicationParameters.cs | 4 +- .../builders/ConfigurationBuilder.cs | 6 +- .../commands/ChocolateyCacheCommand.cs | 4 +- .../commands/ChocolateyExportCommand.cs | 2 +- .../commands/ChocolateyListCommand.cs | 2 +- .../commands/ChocolateyNewCommand.cs | 2 +- .../commands/ChocolateyTemplateCommand.cs | 320 +++++++++--------- .../commands/ChocolateyUnpackSelfCommand.cs | 2 +- .../configuration/ConfigFileApiKeySetting.cs | 2 +- .../configuration/ConfigFileConfigSetting.cs | 2 +- .../configuration/ConfigFileFeatureSetting.cs | 2 +- .../configuration/ConfigFileSettings.cs | 2 +- .../configuration/ConfigFileSourceSetting.cs | 2 +- .../configuration/EnvironmentSettings.cs | 6 +- .../PackagesConfigFilePackageSetting.cs | 2 +- .../domain/ApiKeyCommandType.cs | 50 +-- .../domain/ChocolateyPackageMetadata.cs | 2 +- .../domain/TemplateCommandType.cs | 38 +-- .../nuget/ChocolateyNuGetSettings.cs | 16 +- .../ChocolateyNugetCredentialProvider.cs | 14 +- .../nuget/ChocolateyPackagePathResolver.cs | 16 +- .../infrastructure.app/nuget/NugetCommon.cs | 6 +- .../infrastructure.app/nuget/NugetList.cs | 2 +- .../runners/ConsoleApplication.cs | 6 +- .../services/AutomaticUninstallerService.cs | 10 +- .../ChocolateyPackageInformationService.cs | 2 +- .../services/ChocolateyPackageService.cs | 2 +- .../services/ConfigTransformService.cs | 6 +- .../services/NugetService.cs | 4 +- .../services/RegistryService.cs | 30 +- .../services/ShimGenerationService.cs | 36 +- .../services/TemplateService.cs | 2 +- .../GlobalConfigurationValidation.cs | 2 +- .../validations/SystemStateValidation.cs | 2 +- .../infrastructure/adapters/Assembly.cs | 6 +- .../infrastructure/adapters/Console.cs | 4 +- .../commandline/InteractivePrompt.cs | 4 +- .../commands/CommandExecutor.cs | 18 +- .../infrastructure/commands/Execute.cs | 2 +- .../commands/ExternalCommandArgsBuilder.cs | 4 +- .../cryptography/CryptoHashProvider.cs | 2 +- .../infrastructure/events/EventManager.cs | 2 +- .../extractors/AssemblyFileExtractor.cs | 2 +- .../filesystem/DotNetFileSystem.cs | 6 +- .../information/ProcessInformation.cs | 2 +- .../information/VersionInformation.cs | 2 +- .../licensing/LicenseValidation.cs | 2 +- src/chocolatey/infrastructure/logging/Log.cs | 4 +- .../logging/Log4NetAppenderConfiguration.cs | 30 +- .../infrastructure/logging/TraceLog.cs | 2 +- .../powershell/PoshHostRawUserInterface.cs | 3 +- .../registration/AssemblyResolution.cs | 3 +- .../infrastructure/registration/Bootstrap.cs | 4 +- .../registration/HttpsSecurity.cs | 114 +++---- .../infrastructure/results/PackageResult.cs | 2 +- .../EventSubscriptionManagerService.cs | 2 +- .../infrastructure/services/XmlService.cs | 3 +- .../tolerance/FaultTolerance.cs | 2 +- 76 files changed, 557 insertions(+), 538 deletions(-) diff --git a/src/chocolatey.tests.integration/infrastructure.app/builders/ConfigurationBuilderSpecs.cs b/src/chocolatey.tests.integration/infrastructure.app/builders/ConfigurationBuilderSpecs.cs index 7903801397..cf4c45665a 100644 --- a/src/chocolatey.tests.integration/infrastructure.app/builders/ConfigurationBuilderSpecs.cs +++ b/src/chocolatey.tests.integration/infrastructure.app/builders/ConfigurationBuilderSpecs.cs @@ -104,7 +104,7 @@ public override void Because() [TestFixture(false, false, false, true, TestName = "Argument Set")] public class WhenProxyConfigurationTests : ProxyConfigurationBase { - public WhenProxyConfigurationTests(bool system, bool environment, bool config, bool argument) : base(system, environment, config, argument) {} + public WhenProxyConfigurationTests(bool system, bool environment, bool config, bool argument) : base(system, environment, config, argument) { } public override void Context() { base.Context(); diff --git a/src/chocolatey.tests.integration/scenarios/InfoScenarios.cs b/src/chocolatey.tests.integration/scenarios/InfoScenarios.cs index 54e6aced98..249978a73b 100644 --- a/src/chocolatey.tests.integration/scenarios/InfoScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/InfoScenarios.cs @@ -398,7 +398,7 @@ public void Should_set_source_to_expected_value() { Results[0].Source.Should().Be( ((Platform.GetPlatform() == PlatformType.Windows ? "file:///" : "file://") + Path.Combine(Environment.CurrentDirectory, "PackageOutput")) - .Replace("\\","/")); + .Replace("\\", "/")); } [Fact] @@ -422,7 +422,7 @@ public override void Context() [Fact] public void Should_show_only_one_result() { - Results.Should().ContainSingle( "Expected 1 package to be returned!"); + Results.Should().ContainSingle("Expected 1 package to be returned!"); } [Fact] @@ -478,7 +478,7 @@ public override void Context() [Fact] public void Should_show_only_one_result() { - Results.Should().ContainSingle( "Expected 1 package to be returned!"); + Results.Should().ContainSingle("Expected 1 package to be returned!"); } [Fact] diff --git a/src/chocolatey.tests.integration/scenarios/PackScenarios.cs b/src/chocolatey.tests.integration/scenarios/PackScenarios.cs index 4103d6a033..63c12121de 100644 --- a/src/chocolatey.tests.integration/scenarios/PackScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/PackScenarios.cs @@ -1142,7 +1142,7 @@ protected override string GetNuspecContent() "; - private const string NuspecContentWithFormatableMinClientVersion = @" + private const string NuspecContentWithFormatableMinClientVersion = @" test-package diff --git a/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs b/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs index 5713174101..2231061fde 100644 --- a/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs @@ -3517,7 +3517,7 @@ public void Should_report_for_all_installed_packages() public void Should_upgrade_packages_with_upgrades() { var upgradePackageResult = Results.Where(x => x.Key == "upgradepackage").ToList(); - upgradePackageResult.Should().ContainSingle( "upgradepackage must be there once"); + upgradePackageResult.Should().ContainSingle("upgradepackage must be there once"); upgradePackageResult.First().Value.Version.Should().Be("1.1.0"); } @@ -3525,7 +3525,7 @@ public void Should_upgrade_packages_with_upgrades() public void Should_skip_packages_without_upgrades() { var installPackageResult = Results.Where(x => x.Key == "installpackage").ToList(); - installPackageResult.Should().ContainSingle( "installpackage must be there once"); + installPackageResult.Should().ContainSingle("installpackage must be there once"); installPackageResult.First().Value.Version.Should().Be("1.0.0"); } } @@ -3556,7 +3556,7 @@ public void Should_report_for_all_installed_packages() public void Should_upgrade_packages_with_upgrades() { var upgradePackageResult = Results.Where(x => x.Key == "upgradepackage").ToList(); - upgradePackageResult.Should().ContainSingle( "upgradepackage must be there once"); + upgradePackageResult.Should().ContainSingle("upgradepackage must be there once"); upgradePackageResult.First().Value.Version.Should().Be("1.1.1-beta2"); } @@ -3577,7 +3577,7 @@ public void Should_upgrade_upgradepackage() public void Should_skip_packages_without_upgrades() { var installPackageResult = Results.Where(x => x.Key == "installpackage").ToList(); - installPackageResult.Should().ContainSingle( "installpackage must be there once"); + installPackageResult.Should().ContainSingle("installpackage must be there once"); installPackageResult.First().Value.Version.Should().Be("1.0.0"); } } @@ -3610,7 +3610,7 @@ public void Should_report_for_all_installed_packages() public void Should_upgrade_packages_with_upgrades() { var upgradePackageResult = Results.Where(x => x.Key == "upgradepackage").ToList(); - upgradePackageResult.Should().ContainSingle( "upgradepackage must be there once"); + upgradePackageResult.Should().ContainSingle("upgradepackage must be there once"); // available version will show as last stable upgradePackageResult.First().Value.Version.Should().Be("1.1.0"); } @@ -3632,7 +3632,7 @@ public void Should_not_upgrade_upgradepackage() public void Should_skip_packages_without_upgrades() { var installPackageResult = Results.Where(x => x.Key == "installpackage").ToList(); - installPackageResult.Should().ContainSingle( "installpackage must be there once"); + installPackageResult.Should().ContainSingle("installpackage must be there once"); installPackageResult.First().Value.Version.Should().Be("1.0.0"); } } @@ -3659,7 +3659,7 @@ public override void Because() [Fact] public void Should_have_a_single_package_result() { - Results.Should().ContainSingle( "The returned package results do not have a single value!"); + Results.Should().ContainSingle("The returned package results do not have a single value!"); } [Fact] diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyCacheCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyCacheCommandSpecs.cs index 285b0b4e99..bc424a9dfd 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyCacheCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyCacheCommandSpecs.cs @@ -84,7 +84,7 @@ public class WhenParsingAdditionalParameters : ChocolateyCacheCommandSpecsBase { public override void Because() { - + } public override void BeforeEachSpec() diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyListCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyListCommandSpecs.cs index 376964edc1..2845ad60b5 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyListCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyListCommandSpecs.cs @@ -139,9 +139,9 @@ public override void Because() [NUnit.Framework.TestCase("--localonly")] [NUnit.Framework.TestCase("-li")] [NUnit.Framework.TestCase("-lai")] - #pragma warning disable IDE0060 // Unused argument +#pragma warning disable IDE0060 // Unused argument public void Should_throw_on_unsupported_argument(string argument) - #pragma warning restore IDE0060 // Unused argument +#pragma warning restore IDE0060 // Unused argument { Configuration.RegularOutput = true; var errored = false; diff --git a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyTemplateCommandSpecs.cs b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyTemplateCommandSpecs.cs index c906624aeb..bab44c3a3f 100644 --- a/src/chocolatey.tests/infrastructure.app/commands/ChocolateyTemplateCommandSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/commands/ChocolateyTemplateCommandSpecs.cs @@ -25,11 +25,11 @@ using chocolatey.infrastructure.commandline; using chocolatey.infrastructure.filesystem; using Moq; -using FluentAssertions; +using FluentAssertions; -namespace chocolatey.tests.infrastructure.app.commands -{ - public class ChocolateyTemplateCommandSpecs +namespace chocolatey.tests.infrastructure.app.commands +{ + public class ChocolateyTemplateCommandSpecs { [ConcernFor("template")] public abstract class ChocolateyTemplateCommandSpecsBase : TinySpec diff --git a/src/chocolatey.tests/infrastructure.app/services/ChocolateyConfigSettingsServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/ChocolateyConfigSettingsServiceSpecs.cs index ae4c670b3c..f1c3a973bd 100644 --- a/src/chocolatey.tests/infrastructure.app/services/ChocolateyConfigSettingsServiceSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/services/ChocolateyConfigSettingsServiceSpecs.cs @@ -167,8 +167,8 @@ public void Should_throw_exception_on_unsupported_feature() Service.DisableFeature(config); }; - action.Should().Throw() - .WithMessage("Feature '{0}' is not supported.".FormatWith(FeatureName)); + action.Should().Throw() + .WithMessage("Feature '{0}' is not supported.".FormatWith(FeatureName)); } } diff --git a/src/chocolatey.tests/infrastructure.app/services/NugetServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/NugetServiceSpecs.cs index e9221657d7..929957f63d 100644 --- a/src/chocolatey.tests/infrastructure.app/services/NugetServiceSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/services/NugetServiceSpecs.cs @@ -317,7 +317,7 @@ public void Generated_package_should_be_in_current_directory() var infos = MockLogger.MessagesFor(tests.LogLevel.Info); infos.Should().ContainSingle(); - infos.Should().HaveElementAt(0,"Chocolatey would have searched for a nuspec file in \"c:\\projects\\chocolatey\" and attempted to compile it."); + infos.Should().HaveElementAt(0, "Chocolatey would have searched for a nuspec file in \"c:\\projects\\chocolatey\" and attempted to compile it."); } [Fact] @@ -331,7 +331,7 @@ public void Generated_package_should_be_in_specified_directory() var infos = MockLogger.MessagesFor(tests.LogLevel.Info); infos.Should().ContainSingle(); - infos.Should().HaveElementAt(0,"Chocolatey would have searched for a nuspec file in \"c:\\packages\" and attempted to compile it."); + infos.Should().HaveElementAt(0, "Chocolatey would have searched for a nuspec file in \"c:\\packages\" and attempted to compile it."); } } } diff --git a/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs index dd12c47423..de766bf13e 100644 --- a/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs @@ -81,7 +81,7 @@ public void Should_log_current_directory_if_no_outputdirectory() var infos = MockLogger.MessagesFor(LogLevel.Info); infos.Should().ContainSingle(); - infos.Should().HaveElementAt(0,"Would have generated a new package specification at c:\\chocolatey\\Bob"); + infos.Should().HaveElementAt(0, "Would have generated a new package specification at c:\\chocolatey\\Bob"); } [Fact] @@ -93,7 +93,7 @@ public void Should_log_output_directory_if_outputdirectory_is_specified() var infos = MockLogger.MessagesFor(LogLevel.Info); infos.Should().ContainSingle(); - infos.Should().HaveElementAt(0,"Would have generated a new package specification at c:\\packages\\Bob"); + infos.Should().HaveElementAt(0, "Would have generated a new package specification at c:\\packages\\Bob"); } } @@ -133,7 +133,7 @@ public void Should_write_file_withe_replaced_tokens() var debugs = MockLogger.MessagesFor(LogLevel.Debug); debugs.Should().ContainSingle(); - debugs.Should().HaveElementAt(0,"Bob"); + debugs.Should().HaveElementAt(0, "Bob"); } [Fact] @@ -145,11 +145,11 @@ public void Should_log_info_if_regular_output() var debugs = MockLogger.MessagesFor(LogLevel.Debug); debugs.Should().ContainSingle(); - debugs.Should().HaveElementAt(0,"Bob"); + debugs.Should().HaveElementAt(0, "Bob"); var infos = MockLogger.MessagesFor(LogLevel.Info); infos.Should().ContainSingle(); - infos.Should().HaveElementAt(0,string.Format(@"Generating template to a file{0} at 'c:\packages\bob.nuspec'", Environment.NewLine)); + infos.Should().HaveElementAt(0, string.Format(@"Generating template to a file{0} at 'c:\packages\bob.nuspec'", Environment.NewLine)); } } @@ -295,8 +295,8 @@ public void Should_generate_all_files_and_directories() var directories = _directoryCreated.ToList(); directories.Should().HaveCount(2, "There should be 2 directories, but there was: " + string.Join(", ", directories)); - directories.Should().HaveElementAt(0,"c:\\chocolatey\\Bob"); - directories.Should().HaveElementAt(1,"c:\\chocolatey\\Bob\\tools"); + directories.Should().HaveElementAt(0, "c:\\chocolatey\\Bob"); + directories.Should().HaveElementAt(1, "c:\\chocolatey\\Bob\\tools"); _files.Should().HaveCount(2, "There should be 2 files, but there was: " + string.Join(", ", _files)); _files.Should().HaveElementAt(0, "c:\\chocolatey\\Bob\\__name_replace__.nuspec"); @@ -314,8 +314,8 @@ public void Should_generate_all_files_and_directories_even_with_outputdirectory( var directories = _directoryCreated.ToList(); directories.Should().HaveCount(2, "There should be 2 directories, but there was: " + string.Join(", ", directories)); - directories.Should().HaveElementAt(0,"c:\\packages\\Bob"); - directories.Should().HaveElementAt(1,"c:\\packages\\Bob\\tools"); + directories.Should().HaveElementAt(0, "c:\\packages\\Bob"); + directories.Should().HaveElementAt(1, "c:\\packages\\Bob\\tools"); _files.Should().HaveCount(2, "There should be 2 files, but there was: " + string.Join(", ", _files)); _files.Should().HaveElementAt(0, "c:\\packages\\Bob\\__name_replace__.nuspec"); @@ -393,9 +393,9 @@ public void Should_generate_all_files_and_directories() var directories = _directoryCreated.ToList(); directories.Should().HaveCount(3, "There should be 3 directories, but there was: " + string.Join(", ", directories)); - directories.Should().HaveElementAt(0,"c:\\chocolatey\\Bob"); - directories.Should().HaveElementAt(1,"c:\\chocolatey\\Bob\\tools"); - directories.Should().HaveElementAt(2,"c:\\chocolatey\\Bob\\tools\\lower"); + directories.Should().HaveElementAt(0, "c:\\chocolatey\\Bob"); + directories.Should().HaveElementAt(1, "c:\\chocolatey\\Bob\\tools"); + directories.Should().HaveElementAt(2, "c:\\chocolatey\\Bob\\tools\\lower"); _files.Should().HaveCount(4, "There should be 4 files, but there was: " + string.Join(", ", _files)); _files.Should().HaveElementAt(0, "c:\\chocolatey\\Bob\\__name_replace__.nuspec"); @@ -415,9 +415,9 @@ public void Should_generate_all_files_and_directories_even_with_outputdirectory( var directories = _directoryCreated.ToList(); directories.Should().HaveCount(3, "There should be 3 directories, but there was: " + string.Join(", ", directories)); - directories.Should().HaveElementAt(0,"c:\\packages\\Bob"); - directories.Should().HaveElementAt(1,"c:\\packages\\Bob\\tools"); - directories.Should().HaveElementAt(2,"c:\\packages\\Bob\\tools\\lower"); + directories.Should().HaveElementAt(0, "c:\\packages\\Bob"); + directories.Should().HaveElementAt(1, "c:\\packages\\Bob\\tools"); + directories.Should().HaveElementAt(2, "c:\\packages\\Bob\\tools\\lower"); _files.Should().HaveCount(4, "There should be 4 files, but there was: " + string.Join(", ", _files)); _files.Should().HaveElementAt(0, "c:\\packages\\Bob\\__name_replace__.nuspec"); @@ -497,11 +497,11 @@ public void Should_generate_all_files_and_directories() var directories = _directoryCreated.ToList(); directories.Should().HaveCount(5, "There should be 5 directories, but there was: " + string.Join(", ", directories)); - directories.Should().HaveElementAt(0,"c:\\chocolatey\\Bob"); - directories.Should().HaveElementAt(1,"c:\\chocolatey\\Bob\\tools"); - directories.Should().HaveElementAt(2,"c:\\chocolatey\\Bob\\tools\\lower"); - directories.Should().HaveElementAt(3,"c:\\chocolatey\\Bob\\empty"); - directories.Should().HaveElementAt(4,"c:\\chocolatey\\Bob\\empty\\nested"); + directories.Should().HaveElementAt(0, "c:\\chocolatey\\Bob"); + directories.Should().HaveElementAt(1, "c:\\chocolatey\\Bob\\tools"); + directories.Should().HaveElementAt(2, "c:\\chocolatey\\Bob\\tools\\lower"); + directories.Should().HaveElementAt(3, "c:\\chocolatey\\Bob\\empty"); + directories.Should().HaveElementAt(4, "c:\\chocolatey\\Bob\\empty\\nested"); _files.Should().HaveCount(4, "There should be 4 files, but there was: " + string.Join(", ", _files)); _files.Should().HaveElementAt(0, "c:\\chocolatey\\Bob\\__name_replace__.nuspec"); @@ -521,11 +521,11 @@ public void Should_generate_all_files_and_directories_even_with_outputdirectory( var directories = _directoryCreated.ToList(); directories.Should().HaveCount(5, "There should be 5 directories, but there was: " + string.Join(", ", directories)); - directories.Should().HaveElementAt(0,"c:\\packages\\Bob"); - directories.Should().HaveElementAt(1,"c:\\packages\\Bob\\tools"); - directories.Should().HaveElementAt(2,"c:\\packages\\Bob\\tools\\lower"); - directories.Should().HaveElementAt(3,"c:\\packages\\Bob\\empty"); - directories.Should().HaveElementAt(4,"c:\\packages\\Bob\\empty\\nested"); + directories.Should().HaveElementAt(0, "c:\\packages\\Bob"); + directories.Should().HaveElementAt(1, "c:\\packages\\Bob\\tools"); + directories.Should().HaveElementAt(2, "c:\\packages\\Bob\\tools\\lower"); + directories.Should().HaveElementAt(3, "c:\\packages\\Bob\\empty"); + directories.Should().HaveElementAt(4, "c:\\packages\\Bob\\empty\\nested"); _files.Should().HaveCount(4, "There should be 4 files, but there was: " + string.Join(", ", _files)); _files.Should().HaveElementAt(0, "c:\\packages\\Bob\\__name_replace__.nuspec"); @@ -850,7 +850,7 @@ public void Should_log_template_location_if_no_template_name() var infos = MockLogger.MessagesFor(LogLevel.Info); infos.Should().ContainSingle(); - infos.Should().HaveElementAt(0,"Would have listed templates in {0}".FormatWith(ApplicationParameters.TemplatesLocation)); + infos.Should().HaveElementAt(0, "Would have listed templates in {0}".FormatWith(ApplicationParameters.TemplatesLocation)); } [Fact] diff --git a/src/chocolatey.tests/infrastructure.app/utility/PackageUtilitySpecs.cs b/src/chocolatey.tests/infrastructure.app/utility/PackageUtilitySpecs.cs index f244ddefce..eab6b234b3 100644 --- a/src/chocolatey.tests/infrastructure.app/utility/PackageUtilitySpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/utility/PackageUtilitySpecs.cs @@ -17,61 +17,61 @@ using chocolatey.infrastructure.app.configuration; using chocolatey.infrastructure.platforms; using NUnit.Framework; -using FluentAssertions; +using FluentAssertions; -namespace chocolatey.tests.infrastructure.app.utility -{ - public class PackageUtilitySpecs - { - public abstract class PackageUtilitySpecsBase : TinySpec - { - public override void Context() - { - } - } - - - [TestFixture("bob", "", true)] - [TestFixture("", "bob", true)] - [TestFixture("bob", "bob", false)] - [TestFixture("bob", "bob;separatedPackage", false)] - [TestFixture("bob", "C:\\chocolatey-packages\\bob\\bob.1.0.0.nupkg", false)] - [TestFixture("dependency", "C:\\chocolatey-packages\\bob\\bob.1.0.0.nupkg", true)] - [TestFixture("bob", "C:\\chocolatey-packages\\bob\\bob.nuspec", false)] - [TestFixture("dependency", "C:\\chocolatey-packages\\bob\\bob.nuspec", true)] - [TestFixture("bob", "\\bob", false)] - [TestFixture("dependency", "\\bob", true)] - [TestFixture("dependency", "bob", true)] - [TestFixture("dependency", "bob;separatedPackage", true)] - public class When_PackageUtility_is_checking_if_package_is_dependency : PackageUtilitySpecsBase - { - private readonly ChocolateyConfiguration _config = new ChocolateyConfiguration(); - private bool _result; - private bool _expectedResult; - private string _packageName; - - public When_PackageUtility_is_checking_if_package_is_dependency(string packageName, string configNames, bool expectedResult) - { +namespace chocolatey.tests.infrastructure.app.utility +{ + public class PackageUtilitySpecs + { + public abstract class PackageUtilitySpecsBase : TinySpec + { + public override void Context() + { + } + } + + + [TestFixture("bob", "", true)] + [TestFixture("", "bob", true)] + [TestFixture("bob", "bob", false)] + [TestFixture("bob", "bob;separatedPackage", false)] + [TestFixture("bob", "C:\\chocolatey-packages\\bob\\bob.1.0.0.nupkg", false)] + [TestFixture("dependency", "C:\\chocolatey-packages\\bob\\bob.1.0.0.nupkg", true)] + [TestFixture("bob", "C:\\chocolatey-packages\\bob\\bob.nuspec", false)] + [TestFixture("dependency", "C:\\chocolatey-packages\\bob\\bob.nuspec", true)] + [TestFixture("bob", "\\bob", false)] + [TestFixture("dependency", "\\bob", true)] + [TestFixture("dependency", "bob", true)] + [TestFixture("dependency", "bob;separatedPackage", true)] + public class When_PackageUtility_is_checking_if_package_is_dependency : PackageUtilitySpecsBase + { + private readonly ChocolateyConfiguration _config = new ChocolateyConfiguration(); + private bool _result; + private bool _expectedResult; + private string _packageName; + + public When_PackageUtility_is_checking_if_package_is_dependency(string packageName, string configNames, bool expectedResult) + { if (Platform.GetPlatform() != PlatformType.Windows) { configNames = configNames.Replace("\\", "/"); } - _packageName = packageName; - _config.PackageNames = configNames; - _expectedResult = expectedResult; - } - - public override void Because() - { - _result = PackageUtility.PackageIdHasDependencySuffix(_config, _packageName); - } - - [Fact] - public void Should_return_expected_result() - { - _result.Should().Be(_expectedResult); - } - } - } -} + _packageName = packageName; + _config.PackageNames = configNames; + _expectedResult = expectedResult; + } + + public override void Because() + { + _result = PackageUtility.PackageIdHasDependencySuffix(_config, _packageName); + } + + [Fact] + public void Should_return_expected_result() + { + _result.Should().Be(_expectedResult); + } + } + } +} diff --git a/src/chocolatey/EnumExtensions.cs b/src/chocolatey/EnumExtensions.cs index 63ec59434a..db9e7c707d 100644 --- a/src/chocolatey/EnumExtensions.cs +++ b/src/chocolatey/EnumExtensions.cs @@ -39,7 +39,7 @@ public static string DescriptionOrValue(this Enum enumeration) if (memberInfo != null && memberInfo.Length > 0) { - var attrib = memberInfo[0].GetCustomAttributes(typeof (DescriptionAttribute), false).Cast().SingleOrDefault(); + var attrib = memberInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false).Cast().SingleOrDefault(); if (attrib != null) { @@ -53,13 +53,13 @@ public static string DescriptionOrValue(this Enum enumeration) public static TEnum ParseEnumDescription(this string description) where TEnum : struct, Enum { - Type type = typeof (TEnum); + Type type = typeof(TEnum); foreach (var fieldInfo in type.GetFields()) { - var attr = fieldInfo.GetCustomAttributes(typeof (DescriptionAttribute), false).Cast().SingleOrDefault(); + var attr = fieldInfo.GetCustomAttributes(typeof(DescriptionAttribute), false).Cast().SingleOrDefault(); if (attr != null && attr.Description.Equals(description, StringComparison.Ordinal)) { - return (TEnum) fieldInfo.GetValue(null); + return (TEnum)fieldInfo.GetValue(null); } } diff --git a/src/chocolatey/EnumerableExtensions.cs b/src/chocolatey/EnumerableExtensions.cs index a65ad58ab9..79d3788f07 100644 --- a/src/chocolatey/EnumerableExtensions.cs +++ b/src/chocolatey/EnumerableExtensions.cs @@ -118,7 +118,7 @@ public static int SequenceHashCode(this IEnumerable source) unchecked { return source.Aggregate(seed, (current, item) => - (current*modifier) + item.GetHashCode()); + (current * modifier) + item.GetHashCode()); } } diff --git a/src/chocolatey/ExceptionExtensions.cs b/src/chocolatey/ExceptionExtensions.cs index 80ab2a5e89..e496806835 100644 --- a/src/chocolatey/ExceptionExtensions.cs +++ b/src/chocolatey/ExceptionExtensions.cs @@ -2,20 +2,20 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using System.Threading.Tasks; +using System.Threading.Tasks; -namespace chocolatey -{ - public static class ExceptionExtensions - { - public static IEnumerable Enumerate(this Exception error) - { - while (error != null) - { - yield return error; - - error = error.InnerException; - } - } - } -} +namespace chocolatey +{ + public static class ExceptionExtensions + { + public static IEnumerable Enumerate(this Exception error) + { + while (error != null) + { + yield return error; + + error = error.InnerException; + } + } + } +} diff --git a/src/chocolatey/ILogExtensions.cs b/src/chocolatey/ILogExtensions.cs index cf3fcfbbc4..1f7759982d 100644 --- a/src/chocolatey/ILogExtensions.cs +++ b/src/chocolatey/ILogExtensions.cs @@ -31,9 +31,9 @@ public static class ILogExtensions public static bool LogTraceMessages = true; [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] - #pragma warning disable IDE0060 // Unused method parameter +#pragma warning disable IDE0060 // Unused method parameter public static void Trace(this ILog logger, string message, params object[] formatting) - #pragma warning restore IDE0060 // Unused method parameter +#pragma warning restore IDE0060 // Unused method parameter { if (LogTraceMessages) { @@ -42,9 +42,9 @@ public static void Trace(this ILog logger, string message, params object[] forma } [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] - #pragma warning disable IDE0060 // Unused method parameter +#pragma warning disable IDE0060 // Unused method parameter public static void Trace(this ILog logger, Func message) - #pragma warning restore IDE0060 // Unused method parameter +#pragma warning restore IDE0060 // Unused method parameter { if (LogTraceMessages) { @@ -62,7 +62,7 @@ public static void Debug(this ILog logger, ChocolateyLoggers logType, string mes logger.Debug(message, formatting); break; case ChocolateyLoggers.Trace: - Trace(logger,message,formatting); + Trace(logger, message, formatting); break; default: logType.ToStringSafe().Log().Debug(message, formatting); diff --git a/src/chocolatey/LogExtensions.cs b/src/chocolatey/LogExtensions.cs index 0533424312..5a898292c3 100644 --- a/src/chocolatey/LogExtensions.cs +++ b/src/chocolatey/LogExtensions.cs @@ -55,11 +55,11 @@ public static void ResetLoggers() /// /// The type to get the logger for. /// Instance of a logger for the object. - #pragma warning disable IDE0060 // Unused method parameter +#pragma warning disable IDE0060 // Unused method parameter public static ILog Log(this T type) - #pragma warning restore IDE0060 // Unused method parameter +#pragma warning restore IDE0060 // Unused method parameter { - var objectName = typeof (T).FullName; + var objectName = typeof(T).FullName; return Log(objectName); } diff --git a/src/chocolatey/StringExtensions.cs b/src/chocolatey/StringExtensions.cs index 9fc0df8ef0..1c36ee88c0 100644 --- a/src/chocolatey/StringExtensions.cs +++ b/src/chocolatey/StringExtensions.cs @@ -300,7 +300,7 @@ public static string EscapeCurlyBraces(this string input) return string.Empty; } - return _openBraceRegex.Replace(_closeBraceRegex.Replace(input,"}}"),"{{"); + return _openBraceRegex.Replace(_closeBraceRegex.Replace(input, "}}"), "{{"); } /// diff --git a/src/chocolatey/TypeExtensions.cs b/src/chocolatey/TypeExtensions.cs index 9e4ec5ea69..bdfe6e289f 100644 --- a/src/chocolatey/TypeExtensions.cs +++ b/src/chocolatey/TypeExtensions.cs @@ -38,7 +38,7 @@ public static bool IsBuiltinType(this Type type) // if all else fails, check to see if the namespace is at system. return type.IsPrimitive || type.IsValueType - || (type == typeof (string)) + || (type == typeof(string)) || type.Namespace.Equals("System", StringComparison.Ordinal); } diff --git a/src/chocolatey/infrastructure.app/ApplicationParameters.cs b/src/chocolatey/infrastructure.app/ApplicationParameters.cs index b9f9146b49..6d70b29254 100644 --- a/src/chocolatey/infrastructure.app/ApplicationParameters.cs +++ b/src/chocolatey/infrastructure.app/ApplicationParameters.cs @@ -153,9 +153,9 @@ public static class Environment public static int DefaultWaitForExitInSeconds = 2700; public static int DefaultWebRequestTimeoutInSeconds = 30; - public static readonly string[] ConfigFileExtensions = new string[] {".autoconf",".config",".conf",".cfg",".jsc",".json",".jsonp",".ini",".xml",".yaml"}; + public static readonly string[] ConfigFileExtensions = new string[] { ".autoconf", ".config", ".conf", ".cfg", ".jsc", ".json", ".jsonp", ".ini", ".xml", ".yaml" }; public static readonly string ConfigFileTransformExtension = ".install.xdt"; - public static readonly string[] ShimDirectorFileExtensions = new string[] {".gui",".ignore"}; + public static readonly string[] ShimDirectorFileExtensions = new string[] { ".gui", ".ignore" }; public static readonly string HashProviderFileTooBig = "UnableToDetectChanges_FileTooBig"; public static readonly string HashProviderFileLocked = "UnableToDetectChanges_FileLocked"; diff --git a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs index 5c629fb2c2..3363a0255d 100644 --- a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs +++ b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs @@ -77,9 +77,9 @@ public static bool AreCompatibilityChecksDisabled(IFileSystem filesystem, IXmlSe /// The container. /// The license. /// Notify warn logging action - #pragma warning disable IDE0060 // Unused method parameter +#pragma warning disable IDE0060 // Unused method parameter public static void SetupConfiguration(IList args, ChocolateyConfiguration config, Container container, ChocolateyLicense license, Action notifyWarnLoggingAction) - #pragma warning restore IDE0060 // Unused method parameter +#pragma warning restore IDE0060 // Unused method parameter { var fileSystem = container.GetInstance(); var xmlService = container.GetInstance(); @@ -466,7 +466,7 @@ private static void SetGlobalOptions(IList args, ChocolateyConfiguration config.CacheExpirationInMinutes = -1; } }); - ; + ; }, (unparsedArgs) => { diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyCacheCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyCacheCommand.cs index e95917a70a..4db3a9cc13 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyCacheCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyCacheCommand.cs @@ -259,13 +259,13 @@ private void ListCachedItems(ChocolateyConfiguration configuration, string cache var cachedFiles = _fileSystem.GetFiles(cacheLocation, "*.dat", SearchOption.AllDirectories); var cachedDirectories = _fileSystem.GetDirectories(cacheLocation).Where(d => !_fileSystem.GetFileName(d).IsEqualTo(LockDirectoryName)); var expirationTimer = GetCacheExpiration(configuration); - + var expiredFiles = cachedFiles.Where(f => _fileSystem.GetFileModifiedDate(f) < expirationTimer); this.Log().Info("We found {0} cached sources.", cachedDirectories.Count()); this.Log().Info("We found {0} cached items for all sources, where {1} items have expired.", cachedFiles.Count(), expiredFiles.Count()); } - + #region Obsoleted methods [Obsolete("Will be removed in v3. Use ConfigureArgumentParser instead!")] diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyExportCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyExportCommand.cs index 888b341c23..11f956a1f6 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyExportCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyExportCommand.cs @@ -59,7 +59,7 @@ public void ParseAdditionalArguments(IList unparsedArguments, Chocolatey { configuration.Input = string.Join(" ", unparsedArguments); - if (string.IsNullOrWhiteSpace(configuration.ExportCommand.OutputFilePath) && unparsedArguments.Count >=1) + if (string.IsNullOrWhiteSpace(configuration.ExportCommand.OutputFilePath) && unparsedArguments.Count >= 1) { configuration.ExportCommand.OutputFilePath = unparsedArguments[0]; } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs index 178ffd4bd6..b1272110cc 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyListCommand.cs @@ -252,7 +252,7 @@ public virtual void Run(ChocolateyConfiguration config) { // Would have liked to have done this in the Validate method, but can't, since the SourceType // hasn't yet been set, since the sources have not yet been parsed. - if (config.ListCommand.ExplicitSource && config.SourceType == SourceTypes.Normal) + if (config.ListCommand.ExplicitSource && config.SourceType == SourceTypes.Normal) { throw new ApplicationException("When using the '--source' option with the 'choco list' command, only a named alternative source can be provided."); } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyNewCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyNewCommand.cs index 9e9c817619..4ad5280caa 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyNewCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyNewCommand.cs @@ -75,7 +75,7 @@ public virtual void ParseAdditionalArguments(IList unparsedArguments, Ch if (string.IsNullOrWhiteSpace(configuration.NewCommand.Name)) { configuration.NewCommand.Name = unparsedArguments.DefaultIfEmpty(string.Empty).FirstOrDefault(arg => !arg.StartsWith("-") && !arg.ContainsSafe("=")); - var property = unparsedArguments.DefaultIfEmpty(string.Empty).FirstOrDefault().Split(new[] {'='}, StringSplitOptions.RemoveEmptyEntries); + var property = unparsedArguments.DefaultIfEmpty(string.Empty).FirstOrDefault().Split(new[] { '=' }, StringSplitOptions.RemoveEmptyEntries); if (property.Length == 1) { configuration.NewCommand.TemplateProperties.Add(TemplateValues.NamePropertyName, configuration.NewCommand.Name); diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyTemplateCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyTemplateCommand.cs index 6a141f9059..ed3b0abca6 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyTemplateCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyTemplateCommand.cs @@ -25,168 +25,168 @@ using chocolatey.infrastructure.commands; using chocolatey.infrastructure.logging; using chocolatey.infrastructure.app.services; -using chocolatey.infrastructure.app.templates; - -namespace chocolatey.infrastructure.app.commands -{ - [CommandFor("template", "get information about installed templates")] - [CommandFor("templates", "get information about installed templates (alias for template)")] - public class ChocolateyTemplateCommand : ICommand - { - private readonly ITemplateService _templateService; - - public ChocolateyTemplateCommand(ITemplateService templateService) - { - _templateService = templateService; - } - - public void ConfigureArgumentParser(OptionSet optionSet, ChocolateyConfiguration configuration) - { - optionSet - .Add("n=|name=", - "The name of the template to get information about.", - option => configuration.TemplateCommand.Name = option.UnquoteSafe().ToLower()); - // todo: #2570 Allow for templates from an external path? Requires #1477 - } - - public virtual void ParseAdditionalArguments(IList unparsedArguments, ChocolateyConfiguration configuration) - { - // don't set configuration.Input or it will be passed to list - - if (unparsedArguments.Count > 1) - { - throw new ApplicationException("A single template command must be listed. Please see the help menu for those commands"); - } - - var command = TemplateCommandType.Unknown; - var unparsedCommand = unparsedArguments.DefaultIfEmpty(string.Empty).FirstOrDefault(); - Enum.TryParse(unparsedCommand, true, out command); - - if (command == TemplateCommandType.Unknown) - { +using chocolatey.infrastructure.app.templates; + +namespace chocolatey.infrastructure.app.commands +{ + [CommandFor("template", "get information about installed templates")] + [CommandFor("templates", "get information about installed templates (alias for template)")] + public class ChocolateyTemplateCommand : ICommand + { + private readonly ITemplateService _templateService; + + public ChocolateyTemplateCommand(ITemplateService templateService) + { + _templateService = templateService; + } + + public void ConfigureArgumentParser(OptionSet optionSet, ChocolateyConfiguration configuration) + { + optionSet + .Add("n=|name=", + "The name of the template to get information about.", + option => configuration.TemplateCommand.Name = option.UnquoteSafe().ToLower()); + // todo: #2570 Allow for templates from an external path? Requires #1477 + } + + public virtual void ParseAdditionalArguments(IList unparsedArguments, ChocolateyConfiguration configuration) + { + // don't set configuration.Input or it will be passed to list + + if (unparsedArguments.Count > 1) + { + throw new ApplicationException("A single template command must be listed. Please see the help menu for those commands"); + } + + var command = TemplateCommandType.Unknown; + var unparsedCommand = unparsedArguments.DefaultIfEmpty(string.Empty).FirstOrDefault(); + Enum.TryParse(unparsedCommand, true, out command); + + if (command == TemplateCommandType.Unknown) + { if (!string.IsNullOrWhiteSpace(unparsedCommand)) { this.Log().Warn("Unknown command {0}. Setting to list.".FormatWith(unparsedCommand)); } - command = TemplateCommandType.List; - } - - configuration.TemplateCommand.Command = command; - } - - public virtual void Validate(ChocolateyConfiguration configuration) - { - if (configuration.TemplateCommand.Command != TemplateCommandType.List && string.IsNullOrWhiteSpace(configuration.TemplateCommand.Name)) - { - throw new ApplicationException("When specifying the subcommand '{0}', you must also specify --name.".FormatWith(configuration.TemplateCommand.Command.ToStringSafe().ToLower())); - } - } - - public virtual void HelpMessage(ChocolateyConfiguration configuration) - { - "chocolatey".Log().Info(ChocolateyLoggers.Important, "Template Command"); - "chocolatey".Log().Info(@" -List information installed templates. - -Both manually installed templates and templates installed via - .template packages are displayed."); - - "chocolatey".Log().Info(ChocolateyLoggers.Important, "Usage"); - "chocolatey".Log().Info(@" - choco template [list]|info []"); - - "chocolatey".Log().Info(ChocolateyLoggers.Important, "Examples"); - "chocolatey".Log().Info(@" - choco template - choco templates - choco template list - choco template info --name msi - choco template list --reduce-output - choco template list --verbose - -NOTE: See scripting in the command reference (`choco -?`) for how to - write proper scripts and integrations. - -"); - - "chocolatey".Log().Info(ChocolateyLoggers.Important, "Exit Codes"); - "chocolatey".Log().Info(@" -Exit codes that normally result from running this command. - -Normal: - - 0: operation was successful, no issues detected - - -1 or 1: an error has occurred - -If you find other exit codes that we have not yet documented, please - file a ticket so we can document it at - https://github.com/chocolatey/choco/issues/new/choose. - -"); - - "chocolatey".Log().Info(ChocolateyLoggers.Important, "Options and Switches"); - } - - public virtual void DryRun(ChocolateyConfiguration configuration) - { - switch (configuration.TemplateCommand.Command) - { - case TemplateCommandType.List: - _templateService.ListDryRun(configuration); - break; - case TemplateCommandType.Info: - _templateService.ListDryRun(configuration); - break; - } - } - - public virtual void Run(ChocolateyConfiguration configuration) - { - switch (configuration.TemplateCommand.Command) - { - case TemplateCommandType.List: - _templateService.List(configuration); - break; - case TemplateCommandType.Info: - configuration.Verbose = true; - _templateService.List(configuration); - break; - } - } - - public virtual bool MayRequireAdminAccess() - { - return false; - } - -#pragma warning disable IDE0022, IDE1006 - [Obsolete("This overload is deprecated and will be removed in v3.")] - public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyConfiguration configuration) - => ConfigureArgumentParser(optionSet, configuration); - - [Obsolete("This overload is deprecated and will be removed in v3.")] - public virtual void handle_additional_argument_parsing(IList unparsedArguments, ChocolateyConfiguration configuration) - => ParseAdditionalArguments(unparsedArguments, configuration); - - [Obsolete("This overload is deprecated and will be removed in v3.")] - public virtual void handle_validation(ChocolateyConfiguration configuration) - => Validate(configuration); - - [Obsolete("This overload is deprecated and will be removed in v3.")] - public virtual void help_message(ChocolateyConfiguration configuration) - => HelpMessage(configuration); - - [Obsolete("This overload is deprecated and will be removed in v3.")] - public virtual void noop(ChocolateyConfiguration configuration) - => DryRun(configuration); - - [Obsolete("This overload is deprecated and will be removed in v3.")] - public virtual void run(ChocolateyConfiguration configuration) - => Run(configuration); - - [Obsolete("This overload is deprecated and will be removed in v3.")] - public virtual bool may_require_admin_access() - => MayRequireAdminAccess(); -#pragma warning restore IDE0022, IDE1006 - } -} + command = TemplateCommandType.List; + } + + configuration.TemplateCommand.Command = command; + } + + public virtual void Validate(ChocolateyConfiguration configuration) + { + if (configuration.TemplateCommand.Command != TemplateCommandType.List && string.IsNullOrWhiteSpace(configuration.TemplateCommand.Name)) + { + throw new ApplicationException("When specifying the subcommand '{0}', you must also specify --name.".FormatWith(configuration.TemplateCommand.Command.ToStringSafe().ToLower())); + } + } + + public virtual void HelpMessage(ChocolateyConfiguration configuration) + { + "chocolatey".Log().Info(ChocolateyLoggers.Important, "Template Command"); + "chocolatey".Log().Info(@" +List information installed templates. + +Both manually installed templates and templates installed via + .template packages are displayed."); + + "chocolatey".Log().Info(ChocolateyLoggers.Important, "Usage"); + "chocolatey".Log().Info(@" + choco template [list]|info []"); + + "chocolatey".Log().Info(ChocolateyLoggers.Important, "Examples"); + "chocolatey".Log().Info(@" + choco template + choco templates + choco template list + choco template info --name msi + choco template list --reduce-output + choco template list --verbose + +NOTE: See scripting in the command reference (`choco -?`) for how to + write proper scripts and integrations. + +"); + + "chocolatey".Log().Info(ChocolateyLoggers.Important, "Exit Codes"); + "chocolatey".Log().Info(@" +Exit codes that normally result from running this command. + +Normal: + - 0: operation was successful, no issues detected + - -1 or 1: an error has occurred + +If you find other exit codes that we have not yet documented, please + file a ticket so we can document it at + https://github.com/chocolatey/choco/issues/new/choose. + +"); + + "chocolatey".Log().Info(ChocolateyLoggers.Important, "Options and Switches"); + } + + public virtual void DryRun(ChocolateyConfiguration configuration) + { + switch (configuration.TemplateCommand.Command) + { + case TemplateCommandType.List: + _templateService.ListDryRun(configuration); + break; + case TemplateCommandType.Info: + _templateService.ListDryRun(configuration); + break; + } + } + + public virtual void Run(ChocolateyConfiguration configuration) + { + switch (configuration.TemplateCommand.Command) + { + case TemplateCommandType.List: + _templateService.List(configuration); + break; + case TemplateCommandType.Info: + configuration.Verbose = true; + _templateService.List(configuration); + break; + } + } + + public virtual bool MayRequireAdminAccess() + { + return false; + } + +#pragma warning disable IDE0022, IDE1006 + [Obsolete("This overload is deprecated and will be removed in v3.")] + public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyConfiguration configuration) + => ConfigureArgumentParser(optionSet, configuration); + + [Obsolete("This overload is deprecated and will be removed in v3.")] + public virtual void handle_additional_argument_parsing(IList unparsedArguments, ChocolateyConfiguration configuration) + => ParseAdditionalArguments(unparsedArguments, configuration); + + [Obsolete("This overload is deprecated and will be removed in v3.")] + public virtual void handle_validation(ChocolateyConfiguration configuration) + => Validate(configuration); + + [Obsolete("This overload is deprecated and will be removed in v3.")] + public virtual void help_message(ChocolateyConfiguration configuration) + => HelpMessage(configuration); + + [Obsolete("This overload is deprecated and will be removed in v3.")] + public virtual void noop(ChocolateyConfiguration configuration) + => DryRun(configuration); + + [Obsolete("This overload is deprecated and will be removed in v3.")] + public virtual void run(ChocolateyConfiguration configuration) + => Run(configuration); + + [Obsolete("This overload is deprecated and will be removed in v3.")] + public virtual bool may_require_admin_access() + => MayRequireAdminAccess(); +#pragma warning restore IDE0022, IDE1006 + } +} diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyUnpackSelfCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyUnpackSelfCommand.cs index 8f1d4366d7..0984a5fc81 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyUnpackSelfCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyUnpackSelfCommand.cs @@ -38,7 +38,7 @@ public class ChocolateyUnpackSelfCommand : ICommand private readonly IFileSystem _fileSystem; #if !NoResources - private Lazy _assemblyInitializer = new Lazy(() => adapters.Assembly.GetAssembly(typeof (ChocolateyResourcesAssembly))); + private Lazy _assemblyInitializer = new Lazy(() => adapters.Assembly.GetAssembly(typeof(ChocolateyResourcesAssembly))); #else private Lazy _assemblyInitializer = new Lazy(); #endif diff --git a/src/chocolatey/infrastructure.app/configuration/ConfigFileApiKeySetting.cs b/src/chocolatey/infrastructure.app/configuration/ConfigFileApiKeySetting.cs index 7014589a8d..a756fe8c14 100644 --- a/src/chocolatey/infrastructure.app/configuration/ConfigFileApiKeySetting.cs +++ b/src/chocolatey/infrastructure.app/configuration/ConfigFileApiKeySetting.cs @@ -40,7 +40,7 @@ public override bool Equals(object obj) return false; } - var item = (ConfigFileApiKeySetting) obj; + var item = (ConfigFileApiKeySetting)obj; return (Source == item.Source) && (Key == item.Key); diff --git a/src/chocolatey/infrastructure.app/configuration/ConfigFileConfigSetting.cs b/src/chocolatey/infrastructure.app/configuration/ConfigFileConfigSetting.cs index 2c5dcaab68..8bcf054cdd 100644 --- a/src/chocolatey/infrastructure.app/configuration/ConfigFileConfigSetting.cs +++ b/src/chocolatey/infrastructure.app/configuration/ConfigFileConfigSetting.cs @@ -43,7 +43,7 @@ public override bool Equals(object obj) return false; } - var item = (ConfigFileConfigSetting) obj; + var item = (ConfigFileConfigSetting)obj; return (Key == item.Key) && (Value == item.Value) diff --git a/src/chocolatey/infrastructure.app/configuration/ConfigFileFeatureSetting.cs b/src/chocolatey/infrastructure.app/configuration/ConfigFileFeatureSetting.cs index f62f14c555..1fa65957a8 100644 --- a/src/chocolatey/infrastructure.app/configuration/ConfigFileFeatureSetting.cs +++ b/src/chocolatey/infrastructure.app/configuration/ConfigFileFeatureSetting.cs @@ -46,7 +46,7 @@ public override bool Equals(object obj) return false; } - var item = (ConfigFileFeatureSetting) obj; + var item = (ConfigFileFeatureSetting)obj; return (Name == item.Name) && (Enabled == item.Enabled) diff --git a/src/chocolatey/infrastructure.app/configuration/ConfigFileSettings.cs b/src/chocolatey/infrastructure.app/configuration/ConfigFileSettings.cs index f86b362229..08d1b36217 100644 --- a/src/chocolatey/infrastructure.app/configuration/ConfigFileSettings.cs +++ b/src/chocolatey/infrastructure.app/configuration/ConfigFileSettings.cs @@ -47,7 +47,7 @@ public override bool Equals(object obj) return false; } - var item = (ConfigFileSettings) obj; + var item = (ConfigFileSettings)obj; return (ConfigSettings == item.ConfigSettings) && (Sources == item.Sources) diff --git a/src/chocolatey/infrastructure.app/configuration/ConfigFileSourceSetting.cs b/src/chocolatey/infrastructure.app/configuration/ConfigFileSourceSetting.cs index 3966045b2c..e1f4ada5e0 100644 --- a/src/chocolatey/infrastructure.app/configuration/ConfigFileSourceSetting.cs +++ b/src/chocolatey/infrastructure.app/configuration/ConfigFileSourceSetting.cs @@ -67,7 +67,7 @@ public override bool Equals(object obj) return false; } - var item = (ConfigFileSourceSetting) obj; + var item = (ConfigFileSourceSetting)obj; return (Id == item.Id) && (Value == item.Value) diff --git a/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs b/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs index fbff9b712f..dc0aa9c096 100644 --- a/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs +++ b/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs @@ -45,9 +45,9 @@ private static IEnvironment Environment get { return _environmentInitializer.Value; } } - #pragma warning disable IDE0060 // Unused method parameter +#pragma warning disable IDE0060 // Unused method parameter public static void ResetEnvironmentVariables(ChocolateyConfiguration config) - #pragma warning restore IDE0060 // Unused method parameter +#pragma warning restore IDE0060 // Unused method parameter { Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyPackageInstallLocation, null); Environment.SetEnvironmentVariable(ApplicationParameters.Environment.ChocolateyPackageInstallerType, null); @@ -311,7 +311,7 @@ public static void UpdateEnvironmentVariables() // add back in process items updatedPath += GetProcessOnlyItems(updatedPath, originalPath); updatedPathExt += GetProcessOnlyItems(updatedPathExt, originalPathExt); - updatedPsModulePath = "{0};{1}".FormatWith(GetProcessOnlyItems(updatedPsModulePath, originalPsModulePath),updatedPsModulePath); + updatedPsModulePath = "{0};{1}".FormatWith(GetProcessOnlyItems(updatedPsModulePath, originalPsModulePath), updatedPsModulePath); if (!updatedPsModulePath.ContainsSafe(ApplicationParameters.PowerShellModulePathProcessProgramFiles)) { diff --git a/src/chocolatey/infrastructure.app/configuration/PackagesConfigFilePackageSetting.cs b/src/chocolatey/infrastructure.app/configuration/PackagesConfigFilePackageSetting.cs index 2820bfe53c..2344a34a6a 100644 --- a/src/chocolatey/infrastructure.app/configuration/PackagesConfigFilePackageSetting.cs +++ b/src/chocolatey/infrastructure.app/configuration/PackagesConfigFilePackageSetting.cs @@ -58,7 +58,7 @@ public sealed class PackagesConfigFilePackageSetting [XmlAttribute(AttributeName = "pinPackage")] public bool PinPackage { get; set; } - + [System.ComponentModel.DefaultValue(-1)] [XmlAttribute(AttributeName = "executionTimeout")] public int ExecutionTimeout { get; set; } diff --git a/src/chocolatey/infrastructure.app/domain/ApiKeyCommandType.cs b/src/chocolatey/infrastructure.app/domain/ApiKeyCommandType.cs index 8ed9f79406..17bac25ae7 100644 --- a/src/chocolatey/infrastructure.app/domain/ApiKeyCommandType.cs +++ b/src/chocolatey/infrastructure.app/domain/ApiKeyCommandType.cs @@ -1,25 +1,25 @@ -// Copyright © 2023 Chocolatey Software, Inc -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -namespace chocolatey.infrastructure.app.domain -{ - public enum ApiKeyCommandType - { - Unknown, - List, - Add, - Remove, - } -} +// Copyright © 2023 Chocolatey Software, Inc +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +namespace chocolatey.infrastructure.app.domain +{ + public enum ApiKeyCommandType + { + Unknown, + List, + Add, + Remove, + } +} diff --git a/src/chocolatey/infrastructure.app/domain/ChocolateyPackageMetadata.cs b/src/chocolatey/infrastructure.app/domain/ChocolateyPackageMetadata.cs index 9d52ef9068..a776bdc434 100644 --- a/src/chocolatey/infrastructure.app/domain/ChocolateyPackageMetadata.cs +++ b/src/chocolatey/infrastructure.app/domain/ChocolateyPackageMetadata.cs @@ -24,7 +24,7 @@ namespace chocolatey.infrastructure.app.domain { - public class ChocolateyPackageMetadata : IPackageMetadata + public class ChocolateyPackageMetadata : IPackageMetadata { public ChocolateyPackageMetadata(NuspecReader reader) { diff --git a/src/chocolatey/infrastructure.app/domain/TemplateCommandType.cs b/src/chocolatey/infrastructure.app/domain/TemplateCommandType.cs index 659a5c2278..8ae72d54b4 100644 --- a/src/chocolatey/infrastructure.app/domain/TemplateCommandType.cs +++ b/src/chocolatey/infrastructure.app/domain/TemplateCommandType.cs @@ -14,23 +14,23 @@ // See the License for the specific language governing permissions and // limitations under the License. -using System; +using System; -namespace chocolatey.infrastructure.app.domain -{ - public enum TemplateCommandType - { - Unknown, - List, - Info, - -#pragma warning disable IDE0022, IDE1006 - [Obsolete("This overload is deprecated and will be removed in v3.")] - unknown = Unknown, - [Obsolete("This overload is deprecated and will be removed in v3.")] - list = List, - [Obsolete("This overload is deprecated and will be removed in v3.")] - info = Info, -#pragma warning restore IDE0022, IDE1006 - } -} +namespace chocolatey.infrastructure.app.domain +{ + public enum TemplateCommandType + { + Unknown, + List, + Info, + +#pragma warning disable IDE0022, IDE1006 + [Obsolete("This overload is deprecated and will be removed in v3.")] + unknown = Unknown, + [Obsolete("This overload is deprecated and will be removed in v3.")] + list = List, + [Obsolete("This overload is deprecated and will be removed in v3.")] + info = Info, +#pragma warning restore IDE0022, IDE1006 + } +} diff --git a/src/chocolatey/infrastructure.app/nuget/ChocolateyNuGetSettings.cs b/src/chocolatey/infrastructure.app/nuget/ChocolateyNuGetSettings.cs index 0097be7a0d..6f655d4ba5 100644 --- a/src/chocolatey/infrastructure.app/nuget/ChocolateyNuGetSettings.cs +++ b/src/chocolatey/infrastructure.app/nuget/ChocolateyNuGetSettings.cs @@ -15,9 +15,9 @@ public class ChocolateyNuGetSettings : ISettings private const string ConfigSectionName = "config"; //private SettingSection _configSettingSection; - #pragma warning disable IDE0060 // unused method parameter +#pragma warning disable IDE0060 // unused method parameter public ChocolateyNuGetSettings(ChocolateyConfiguration config) - #pragma warning restore IDE0060 // unused method parameter +#pragma warning restore IDE0060 // unused method parameter { //new SettingSection //_clientCertItem = @@ -30,9 +30,15 @@ public void AddOrUpdate(string sectionName, SettingItem item) this.Log().Warn("NuGet tried to add an item to section {0}".FormatWith(sectionName)); } - public IList GetConfigFilePaths() => Enumerable.Empty().ToList(); + public IList GetConfigFilePaths() + { + return Enumerable.Empty().ToList(); + } - public IList GetConfigRoots() => Enumerable.Empty().ToList(); + public IList GetConfigRoots() + { + return Enumerable.Empty().ToList(); + } public SettingSection GetSection(string sectionName) { @@ -41,7 +47,7 @@ public SettingSection GetSection(string sectionName) case ConfigSectionName: //TODO fix return null; - //break; + //break; default: return null; } diff --git a/src/chocolatey/infrastructure.app/nuget/ChocolateyNugetCredentialProvider.cs b/src/chocolatey/infrastructure.app/nuget/ChocolateyNugetCredentialProvider.cs index 402553d260..2c7e4ee692 100644 --- a/src/chocolatey/infrastructure.app/nuget/ChocolateyNugetCredentialProvider.cs +++ b/src/chocolatey/infrastructure.app/nuget/ChocolateyNugetCredentialProvider.cs @@ -120,7 +120,7 @@ public Task GetAsync(Uri uri, IWebProxy proxy, CredentialReq // find the source that is the closest match foreach (var candidateSource in candidateSources.OrEmpty()) { - var candidateRegEx = new Regex(Regex.Escape(candidateSource.Key.TrimEnd('/')),RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + var candidateRegEx = new Regex(Regex.Escape(candidateSource.Key.TrimEnd('/')), RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (candidateRegEx.IsMatch(uri.OriginalString.TrimEnd('/'))) { this.Log().Debug("Source selected will be '{0}'".FormatWith(candidateSource.Key.TrimEnd('/'))); @@ -159,9 +159,9 @@ public Task GetAsync(Uri uri, IWebProxy proxy, CredentialReq return Task.FromResult(new CredentialResponse(new NetworkCredential(source.Username, NugetEncryptionUtility.DecryptString(source.EncryptedPassword)))); } - #pragma warning disable IDE0060 // unused method parameter +#pragma warning disable IDE0060 // unused method parameter public ICredentials GetUserCredentials(Uri uri, IWebProxy proxy, CredentialRequestType credentialType) - #pragma warning restore IDE0060 // unused method parameter +#pragma warning restore IDE0060 // unused method parameter { if (!_config.Information.IsInteractive) { @@ -187,10 +187,10 @@ public ICredentials GetUserCredentials(Uri uri, IWebProxy proxy, CredentialReque } var credentials = new NetworkCredential - { - UserName = username, - Password = password - }; + { + UserName = username, + Password = password + }; return credentials; } diff --git a/src/chocolatey/infrastructure.app/nuget/ChocolateyPackagePathResolver.cs b/src/chocolatey/infrastructure.app/nuget/ChocolateyPackagePathResolver.cs index aeaeeacf2c..2d3abb1c63 100644 --- a/src/chocolatey/infrastructure.app/nuget/ChocolateyPackagePathResolver.cs +++ b/src/chocolatey/infrastructure.app/nuget/ChocolateyPackagePathResolver.cs @@ -38,16 +38,24 @@ public ChocolateyPackagePathResolver(string rootDirectory, IFileSystem filesyste } public override string GetInstallPath(PackageIdentity packageIdentity) - => GetInstallPath(packageIdentity.Id); + { + return GetInstallPath(packageIdentity.Id); + } public string GetInstallPath(string packageId) - => _filesystem.CombinePaths(RootDirectory, packageId); + { + return _filesystem.CombinePaths(RootDirectory, packageId); + } [Obsolete("This overload will be removed in a future version.")] public string GetInstallPath(string id, NuGetVersion version) - => GetInstallPath(id); + { + return GetInstallPath(id); + } public override string GetPackageFileName(PackageIdentity packageIdentity) - => packageIdentity.Id + NuGetConstants.PackageExtension; + { + return packageIdentity.Id + NuGetConstants.PackageExtension; + } } } diff --git a/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs b/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs index fe0d3acab0..4c8e6cc83a 100644 --- a/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs +++ b/src/chocolatey/infrastructure.app/nuget/NugetCommon.cs @@ -96,9 +96,9 @@ public static SourceRepository GetLocalRepository() return Repository.Factory.GetCoreV3(nugetSource); } - #pragma warning disable IDE0060 // unused method parameter (nugetLogger) +#pragma warning disable IDE0060 // unused method parameter (nugetLogger) public static IEnumerable GetRemoteRepositories(ChocolateyConfiguration configuration, ILogger nugetLogger, IFileSystem filesystem) - #pragma warning restore IDE0060 // unused method parameter (nugetLogger) +#pragma warning restore IDE0060 // unused method parameter (nugetLogger) { // Set user agent for all NuGet library calls. Should not affect any HTTP calls that Chocolatey itself would make. UserAgent.SetUserAgentString(new UserAgentStringBuilder("{0}/{1} via NuGet Client".FormatWith(ApplicationParameters.UserAgent, configuration.Information.ChocolateyProductVersion))); @@ -119,7 +119,7 @@ public static IEnumerable GetRemoteRepositories(ChocolateyConf if (!string.IsNullOrWhiteSpace(configuration.Proxy.BypassList)) { "chocolatey".Log().Debug("Proxy has a bypass list of '{0}'.".FormatWith(configuration.Proxy.BypassList.EscapeCurlyBraces())); - proxy.BypassList = configuration.Proxy.BypassList.Replace("*",".*").Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + proxy.BypassList = configuration.Proxy.BypassList.Replace("*", ".*").Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); } proxy.BypassProxyOnLocal = configuration.Proxy.BypassOnLocal; diff --git a/src/chocolatey/infrastructure.app/nuget/NugetList.cs b/src/chocolatey/infrastructure.app/nuget/NugetList.cs index 522e5e5e6e..40698e4fd5 100644 --- a/src/chocolatey/infrastructure.app/nuget/NugetList.cs +++ b/src/chocolatey/infrastructure.app/nuget/NugetList.cs @@ -419,7 +419,7 @@ public static ISet find_all_package_versions(string pack #pragma warning restore IDE0022, IDE1006 } - public class ComparePackageSearchMetadataIdOnly: IEqualityComparer + public class ComparePackageSearchMetadataIdOnly : IEqualityComparer { public bool Equals(IPackageSearchMetadata x, IPackageSearchMetadata y) { diff --git a/src/chocolatey/infrastructure.app/runners/ConsoleApplication.cs b/src/chocolatey/infrastructure.app/runners/ConsoleApplication.cs index 43e8b886fa..c8701f14f6 100644 --- a/src/chocolatey/infrastructure.app/runners/ConsoleApplication.cs +++ b/src/chocolatey/infrastructure.app/runners/ConsoleApplication.cs @@ -66,7 +66,8 @@ public void Run(string[] args, ChocolateyConfiguration config, Container contain commandArgs, config, (optionSet) => command.ConfigureArgumentParser(optionSet, config), - (unparsedArgs) => { + (unparsedArgs) => + { // if debug is bundled with local options, it may not get picked up when global // options are parsed. Attempt to set it again once local options are set. // This does mean some output from debug will be missed (but not much) @@ -91,7 +92,8 @@ public void Run(string[] args, ChocolateyConfiguration config, Container contain } } }, - () => { + () => + { this.Log().Debug(() => "Performing validation checks."); command.Validate(config); diff --git a/src/chocolatey/infrastructure.app/services/AutomaticUninstallerService.cs b/src/chocolatey/infrastructure.app/services/AutomaticUninstallerService.cs index 7aad58871f..ae929065f8 100644 --- a/src/chocolatey/infrastructure.app/services/AutomaticUninstallerService.cs +++ b/src/chocolatey/infrastructure.app/services/AutomaticUninstallerService.cs @@ -144,23 +144,23 @@ public void Remove(RegistryApplicationKey key, ChocolateyConfiguration config, P } // split on " /" and " -" for quite a bit more accuracy - IList uninstallArgsSplit = key.UninstallString.ToStringSafe().Replace(""","\"").Replace("'","'").Split(new[] { " /", " -" }, StringSplitOptions.RemoveEmptyEntries).ToList(); + IList uninstallArgsSplit = key.UninstallString.ToStringSafe().Replace(""", "\"").Replace("'", "'").Split(new[] { " /", " -" }, StringSplitOptions.RemoveEmptyEntries).ToList(); var uninstallExe = uninstallArgsSplit.DefaultIfEmpty(string.Empty).FirstOrDefault().TrimSafe(); if (uninstallExe.Count(u => u == '"') > 2) { - uninstallExe = uninstallExe.Split(new []{" \""}, StringSplitOptions.RemoveEmptyEntries).First(); + uninstallExe = uninstallExe.Split(new[] { " \"" }, StringSplitOptions.RemoveEmptyEntries).First(); } if (uninstallExe.Count(u => u == ':') > 1) { try { - var firstMatch = Regex.Match(uninstallExe, @"\s+\w\:",RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + var firstMatch = Regex.Match(uninstallExe, @"\s+\w\:", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); uninstallExe = uninstallExe.Substring(0, firstMatch.Index); } catch (Exception ex) { - this.Log().Debug("Error splitting the uninstall string:{0} {1}".FormatWith(Environment.NewLine,ex.ToStringSafe())); + this.Log().Debug("Error splitting the uninstall string:{0} {1}".FormatWith(Environment.NewLine, ex.ToStringSafe())); } } var uninstallArgs = key.UninstallString.ToStringSafe().Replace(""", "\"").Replace("'", "'").Replace(uninstallExe.ToStringSafe(), string.Empty).TrimSafe(); @@ -199,7 +199,7 @@ public void Remove(RegistryApplicationKey key, ChocolateyConfiguration config, P { if (userOverrideUninstallArguments) { - this.Log().Debug(() => " Replacing original uninstall arguments of '{0}' with '{1}'".FormatWith(uninstallArgs.EscapeCurlyBraces(),userProvidedUninstallArguments.EscapeCurlyBraces())); + this.Log().Debug(() => " Replacing original uninstall arguments of '{0}' with '{1}'".FormatWith(uninstallArgs.EscapeCurlyBraces(), userProvidedUninstallArguments.EscapeCurlyBraces())); uninstallArgs = userProvidedUninstallArguments; } else diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs index aa4a5b036f..6eb0d7d715 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs @@ -147,7 +147,7 @@ has errored attempting to read it. This file will be renamed to "Unable to read files snapshot file", throwError: false, logWarningInsteadOfError: true, - isSilent:true + isSilent: true ); packageInformation.HasSilentUninstall = _fileSystem.FileExists(_fileSystem.CombinePaths(pkgStorePath, SilentUninstallerFile)); diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs index 642c16301a..1e0f1d2bfb 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs @@ -1899,7 +1899,7 @@ private void RestorePreviousPackageVersion(ChocolateyConfiguration config, Packa if (rollback) { - var destination = _fileSystem.CombinePaths(ApplicationParameters.PackagesLocation, packageResult.Identity.Id); + var destination = _fileSystem.CombinePaths(ApplicationParameters.PackagesLocation, packageResult.Identity.Id); _filesService.MovePackageUsingBackupStrategy(rollbackDirectory, destination, restoreSource: false); } diff --git a/src/chocolatey/infrastructure.app/services/ConfigTransformService.cs b/src/chocolatey/infrastructure.app/services/ConfigTransformService.cs index ba0f4ae789..3e8d283ff4 100644 --- a/src/chocolatey/infrastructure.app/services/ConfigTransformService.cs +++ b/src/chocolatey/infrastructure.app/services/ConfigTransformService.cs @@ -63,7 +63,7 @@ public void Run(PackageResult packageResult, ChocolateyConfiguration config) var targetFilesTest = targetFiles as IList ?? targetFiles.ToList(); if (!targetFilesTest.Any()) { - targetFiles = new[] {transformFile.Replace(ApplicationParameters.ConfigFileTransformExtension, string.Empty)}; + targetFiles = new[] { transformFile.Replace(ApplicationParameters.ConfigFileTransformExtension, string.Empty) }; this.Log().Debug(() => "No matching files found for transform {0}.{1} Creating '{2}'".FormatWith(_fileSystem.GetFileName(transformFile), Environment.NewLine, targetFiles.FirstOrDefault())); } @@ -89,7 +89,7 @@ public void Run(PackageResult packageResult, ChocolateyConfiguration config) // backup and let the transform to its thing instead. if (_fileSystem.FileExists(backupTargetFile)) { - this.Log().Debug(()=> "Restoring backup configuration file for '{0}'.".FormatWith(targetFile)); + this.Log().Debug(() => "Restoring backup configuration file for '{0}'.".FormatWith(targetFile)); _fileSystem.CopyFile(backupTargetFile, targetFile, overwriteExisting: true); } }, @@ -103,7 +103,7 @@ public void Run(PackageResult packageResult, ChocolateyConfiguration config) using (var transformation = new XmlTransformation(_fileSystem.ReadFile(transformFile), isTransformAFile: false, logger: null)) { - using (var document = new XmlTransformableDocument {PreserveWhitespace = true}) + using (var document = new XmlTransformableDocument { PreserveWhitespace = true }) { using (var inputStream = _fileSystem.OpenFileReadonly(targetFile)) { diff --git a/src/chocolatey/infrastructure.app/services/NugetService.cs b/src/chocolatey/infrastructure.app/services/NugetService.cs index 8811788002..d8db70c50f 100644 --- a/src/chocolatey/infrastructure.app/services/NugetService.cs +++ b/src/chocolatey/infrastructure.app/services/NugetService.cs @@ -255,7 +255,7 @@ Package url{6} package.PackageTestResultStatus, package.PackageValidationResultDate.GetValueOrDefault().ToString("MMM dd yyyy HH:mm:ss") ), - (package.DownloadCount == null || package.DownloadCount <= 0) ? "n/a" : package.DownloadCount.ToStringSafe(), + (package.DownloadCount == null || package.DownloadCount <= 0) ? "n/a" : package.DownloadCount.ToStringSafe(), (package.VersionDownloadCount == null || package.VersionDownloadCount <= 0) ? "n/a" : package.VersionDownloadCount.ToStringSafe(), package.PackageDetailsUrl == null || string.IsNullOrWhiteSpace(package.PackageDetailsUrl.AbsoluteUri) ? string.Empty : " " + package.PackageDetailsUrl.AbsoluteUri, !string.IsNullOrWhiteSpace(package.PackageSourceUrl.ToStringSafe()) @@ -2867,7 +2867,7 @@ private IEnumerable SetPackageNamesIfAllSpecified(ChocolateyConfi var allPackages = GetInstalledPackages(config); if (config.PackageNames.IsEqualTo(ApplicationParameters.AllPackages)) { - var packagesToUpdate= allPackages.Select(p => p.Name).ToList(); + var packagesToUpdate = allPackages.Select(p => p.Name).ToList(); if (!string.IsNullOrWhiteSpace(config.UpgradeCommand.PackageNamesToSkip)) { diff --git a/src/chocolatey/infrastructure.app/services/RegistryService.cs b/src/chocolatey/infrastructure.app/services/RegistryService.cs index 13debb4245..833eeb49f6 100644 --- a/src/chocolatey/infrastructure.app/services/RegistryService.cs +++ b/src/chocolatey/infrastructure.app/services/RegistryService.cs @@ -146,12 +146,12 @@ public void UpdateSnapshot(RegistryKey key, Registry snapshot) logWarningInsteadOfError: true); var appKey = new RegistryApplicationKey - { - KeyPath = key.Name, - RegistryView = key.View, - DefaultValue = key.AsXmlSafeString(""), - DisplayName = key.AsXmlSafeString("DisplayName") - }; + { + KeyPath = key.Name, + RegistryView = key.View, + DefaultValue = key.AsXmlSafeString(""), + DisplayName = key.AsXmlSafeString("DisplayName") + }; if (string.IsNullOrWhiteSpace(appKey.DisplayName)) { @@ -236,17 +236,17 @@ public void UpdateSnapshot(RegistryKey key, Registry snapshot) { //if (appKey.is_in_programs_and_features() && appKey.InstallerType == InstallerType.Unknown) //{ - foreach (var name in key.GetValueNames()) + foreach (var name in key.GetValueNames()) + { + //var kind = key.GetValueKind(name); + var value = key.AsXmlSafeString(name); + if (name.IsEqualTo("QuietUninstallString") || name.IsEqualTo("UninstallString")) { - //var kind = key.GetValueKind(name); - var value = key.AsXmlSafeString(name); - if (name.IsEqualTo("QuietUninstallString") || name.IsEqualTo("UninstallString")) - { - Console.WriteLine("key - {0}|{1}={2}|Type detected={3}|install location={4}".FormatWith(key.Name, name, value.ToStringSafe(), appKey.InstallerType.ToStringSafe(),appKey.InstallLocation.ToStringSafe())); - } - - //Console.WriteLine("key - {0}, name - {1}, kind - {2}, value - {3}".format_with(key.Name, name, kind, value.to_string())); + Console.WriteLine("key - {0}|{1}={2}|Type detected={3}|install location={4}".FormatWith(key.Name, name, value.ToStringSafe(), appKey.InstallerType.ToStringSafe(), appKey.InstallLocation.ToStringSafe())); } + + //Console.WriteLine("key - {0}, name - {1}, kind - {2}, value - {3}".format_with(key.Name, name, kind, value.to_string())); + } //} } diff --git a/src/chocolatey/infrastructure.app/services/ShimGenerationService.cs b/src/chocolatey/infrastructure.app/services/ShimGenerationService.cs index eb431305ae..eb24b886a2 100644 --- a/src/chocolatey/infrastructure.app/services/ShimGenerationService.cs +++ b/src/chocolatey/infrastructure.app/services/ShimGenerationService.cs @@ -48,28 +48,28 @@ public ShimGenerationService(IFileSystem fileSystem, ICommandExecutor commandExe private void SetupShimgenArgsDictionary() { _shimGenArguments.Add("_file_path_", new ExternalCommandArgument - { - ArgumentOption = "--path=", - ArgumentValue = PathToken, - QuoteValue = true, - Required = true - }); + { + ArgumentOption = "--path=", + ArgumentValue = PathToken, + QuoteValue = true, + Required = true + }); _shimGenArguments.Add("_output_directory_", new ExternalCommandArgument - { - ArgumentOption = "--output=", - ArgumentValue = OutputToken, - QuoteValue = true, - Required = true - }); + { + ArgumentOption = "--output=", + ArgumentValue = OutputToken, + QuoteValue = true, + Required = true + }); _shimGenArguments.Add("_icon_path_", new ExternalCommandArgument - { - ArgumentOption = " --iconpath=", - ArgumentValue = IconPathToken, - QuoteValue = true, - Required = true - }); + { + ArgumentOption = " --iconpath=", + ArgumentValue = IconPathToken, + QuoteValue = true, + Required = true + }); //_shimGenArguments.Add("_gui_", new ExternalCommandArgument { ArgumentOption = "--gui", Required = false }); } diff --git a/src/chocolatey/infrastructure.app/services/TemplateService.cs b/src/chocolatey/infrastructure.app/services/TemplateService.cs index cdb464ace7..02df52e85e 100644 --- a/src/chocolatey/infrastructure.app/services/TemplateService.cs +++ b/src/chocolatey/infrastructure.app/services/TemplateService.cs @@ -198,7 +198,7 @@ public void Generate(ChocolateyConfiguration configuration) else if (_templateBinaryExtensions.Contains(fileExtension)) { this.Log().Debug(" Treating template file ('{0}') as binary instead of replacing templated values.".FormatWith(_fileSystem.GetFileName(file))); - _fileSystem.CopyFile(file, packageFileLocation, overwriteExisting:true); + _fileSystem.CopyFile(file, packageFileLocation, overwriteExisting: true); } else if (templateParameterCachePath.IsEqualTo(file)) { diff --git a/src/chocolatey/infrastructure.app/validations/GlobalConfigurationValidation.cs b/src/chocolatey/infrastructure.app/validations/GlobalConfigurationValidation.cs index 565fb42eeb..8d9ced5f7e 100644 --- a/src/chocolatey/infrastructure.app/validations/GlobalConfigurationValidation.cs +++ b/src/chocolatey/infrastructure.app/validations/GlobalConfigurationValidation.cs @@ -71,7 +71,7 @@ to enable this feature (exit code 1). ExitCode = 1 }; - var commandsToErrorOn = new List {"install", "uninstall", "upgrade"}; + var commandsToErrorOn = new List { "install", "uninstall", "upgrade" }; if (!commandsToErrorOn.Contains(config.CommandName.ToLowerInvariant())) { validationResult.Status = ValidationStatus.Warning; diff --git a/src/chocolatey/infrastructure.app/validations/SystemStateValidation.cs b/src/chocolatey/infrastructure.app/validations/SystemStateValidation.cs index 594dfe10e5..3e031abe09 100644 --- a/src/chocolatey/infrastructure.app/validations/SystemStateValidation.cs +++ b/src/chocolatey/infrastructure.app/validations/SystemStateValidation.cs @@ -62,7 +62,7 @@ private void ValidateSystemPendingReboot(ChocolateyConfiguration config, ICollec if (result) { - var commandsToErrorOn = new List {"install", "uninstall", "upgrade"}; + var commandsToErrorOn = new List { "install", "uninstall", "upgrade" }; if (!commandsToErrorOn.Contains(config.CommandName.ToLowerInvariant())) { diff --git a/src/chocolatey/infrastructure/adapters/Assembly.cs b/src/chocolatey/infrastructure/adapters/Assembly.cs index 9ad93f9a8b..be4b6c2258 100644 --- a/src/chocolatey/infrastructure/adapters/Assembly.cs +++ b/src/chocolatey/infrastructure/adapters/Assembly.cs @@ -73,12 +73,12 @@ public Type GetType(string name) public Type GetType(string name, bool throwOnError) { - return UnderlyingType.GetType(name,throwOnError); + return UnderlyingType.GetType(name, throwOnError); } public Type GetType(string name, bool throwOnError, bool ignoreCase) { - return UnderlyingType.GetType(name,throwOnError, ignoreCase); + return UnderlyingType.GetType(name, throwOnError, ignoreCase); } public Type[] GetTypes() @@ -98,7 +98,7 @@ public static IAssembly Load(byte[] rawAssembly, byte[] rawSymbols) public static IAssembly LoadFile(string path) { - return new Assembly(System.Reflection.Assembly.LoadFile(path)); + return new Assembly(System.Reflection.Assembly.LoadFile(path)); } public static IAssembly GetAssembly(Type type) diff --git a/src/chocolatey/infrastructure/adapters/Console.cs b/src/chocolatey/infrastructure/adapters/Console.cs index c2b9ff1f4d..6d601afdb5 100644 --- a/src/chocolatey/infrastructure/adapters/Console.cs +++ b/src/chocolatey/infrastructure/adapters/Console.cs @@ -429,7 +429,7 @@ private CONSOLE_SCREEN_BUFFER_INFO GetConsoleBuffer() return defaultConsoleBuffer; } - #pragma warning disable IDE1006 // naming conventions +#pragma warning disable IDE1006 // naming conventions /// /// Contains information about a console screen buffer. /// @@ -449,7 +449,7 @@ private struct CONSOLE_SCREEN_BUFFER_INFO /// A CoOrd structure that contains the maximum size of the console window, in character columns and rows, given the current screen buffer size and font and the screen size. internal COORD dwMaximumWindowSize; } - #pragma warning restore IDE1006 // naming conventions +#pragma warning restore IDE1006 // naming conventions /// /// Defines the coordinates of a character cell in a console screen buffer. diff --git a/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs b/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs index 93ec8b965f..cf4ba3c387 100644 --- a/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs +++ b/src/chocolatey/infrastructure/commandline/InteractivePrompt.cs @@ -98,7 +98,7 @@ public static string PromptForConfirmation(string prompt, IEnumerable ch foreach (var choice in choices.OrEmpty()) { choiceDictionary.Add(counter, choice); - "chocolatey".Log().Info(shortPrompt ? ChocolateyLoggers.LogFileOnly : ChocolateyLoggers.Normal," {0}) {1}{2}".FormatWith(counter, choice.ToStringSafe(), choice.IsEqualTo(defaultChoice) ? " [Default - Press Enter]" : "")); + "chocolatey".Log().Info(shortPrompt ? ChocolateyLoggers.LogFileOnly : ChocolateyLoggers.Normal, " {0}) {1}{2}".FormatWith(counter, choice.ToStringSafe(), choice.IsEqualTo(defaultChoice) ? " [Default - Press Enter]" : "")); if (shortPrompt) { var choicePrompt = choice.IsEqualTo(defaultChoice) ? @@ -107,7 +107,7 @@ public static string PromptForConfirmation(string prompt, IEnumerable ch "[{0}]".FormatWith(choice.ToUpperInvariant()) : shortPrompt ? - "[{0}]{1}".FormatWith(choice.Substring(0,1).ToUpperInvariant(), choice.Substring(1, choice.Length - 1)) : + "[{0}]{1}".FormatWith(choice.Substring(0, 1).ToUpperInvariant(), choice.Substring(1, choice.Length - 1)) : choice; if (counter != 1) diff --git a/src/chocolatey/infrastructure/commands/CommandExecutor.cs b/src/chocolatey/infrastructure/commands/CommandExecutor.cs index 36b9edb95e..79e86247da 100644 --- a/src/chocolatey/infrastructure/commands/CommandExecutor.cs +++ b/src/chocolatey/infrastructure/commands/CommandExecutor.cs @@ -97,7 +97,7 @@ bool allowUseWindow stdErrAction, updateProcessPath, allowUseWindow, - waitForExit:true + waitForExit: true ); } @@ -177,14 +177,14 @@ bool waitForExit "chocolatey".Log().Debug(() => "Calling command ['\"{0}\" {1}']".FormatWith(process.EscapeCurlyBraces(), arguments.EscapeCurlyBraces())); var psi = new ProcessStartInfo(process.UnquoteSafe(), arguments) - { - UseShellExecute = false, - WorkingDirectory = workingDirectory, - RedirectStandardOutput = true, - RedirectStandardError = true, - CreateNoWindow = !allowUseWindow, - WindowStyle = ProcessWindowStyle.Minimized, - }; + { + UseShellExecute = false, + WorkingDirectory = workingDirectory, + RedirectStandardOutput = true, + RedirectStandardError = true, + CreateNoWindow = !allowUseWindow, + WindowStyle = ProcessWindowStyle.Minimized, + }; using (var p = _initializeProcess()) { diff --git a/src/chocolatey/infrastructure/commands/Execute.cs b/src/chocolatey/infrastructure/commands/Execute.cs index 498de424b5..7e954dfa1b 100644 --- a/src/chocolatey/infrastructure/commands/Execute.cs +++ b/src/chocolatey/infrastructure/commands/Execute.cs @@ -87,7 +87,7 @@ public T Command(Func function, T timeoutDefaultValue) } cancelToken.Cancel(); - this.Log().Warn(ChocolateyLoggers.Important,() => @"Chocolatey timed out waiting for the command to finish. The timeout + this.Log().Warn(ChocolateyLoggers.Important, () => @"Chocolatey timed out waiting for the command to finish. The timeout specified (or the default value) was '{0}' seconds. Perhaps try a higher `--execution-timeout`? See `choco -h` for details.".FormatWith(_timespan.TotalSeconds)); diff --git a/src/chocolatey/infrastructure/commands/ExternalCommandArgsBuilder.cs b/src/chocolatey/infrastructure/commands/ExternalCommandArgsBuilder.cs index be6fa5c6f3..3eb695fd39 100644 --- a/src/chocolatey/infrastructure/commands/ExternalCommandArgsBuilder.cs +++ b/src/chocolatey/infrastructure/commands/ExternalCommandArgsBuilder.cs @@ -92,12 +92,12 @@ private static void FillArgsDictionary(Dictionary propertyValues var arg = configToArgNames[propName]; var propType = prop.PropertyType; var propValue = prop.GetValue(obj, null).ToStringSafe().QuoteIfContainsSpaces(); - if (propType == typeof (bool) && propValue.IsEqualTo(bool.FalseString)) + if (propType == typeof(bool) && propValue.IsEqualTo(bool.FalseString)) { continue; } - if (string.IsNullOrWhiteSpace(arg.ArgumentValue) && propType != typeof (bool)) + if (string.IsNullOrWhiteSpace(arg.ArgumentValue) && propType != typeof(bool)) { if (string.IsNullOrWhiteSpace(propValue)) { diff --git a/src/chocolatey/infrastructure/cryptography/CryptoHashProvider.cs b/src/chocolatey/infrastructure/cryptography/CryptoHashProvider.cs index 039d4717ef..31af0997ab 100644 --- a/src/chocolatey/infrastructure/cryptography/CryptoHashProvider.cs +++ b/src/chocolatey/infrastructure/cryptography/CryptoHashProvider.cs @@ -145,7 +145,7 @@ public static string ComputeStringHash(string originalText, CryptoHashProviderTy } var hash = hashAlgorithm.ComputeHash(Encoding.ASCII.GetBytes(originalText)); - return BitConverter.ToString(hash).Replace("-", string.Empty); + return BitConverter.ToString(hash).Replace("-", string.Empty); } #pragma warning disable IDE0022, IDE1006 diff --git a/src/chocolatey/infrastructure/events/EventManager.cs b/src/chocolatey/infrastructure/events/EventManager.cs index 67fa01f4a0..5b6c862359 100644 --- a/src/chocolatey/infrastructure/events/EventManager.cs +++ b/src/chocolatey/infrastructure/events/EventManager.cs @@ -87,7 +87,7 @@ public static void publish(Event message) where Event : class, IMessage [Obsolete("This overload is deprecated and will be removed in v3.")] public static IDisposable subscribe(Action handleEvent, Action handleError, Func filter) where Event : class, IMessage - => Subscribe(handleEvent,handleError, filter); + => Subscribe(handleEvent, handleError, filter); #pragma warning restore IDE0022, IDE1006 } } diff --git a/src/chocolatey/infrastructure/extractors/AssemblyFileExtractor.cs b/src/chocolatey/infrastructure/extractors/AssemblyFileExtractor.cs index e649219fc1..ea241d75ee 100644 --- a/src/chocolatey/infrastructure/extractors/AssemblyFileExtractor.cs +++ b/src/chocolatey/infrastructure/extractors/AssemblyFileExtractor.cs @@ -78,7 +78,7 @@ public static void ExtractBinaryFileFromAssembly(IFileSystem fileSystem, IAssemb fileSystem.EnsureDirectoryExists(fileSystem.GetDirectoryName(filePath)); fileSystem.WriteFile(filePath, () => assembly.GetManifestStream(manifestLocation)); }, - errorMessage:"Unable to extract binary", + errorMessage: "Unable to extract binary", throwError: throwError, logWarningInsteadOfError: false, logDebugInsteadOfError: !throwError, diff --git a/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs b/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs index d72321984b..1a3cab76f0 100644 --- a/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs +++ b/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs @@ -371,7 +371,7 @@ public void MoveFile(string filePath, string newFilePath) { MoveFile(filePath, newFilePath, isSilent: false); } - + public void MoveFile(string filePath, string newFilePath, bool isSilent) { EnsureDirectoryExists(GetDirectoryName(newFilePath), ignoreError: true); @@ -770,7 +770,7 @@ public void CopyDirectory(string sourceDirectoryPath, string destinationDirector var destinationFile = file.Replace(sourceDirectoryPath, destinationDirectoryPath); EnsureDirectoryExists(GetDirectoryName(destinationFile), ignoreError: true); //this.Log().Debug(ChocolateyLoggers.Verbose, "Copying '{0}' {1} to '{2}'".format_with(file, Environment.NewLine, destinationFile)); - + try { CopyFile(file, destinationFile, overwriteExisting, isSilent); @@ -1156,7 +1156,7 @@ public bool file_exists(string filePath) [Obsolete("This overload is deprecated and will be removed in v3.")] public string get_file_name(string filePath) - => GetFileName( filePath); + => GetFileName(filePath); [Obsolete("This overload is deprecated and will be removed in v3.")] public string get_file_name_without_extension(string filePath) diff --git a/src/chocolatey/infrastructure/information/ProcessInformation.cs b/src/chocolatey/infrastructure/information/ProcessInformation.cs index 87c2dbdff0..bb6dfb9935 100644 --- a/src/chocolatey/infrastructure/information/ProcessInformation.cs +++ b/src/chocolatey/infrastructure/information/ProcessInformation.cs @@ -143,7 +143,7 @@ public static bool UserIsRemote() public static bool UserIsSystem() { - if (Platform.GetPlatform() != PlatformType.Windows) + if (Platform.GetPlatform() != PlatformType.Windows) { return false; } diff --git a/src/chocolatey/infrastructure/information/VersionInformation.cs b/src/chocolatey/infrastructure/information/VersionInformation.cs index f3016dcb3a..95bc67e7a9 100644 --- a/src/chocolatey/infrastructure/information/VersionInformation.cs +++ b/src/chocolatey/infrastructure/information/VersionInformation.cs @@ -39,7 +39,7 @@ public static string GetCurrentAssemblyVersion(IAssembly assembly = null) if (string.IsNullOrEmpty(version)) { - var attributes= assembly.UnderlyingType.GetCustomAttributesData(); + var attributes = assembly.UnderlyingType.GetCustomAttributesData(); foreach (var attribute in attributes) { if (attribute.ToStringSafe().Contains("AssemblyFileVersion")) diff --git a/src/chocolatey/infrastructure/licensing/LicenseValidation.cs b/src/chocolatey/infrastructure/licensing/LicenseValidation.cs index abcb1347ed..40bf783fa2 100644 --- a/src/chocolatey/infrastructure/licensing/LicenseValidation.cs +++ b/src/chocolatey/infrastructure/licensing/LicenseValidation.cs @@ -58,7 +58,7 @@ public static ChocolateyLicense Validate() { "chocolatey".Log().Error(regularLogOutput ? ChocolateyLoggers.Normal : ChocolateyLoggers.LogFileOnly, @"Files found in directory '{0}' but not a valid license file. License should be named '{1}'.".FormatWith(licenseDirectory, licenseFileName)); - "chocolatey".Log().Warn(ChocolateyLoggers.Important,@" Rename license file to '{0}' to allow commercial features.".FormatWith(licenseFileName)); + "chocolatey".Log().Warn(ChocolateyLoggers.Important, @" Rename license file to '{0}' to allow commercial features.".FormatWith(licenseFileName)); } } diff --git a/src/chocolatey/infrastructure/logging/Log.cs b/src/chocolatey/infrastructure/logging/Log.cs index 1871f72f22..12f9ece27a 100644 --- a/src/chocolatey/infrastructure/logging/Log.cs +++ b/src/chocolatey/infrastructure/logging/Log.cs @@ -23,7 +23,7 @@ namespace chocolatey.infrastructure.logging /// public static class Log { - private static Type _logType = typeof (NullLog); + private static Type _logType = typeof(NullLog); private static ILog _logger; /// @@ -33,7 +33,7 @@ public static class Log /// Should other loggers be reset? public static void InitializeWith(bool resetLoggers = true) where T : ILog, new() { - _logType = typeof (T); + _logType = typeof(T); if (resetLoggers) { LogExtensions.ResetLoggers(); diff --git a/src/chocolatey/infrastructure/logging/Log4NetAppenderConfiguration.cs b/src/chocolatey/infrastructure/logging/Log4NetAppenderConfiguration.cs index 9f24d86383..40b59a74f1 100644 --- a/src/chocolatey/infrastructure/logging/Log4NetAppenderConfiguration.cs +++ b/src/chocolatey/infrastructure/logging/Log4NetAppenderConfiguration.cs @@ -210,7 +210,7 @@ private static void SetFileAppender(string outputDirectory, params string[] excl { if (excludeLoggerNames == null) { - excludeLoggerNames = new string[] {}; + excludeLoggerNames = new string[] { }; } if (!_alreadyConfiguredFileAppender) @@ -218,23 +218,23 @@ private static void SetFileAppender(string outputDirectory, params string[] excl _alreadyConfiguredFileAppender = true; var layout = new PatternLayout - { - ConversionPattern = "%date %property{pid} [%-5level] - %message%newline" - }; + { + ConversionPattern = "%date %property{pid} [%-5level] - %message%newline" + }; layout.ActivateOptions(); var app = new RollingFileAppender - { - Name = "{0}.changes.log.appender".FormatWith(ApplicationParameters.Name), - File = Path.Combine(Path.GetFullPath(outputDirectory), ApplicationParameters.LoggingFile), - Layout = layout, - AppendToFile = true, - RollingStyle = RollingFileAppender.RollingMode.Size, - MaxFileSize = 1024 * 1024 * 10, - MaxSizeRollBackups = 50, - LockingModel = new FileAppender.MinimalLock(), - PreserveLogFileNameExtension = true, - }; + { + Name = "{0}.changes.log.appender".FormatWith(ApplicationParameters.Name), + File = Path.Combine(Path.GetFullPath(outputDirectory), ApplicationParameters.LoggingFile), + Layout = layout, + AppendToFile = true, + RollingStyle = RollingFileAppender.RollingMode.Size, + MaxFileSize = 1024 * 1024 * 10, + MaxSizeRollBackups = 50, + LockingModel = new FileAppender.MinimalLock(), + PreserveLogFileNameExtension = true, + }; app.ActivateOptions(); var infoOnlyAppender = new RollingFileAppender diff --git a/src/chocolatey/infrastructure/logging/TraceLog.cs b/src/chocolatey/infrastructure/logging/TraceLog.cs index abe1c2c86e..e44b306716 100644 --- a/src/chocolatey/infrastructure/logging/TraceLog.cs +++ b/src/chocolatey/infrastructure/logging/TraceLog.cs @@ -83,7 +83,7 @@ private void EnableNetworkLogging() EnableTraceSource("s_CacheTraceSource", logging, this); //System.Net.Cache var isEnabled = logging.GetField("s_LoggingEnabled", BindingFlags.NonPublic | BindingFlags.Static); - if (isEnabled !=null) + if (isEnabled != null) { isEnabled.SetValue(null, true); } diff --git a/src/chocolatey/infrastructure/powershell/PoshHostRawUserInterface.cs b/src/chocolatey/infrastructure/powershell/PoshHostRawUserInterface.cs index 1be44f29a7..e60e7ecaae 100644 --- a/src/chocolatey/infrastructure/powershell/PoshHostRawUserInterface.cs +++ b/src/chocolatey/infrastructure/powershell/PoshHostRawUserInterface.cs @@ -67,7 +67,8 @@ public override Size MaxWindowSize get { return new Size(Console.LargestWindowWidth, Console.LargestWindowHeight); } } - public override Coordinates WindowPosition { + public override Coordinates WindowPosition + { get { return new Coordinates(Console.WindowLeft, Console.WindowTop); } set { Console.SetWindowPosition(value.X, value.Y); } } diff --git a/src/chocolatey/infrastructure/registration/AssemblyResolution.cs b/src/chocolatey/infrastructure/registration/AssemblyResolution.cs index 8a4c608021..1d3129871a 100644 --- a/src/chocolatey/infrastructure/registration/AssemblyResolution.cs +++ b/src/chocolatey/infrastructure/registration/AssemblyResolution.cs @@ -43,7 +43,8 @@ public class AssemblyResolution /// The assembly file location. Typically the path to the DLL on disk. /// An assembly /// Unable to enter synchronized code to determine assembly loading - public static IAssembly ResolveOrLoadAssembly(string assemblySimpleName, string publicKeyToken, string assemblyFileLocation) { + public static IAssembly ResolveOrLoadAssembly(string assemblySimpleName, string publicKeyToken, string assemblyFileLocation) + { return ResolveOrLoadAssembly(assemblySimpleName, publicKeyToken, assemblyFileLocation, false); } diff --git a/src/chocolatey/infrastructure/registration/Bootstrap.cs b/src/chocolatey/infrastructure/registration/Bootstrap.cs index feff791c8b..c3412b8e09 100644 --- a/src/chocolatey/infrastructure/registration/Bootstrap.cs +++ b/src/chocolatey/infrastructure/registration/Bootstrap.cs @@ -27,7 +27,7 @@ namespace chocolatey.infrastructure.registration /// public sealed class Bootstrap { - private static readonly ILog _logger = LogManager.GetLogger(typeof (Bootstrap)); + private static readonly ILog _logger = LogManager.GetLogger(typeof(Bootstrap)); /// /// Initializes this instance. @@ -55,7 +55,7 @@ public static void Startup() /// // ReSharper disable InconsistentNaming private static void DomainUnhandledException(object sender, UnhandledExceptionEventArgs e) -// ReSharper restore InconsistentNaming + // ReSharper restore InconsistentNaming { var ex = e.ExceptionObject as Exception; var exceptionMessage = string.Empty; diff --git a/src/chocolatey/infrastructure/registration/HttpsSecurity.cs b/src/chocolatey/infrastructure/registration/HttpsSecurity.cs index 033d3435b6..fd0f2cb2df 100644 --- a/src/chocolatey/infrastructure/registration/HttpsSecurity.cs +++ b/src/chocolatey/infrastructure/registration/HttpsSecurity.cs @@ -3,61 +3,61 @@ using System.Linq; using System.Net; using System.Text; -using System.Threading.Tasks; +using System.Threading.Tasks; -namespace chocolatey.infrastructure.registration -{ - public static class HttpsSecurity - { - /// - /// Resets the and for HTTPS connections - /// in order to ensure that PowerShell scripts we run can't have a persistent effect on these settings across the whole process after they're done running. - /// - public static void Reset() - { - // SystemDefault is used because: - // 1. Most supported operating systems default to / require TLS 1.2 anyway. - // 2. Explicitly *enabling* any less secure protocols leaves us open to TLS downgrade attacks. - // https://en.wikipedia.org/wiki/Downgrade_attack - // 3. Always *requiring* TLS 1.2 or higher on any OS version may cause issues with some folks' internal - // networks which may have older infrastructure that doesn't support it, and they won't have a way - // to make Chocolately CLI work with that infrastructure if we're forcing a TLS version they can't - // support. - // 4. Thus, the only sensible solution (since we don't want to add a configuration value for this) is - // to take the OS-level setting and use that, because if folks set their system up to use certain - // TLS versions, we should probably follow suit, regardless of what their OS version may be. - // - // See https://learn.microsoft.com/en-us/dotnet/framework/network-programming/tls for more information - // and best practices recommendation from the .NET team. - if (ServicePointManager.SecurityProtocol != SecurityProtocolType.SystemDefault) - { - "chocolatey".Log().Warn( - "{0} was set to {1}, resetting to SystemDefault.", - nameof(ServicePointManager.SecurityProtocol), - ServicePointManager.SecurityProtocol); - - ServicePointManager.SecurityProtocol = SecurityProtocolType.SystemDefault; - } - - try - { - // We reset this to ensure that if a package overrides this callback during its script runs, it doesn't affect the rest of - // the actions we need to take for the duration of this process (other packages we're installing, etc.) Setting this to - // null restores the default behaviour of certificate validation instead of whatever custom behaviour has been injected. - if (ServicePointManager.ServerCertificateValidationCallback != null) - { - "chocolatey".Log().Warn( - "{0} was set to '{1}' Removing.", - nameof(ServicePointManager.ServerCertificateValidationCallback), - ServicePointManager.ServerCertificateValidationCallback); - - ServicePointManager.ServerCertificateValidationCallback = null; - } - } - catch (Exception ex) - { - "chocolatey".Log().Warn("Error resetting ServerCertificateValidationCallback: {0}".FormatWith(ex.Message)); - } - } - } -} +namespace chocolatey.infrastructure.registration +{ + public static class HttpsSecurity + { + /// + /// Resets the and for HTTPS connections + /// in order to ensure that PowerShell scripts we run can't have a persistent effect on these settings across the whole process after they're done running. + /// + public static void Reset() + { + // SystemDefault is used because: + // 1. Most supported operating systems default to / require TLS 1.2 anyway. + // 2. Explicitly *enabling* any less secure protocols leaves us open to TLS downgrade attacks. + // https://en.wikipedia.org/wiki/Downgrade_attack + // 3. Always *requiring* TLS 1.2 or higher on any OS version may cause issues with some folks' internal + // networks which may have older infrastructure that doesn't support it, and they won't have a way + // to make Chocolately CLI work with that infrastructure if we're forcing a TLS version they can't + // support. + // 4. Thus, the only sensible solution (since we don't want to add a configuration value for this) is + // to take the OS-level setting and use that, because if folks set their system up to use certain + // TLS versions, we should probably follow suit, regardless of what their OS version may be. + // + // See https://learn.microsoft.com/en-us/dotnet/framework/network-programming/tls for more information + // and best practices recommendation from the .NET team. + if (ServicePointManager.SecurityProtocol != SecurityProtocolType.SystemDefault) + { + "chocolatey".Log().Warn( + "{0} was set to {1}, resetting to SystemDefault.", + nameof(ServicePointManager.SecurityProtocol), + ServicePointManager.SecurityProtocol); + + ServicePointManager.SecurityProtocol = SecurityProtocolType.SystemDefault; + } + + try + { + // We reset this to ensure that if a package overrides this callback during its script runs, it doesn't affect the rest of + // the actions we need to take for the duration of this process (other packages we're installing, etc.) Setting this to + // null restores the default behaviour of certificate validation instead of whatever custom behaviour has been injected. + if (ServicePointManager.ServerCertificateValidationCallback != null) + { + "chocolatey".Log().Warn( + "{0} was set to '{1}' Removing.", + nameof(ServicePointManager.ServerCertificateValidationCallback), + ServicePointManager.ServerCertificateValidationCallback); + + ServicePointManager.ServerCertificateValidationCallback = null; + } + } + catch (Exception ex) + { + "chocolatey".Log().Warn("Error resetting ServerCertificateValidationCallback: {0}".FormatWith(ex.Message)); + } + } + } +} diff --git a/src/chocolatey/infrastructure/results/PackageResult.cs b/src/chocolatey/infrastructure/results/PackageResult.cs index 06a0a612e5..fc098974f0 100644 --- a/src/chocolatey/infrastructure/results/PackageResult.cs +++ b/src/chocolatey/infrastructure/results/PackageResult.cs @@ -135,7 +135,7 @@ public PackageResult(string name, string version, string installLocation, string public PackageIdentity Identity { - get { return new PackageIdentity(Name, NuGetVersion.Parse(Version)); } + get { return new PackageIdentity(Name, NuGetVersion.Parse(Version)); } } } } diff --git a/src/chocolatey/infrastructure/services/EventSubscriptionManagerService.cs b/src/chocolatey/infrastructure/services/EventSubscriptionManagerService.cs index 8c2703b26a..5dba4c278a 100644 --- a/src/chocolatey/infrastructure/services/EventSubscriptionManagerService.cs +++ b/src/chocolatey/infrastructure/services/EventSubscriptionManagerService.cs @@ -37,7 +37,7 @@ public void Publish(Event eventMessage) where Event : class, IMessage { Ensure.That(() => eventMessage).NotNull(); - this.Log().Debug(ChocolateyLoggers.Verbose, () => "Sending message '{0}' out if there are subscribers...".FormatWith(typeof (Event).Name)); + this.Log().Debug(ChocolateyLoggers.Verbose, () => "Sending message '{0}' out if there are subscribers...".FormatWith(typeof(Event).Name)); _subject.OnNext(eventMessage); } diff --git a/src/chocolatey/infrastructure/services/XmlService.cs b/src/chocolatey/infrastructure/services/XmlService.cs index 385a8d7934..5323fedb0d 100644 --- a/src/chocolatey/infrastructure/services/XmlService.cs +++ b/src/chocolatey/infrastructure/services/XmlService.cs @@ -149,7 +149,8 @@ public void Serialize(XmlType xmlType, string xmlFilePath, bool isSilen { AutoFlush = true } - ){ + ) + { xmlSerializer.Serialize(streamWriter, xmlType); streamWriter.Flush(); diff --git a/src/chocolatey/infrastructure/tolerance/FaultTolerance.cs b/src/chocolatey/infrastructure/tolerance/FaultTolerance.cs index 906e37af9d..438daa1d96 100644 --- a/src/chocolatey/infrastructure/tolerance/FaultTolerance.cs +++ b/src/chocolatey/infrastructure/tolerance/FaultTolerance.cs @@ -115,7 +115,7 @@ public static T Retry(int numberOfTries, Func function, int waitDurationMi throw; } - var retryWait = waitDurationMilliseconds + (i*increaseRetryByMilliseconds); + var retryWait = waitDurationMilliseconds + (i * increaseRetryByMilliseconds); var exceptionMessage = debugging ? ex.ToString() : ex.Message;