Skip to content

Commit

Permalink
(GH-785) Fix stylecop and dupfinder errors
Browse files Browse the repository at this point in the history
Had to introduce a region to exclude certain repeated sections of code.
  • Loading branch information
gep13 committed Jul 13, 2020
1 parent b5d7a72 commit 027bb1c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Source/ChocolateyGui.Common.Windows/Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ namespace ChocolateyGui.Common.Windows
{
public class Bootstrapper : BootstrapperBase
{
private static readonly IFileSystem _fileSystem = new DotNetFileSystem();

public static readonly string ChocolateyGuiInstallLocation = _fileSystem.get_directory_name(_fileSystem.get_current_assembly_path());
public static readonly string ChocolateyInstallEnvironmentVariableName = "ChocolateyInstall";
public static readonly string ChocolateyInstallLocation = System.Environment.GetEnvironmentVariable(ChocolateyInstallEnvironmentVariableName) ?? _fileSystem.get_directory_name(_fileSystem.get_current_assembly_path());
Expand All @@ -53,6 +51,8 @@ public class Bootstrapper : BootstrapperBase

public static readonly string LicensedChocolateyGuiAssemblySimpleName = "chocolateygui.licensed";

private static readonly IFileSystem _fileSystem = new DotNetFileSystem();

public Bootstrapper()
{
Initialize();
Expand Down
2 changes: 2 additions & 0 deletions Source/ChocolateyGui/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public partial class App
{
private static readonly App _application = new App();

#region DupFinder Exclusion
public App()
{
AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
Expand Down Expand Up @@ -67,6 +68,7 @@ public App()

InitializeComponent();
}
#endregion

internal static SplashScreen SplashScreen { get; set; }

Expand Down
4 changes: 2 additions & 2 deletions Source/ChocolateyGuiCli/Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ namespace ChocolateyGuiCli
{
public static class Bootstrapper
{
private static readonly IFileSystem _fileSystem = new DotNetFileSystem();

public static readonly string ChocolateyGuiInstallLocation = _fileSystem.get_directory_name(_fileSystem.get_current_assembly_path());
public static readonly string ChocolateyInstallEnvironmentVariableName = "ChocolateyInstall";
public static readonly string ChocolateyInstallLocation = System.Environment.GetEnvironmentVariable(ChocolateyInstallEnvironmentVariableName) ?? _fileSystem.get_directory_name(_fileSystem.get_current_assembly_path());
Expand All @@ -38,6 +36,8 @@ public static class Bootstrapper

public static readonly string LicensedChocolateyGuiAssemblySimpleName = "chocolateygui.licensed";

private static readonly IFileSystem _fileSystem = new DotNetFileSystem();

internal static ILogger Logger { get; private set; }

internal static IContainer Container { get; private set; }
Expand Down
2 changes: 2 additions & 0 deletions Source/ChocolateyGuiCli/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public static void Main(string[] args)
});
}

#region DupFinder Exclusion
private static void AddAssemblyResolver()
{
_handler = (sender, args) =>
Expand Down Expand Up @@ -137,6 +138,7 @@ private static void AddAssemblyResolver()

AppDomain.CurrentDomain.AssemblyResolve += _handler;
}
#endregion

private static void SetUpGlobalOptions(IList<string> args, ChocolateyGuiConfiguration configuration, IContainer container)
{
Expand Down
7 changes: 4 additions & 3 deletions Source/ChocolateyGuiRules.ruleset
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="ChocoolateyGUI Rules" Description="This rule set contains all rules. Running this rule set may result in a large number of warnings being reported. Use this rule set to get a comprehensive picture of all issues in your code. This can help you decide which of the more focused rule sets are most appropriate to run for your projects." ToolsVersion="14.0">
<IncludeAll Action="Warning" />
<RuleSet Name="ChocoolateyGUI Rules" Description="This rule set contains all rules. Running this rule set may result in a large number of warnings being reported. Use this rule set to get a comprehensive picture of all issues in your code. This can help you decide which of the more focused rule sets are most appropriate to run for your projects." ToolsVersion="16.0">
<IncludeAll Action="Warning" />
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<Rule Id="SA1101" Action="None" />
<Rule Id="SA1118" Action="None" />
<Rule Id="SA1124" Action="None" />
<Rule Id="SA1200" Action="None" />
<Rule Id="SA1309" Action="None" />
<Rule Id="SA1652" Action="None" />
<Rule Id="SA1118" Action="None" />
</Rules>
</RuleSet>

0 comments on commit 027bb1c

Please sign in to comment.