Skip to content

Commit

Permalink
Merge pull request #3417 from vexx32/editorconfig-update
Browse files Browse the repository at this point in the history
Update editorconfig & fix warnings and errors appropriately
  • Loading branch information
gep13 authored Apr 16, 2024
2 parents 1ee1b82 + 8d2425c commit ff13a5d
Show file tree
Hide file tree
Showing 317 changed files with 6,163 additions and 4,162 deletions.
71 changes: 38 additions & 33 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ####
Expand Down Expand Up @@ -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
73 changes: 41 additions & 32 deletions src/chocolatey.console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -58,9 +58,12 @@ 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)) Directory.CreateDirectory(loggingLocation);
if (!Directory.Exists(loggingLocation))
{
Directory.CreateDirectory(loggingLocation);
}

Log4NetAppenderConfiguration.Configure(loggingLocation, excludeLoggerNames: ChocolateyLoggers.Trace.ToStringSafe());
Bootstrap.Initialize();
Expand Down Expand Up @@ -107,7 +110,7 @@ private static void Main(string[] args)

ReportVersionAndExitIfRequested(args, config);

TrapExitScenarios(config);
TrapExitScenarios();

if (config.RegularOutput)
{
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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"))
Expand All @@ -240,7 +249,7 @@ private static void ReportVersionAndExitIfRequested(string[] args, ChocolateyCon
}
}

private static void TrapExitScenarios(ChocolateyConfiguration config)
private static void TrapExitScenarios()
{
ExitScenarioHandler.SetHandler();
}
Expand Down
1 change: 1 addition & 0 deletions src/chocolatey.console/chocolatey.console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
Expand Down
1 change: 1 addition & 0 deletions src/chocolatey.resources/chocolatey.resources.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
20 changes: 10 additions & 10 deletions src/chocolatey.tests.integration/MockEventSubscriptionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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>, IEventSubscriptionManagerService
{
private readonly Lazy<ConcurrentDictionary<Type, IList<object>>> _messages = new Lazy<ConcurrentDictionary<Type, IList<object>>>();
Expand All @@ -45,14 +45,14 @@ public IDisposable Subscribe<Event>(Action<Event> handleEvent, Action<Exception>
return new Subject<Event>();
}

#pragma warning disable IDE1006
#pragma warning disable IDE0022, IDE1006
[Obsolete("This overload is deprecated and will be removed in v3.")]
public void publish<Event>(Event eventMessage) where Event : class, IMessage
=> Publish(eventMessage);

[Obsolete("This overload is deprecated and will be removed in v3.")]
public IDisposable subscribe<Event>(Action<Event> handleEvent, Action<Exception> handleError, Func<Event, bool> filter) where Event : class, IMessage
=> Subscribe(handleEvent, handleError, filter);
#pragma warning disable IDE1006
#pragma warning disable IDE0022, IDE1006
}
}
33 changes: 16 additions & 17 deletions src/chocolatey.tests.integration/NUnitSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
44 changes: 22 additions & 22 deletions src/chocolatey.tests.integration/Scenario.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -56,11 +56,11 @@ public static IEnumerable<string> 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);
Expand Down
Loading

0 comments on commit ff13a5d

Please sign in to comment.