Skip to content

Commit

Permalink
Add analyzer and removed stylecop warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
C1rdec committed Apr 26, 2020
1 parent 51e8355 commit 2005055
Show file tree
Hide file tree
Showing 91 changed files with 1,208 additions and 835 deletions.
3 changes: 3 additions & 0 deletions Lurker.sln
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{AE09C520-0052-4684-8E87-4E41784AA544}"
ProjectSection(SolutionItems) = preProject
appveyor.yml = appveyor.yml
PoeLurker.ruleset = PoeLurker.ruleset
stylecop.json = stylecop.json
XpertdocVsPowerTools-Settings.json = XpertdocVsPowerTools-Settings.json
EndProjectSection
EndProject
Global
Expand Down
23 changes: 23 additions & 0 deletions PoeLurker.ruleset
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Rules for PoeLurker" Description="Code analysis rules for Poe Lurker." ToolsVersion="16.0">
<Include Path="packages\microsoft.codeanalysis.fxcopanalyzers.2.6.3\rulesets\allrulesenabled.ruleset" Action="Default" />
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp.Features" RuleNamespace="Microsoft.CodeAnalysis.CSharp.Features">
<Rule Id="IDE0003" Action="None" />
</Rules>
<Rules AnalyzerId="RefactoringEssentials" RuleNamespace="RefactoringEssentials">
<Rule Id="RECS0129" Action="None" />
<Rule Id="RECS0145" Action="None" />
</Rules>
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<Rule Id="SA1114" Action="None" />
<Rule Id="SA1118" Action="None" />
<Rule Id="SA1124" Action="None" />
<Rule Id="SA1201" Action="None" />
<Rule Id="SA1202" Action="None" />
<Rule Id="SA1309" Action="None" />
<Rule Id="SA1610" Action="None" />
<Rule Id="SA1644" Action="Warning" />
<Rule Id="SX1309" Action="Warning" />
<Rule Id="SX1309S" Action="Warning" />
</Rules>
</RuleSet>
22 changes: 22 additions & 0 deletions XpertdocVsPowerTools-Settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"CodeElementSettings": {
"Enabled": false,
"MoveUsingsOnItemAdded": true,
"MoveUsingsOnItemOpened": true
},
"FileHeaderSettings": {
"CompanyName": "Wohs Inc.",
"Enabled": true,
"WriteHeaderOnItemAdded": true,
"WriteHeaderOnItemOpened": true,
"WriteHeaderOnItemRenamed": true
},
"LoggingSettings": {
"Enabled": true
},
"ProjectSettings": {
"ConfigurePowerToolsOnProjectAdded": false,
"ConfigureSigningOnProjectAdded": false,
"Enabled": false
}
}
4 changes: 2 additions & 2 deletions src/Lurker.Console/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//-----------------------------------------------------------------------
// <copyright file="Program.cs" company="Wohs">
// Missing Copyright information from a valid stylecop.json file.
// <copyright file="Program.cs" company="Wohs Inc.">
// Copyright © Wohs Inc.
// </copyright>
//-----------------------------------------------------------------------

Expand Down
11 changes: 7 additions & 4 deletions src/Lurker.UI/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//-----------------------------------------------------------------------
// <copyright file="App.xaml.cs" company="Wohs">
// Missing Copyright information from a valid stylecop.json file.
// <copyright file="App.xaml.cs" company="Wohs Inc.">
// Copyright © Wohs Inc.
// </copyright>
//-----------------------------------------------------------------------

Expand All @@ -9,13 +9,16 @@ namespace Lurker.UI
using System.Windows;

/// <summary>
/// Interaction logic for App.xaml
/// Interaction logic for App.xaml.
/// </summary>
public partial class App : Application
{
/// <summary>
/// Initializes a new instance of the <see cref="App"/> class.
/// </summary>
public App()
{
this.InitializeComponent();
}
}
}
}
48 changes: 25 additions & 23 deletions src/Lurker.UI/AppBootstrapper.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
//-----------------------------------------------------------------------
// <copyright file="AppBootstrapper.cs" company="Wohs">
// Missing Copyright information from a valid stylecop.json file.
// <copyright file="AppBootstrapper.cs" company="Wohs Inc.">
// Copyright © Wohs Inc.
// </copyright>
//-----------------------------------------------------------------------

namespace Lurker.UI
{
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Caliburn.Micro;
using Lurker.Helpers;
using Lurker.Extensions;
using Lurker.Services;
using Lurker.UI.Helpers;
using Lurker.UI.Services;
using Lurker.UI.ViewModels;
using Sentry;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Security.Principal;
using Lurker.UI.Services;

public class AppBootstrapper : BootstrapperBase
/// <summary>
/// Represents AppBootstrapper.
/// </summary>
/// <seealso cref="Caliburn.Micro.BootstrapperBase" />
public class AppBootstrapper : BootstrapperBase
{
#region Fields

Expand All @@ -35,7 +37,7 @@ public class AppBootstrapper : BootstrapperBase
/// <summary>
/// Initializes a new instance of the <see cref="AppBootstrapper"/> class.
/// </summary>
public AppBootstrapper()
public AppBootstrapper()
{
AppDomain.CurrentDomain.UnhandledException += this.CurrentDomain_UnhandledException;
this.Initialize();
Expand All @@ -48,7 +50,7 @@ public AppBootstrapper()
/// <summary>
/// Override to configure the framework and setup your IoC container.
/// </summary>
protected override void Configure()
protected override void Configure()
{
this._container = new SimpleContainer();

Expand All @@ -59,13 +61,13 @@ protected override void Configure()
this._container.Singleton<CollaborationService, CollaborationService>();
this._container.Singleton<SettingsViewModel, SettingsViewModel>();
this._container.Singleton<DashboardViewModel, DashboardViewModel>();

this._container.PerRequest<AfkService, AfkService>();
this._container.PerRequest<UpdateManager, UpdateManager>();
this._container.PerRequest<ShellViewModel, ShellViewModel>();
this._container.PerRequest<ShellViewModel, ShellViewModel>();
this._container.PerRequest<TradebarViewModel, TradebarViewModel>();
this._container.PerRequest<OutgoingbarViewModel, OutgoingbarViewModel>();
this._container.PerRequest<LifeBulbViewModel, LifeBulbViewModel>();
this._container.PerRequest<LifeBulbViewModel, LifeBulbViewModel>();
this._container.PerRequest<ManaBulbViewModel, ManaBulbViewModel>();
this._container.RegisterInstance(typeof(SimpleContainer), null, this._container);
}
Expand All @@ -78,19 +80,19 @@ protected override void Configure()
/// <returns>
/// The located service.
/// </returns>
protected override object GetInstance(Type service, string key)
protected override object GetInstance(Type service, string key)
{
return this._container.GetInstance(service, key);
}

/// <summary>
/// Override this to provide an IoC specific implementation
/// Override this to provide an IoC specific implementation.
/// </summary>
/// <param name="service">The service to locate.</param>
/// <returns>
/// The located services.
/// </returns>
protected override IEnumerable<object> GetAllInstances(Type service)
protected override IEnumerable<object> GetAllInstances(Type service)
{
return this._container.GetAllInstances(service);
}
Expand All @@ -99,7 +101,7 @@ protected override IEnumerable<object> GetAllInstances(Type service)
/// Override this to provide an IoC specific implementation.
/// </summary>
/// <param name="instance">The instance to perform injection on.</param>
protected override void BuildUp(object instance)
protected override void BuildUp(object instance)
{
this._container.BuildUp(instance);
}
Expand All @@ -109,7 +111,7 @@ protected override void BuildUp(object instance)
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The args.</param>
protected override void OnStartup(object sender, System.Windows.StartupEventArgs e)
protected override void OnStartup(object sender, System.Windows.StartupEventArgs e)
{
var settings = this._container.GetInstance<SettingsService>();
this._sentry = SentrySdk.Init(Dsn);
Expand All @@ -128,7 +130,7 @@ protected override void OnStartup(object sender, System.Windows.StartupEventArgs
return;
}

DisplayRootViewFor<ShellViewModel>();
this.DisplayRootViewFor<ShellViewModel>();
}

/// <summary>
Expand All @@ -145,7 +147,7 @@ protected override void OnExit(object sender, EventArgs e)
/// <summary>
/// Runnings the instance.
/// </summary>
/// <returns>The other running instance</returns>
/// <returns>The other running instance.</returns>
public static Process RunningInstance()
{
var currentProcess = Process.GetCurrentProcess();
Expand Down Expand Up @@ -180,10 +182,10 @@ public static Process RunningInstance()
/// <param name="e">The <see cref="UnhandledExceptionEventArgs"/> instance containing the event data.</param>
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
var exception = (e.ExceptionObject as Exception);
var exception = e.ExceptionObject as Exception;
Logger.Error(exception, exception.Message);

#if (!DEBUG)
#if !DEBUG
SentrySdk.CaptureException(exception);
#endif
this._sentry.Dispose();
Expand Down
15 changes: 10 additions & 5 deletions src/Lurker.UI/Converters/CurrencyTypeConverter.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
//-----------------------------------------------------------------------
// <copyright file="CurrencyTypeConverter.cs" company="Wohs">
// Missing Copyright information from a valid stylecop.json file.
// <copyright file="CurrencyTypeConverter.cs" company="Wohs Inc.">
// Copyright © Wohs Inc.
// </copyright>
//-----------------------------------------------------------------------

namespace Lurker.UI.Converters
{
using Lurker.Patreon.Models;
using System;
using System.Windows.Data;
using System.Windows.Markup;
using Lurker.Patreon.Models;

/// <summary>
/// CurrencyType converter.
/// </summary>
/// <seealso cref="System.Windows.Markup.MarkupExtension" />
/// <seealso cref="System.Windows.Data.IValueConverter" />
public class CurrencyTypeConverter : MarkupExtension, IValueConverter
{
#region Declarations
Expand All @@ -22,7 +27,7 @@ public class CurrencyTypeConverter : MarkupExtension, IValueConverter
#region Constructors

/// <summary>
/// Initializes a new instance of the <see cref="OperationStatusConverter"/> class.
/// Initializes a new instance of the <see cref="CurrencyTypeConverter"/> class.
/// </summary>
public CurrencyTypeConverter()
{
Expand Down Expand Up @@ -79,4 +84,4 @@ public object ConvertBack(object value, Type targetType, object parameter, Syste

#endregion
}
}
}
26 changes: 19 additions & 7 deletions src/Lurker.UI/Extensions/PriceExtension.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
//-----------------------------------------------------------------------
// <copyright file="PriceExtension.cs" company="Wohs">
// Missing Copyright information from a valid stylecop.json file.
// <copyright file="PriceExtension.cs" company="Wohs Inc.">
// Copyright © Wohs Inc.
// </copyright>
//-----------------------------------------------------------------------

using Lurker.Patreon.Models;

namespace Lurker.UI.Extensions
{
using Lurker.Patreon.Models;

/// <summary>
/// Represents the price extensions.
/// </summary>
public static class PriceExtension
{
#region Methods

/// <summary>
/// Calculates the value.
/// </summary>
/// <param name="value">The value.</param>
/// <returns>The value in chaos.</returns>
public static double CalculateValue(this Price value)
{
double ratio = 1;
Expand All @@ -33,9 +43,11 @@ public static double CalculateValue(this Price value)
case CurrencyType.Chromatic:
ratio = 0.15;
break;

}
return value.NumberOfCurrencies * ratio;;

return value.NumberOfCurrencies * ratio;
}

#endregion
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//-----------------------------------------------------------------------
// <copyright file="AdminRequestHeleper.cs" company="Wohs">
// Missing Copyright information from a valid stylecop.json file.
// <copyright file="AdminRequestHelper.cs" company="Wohs Inc.">
// Copyright © Wohs Inc.
// </copyright>
//-----------------------------------------------------------------------

Expand All @@ -9,6 +9,9 @@ namespace Lurker.UI.Helpers
using System.Diagnostics;
using System.Security.Principal;

/// <summary>
/// Represents the admin request helper.
/// </summary>
public static class AdminRequestHelper
{
#region Methods
Expand Down Expand Up @@ -46,4 +49,4 @@ private static bool IsAdministrator()

#endregion
}
}
}
Loading

0 comments on commit 2005055

Please sign in to comment.