Introduce code analysis, clean up code to comply

This commit is contained in:
Yaakov 2020-05-23 23:55:51 +10:00
parent 895ef8c01e
commit 1116c4b54c
12 changed files with 231 additions and 42 deletions

View file

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
@ -6,8 +6,20 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.4" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.1.4" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="WTG.Analyzers" Version="2.10.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>

View file

@ -6,13 +6,13 @@ namespace Notepad.Extensions.Logging.FunctionalTest
{
class Program
{
static void Main(string[] args)
static void Main()
{
var sc = new ServiceCollection();
sc.AddLogging(lb =>
{
lb.AddConsole();
lb.AddNotepad();
lb.AddNotepad(o => o.WindowName = "mylog - Notepad++");
});
var sp = sc.BuildServiceProvider();
@ -29,7 +29,7 @@ namespace Notepad.Extensions.Logging.FunctionalTest
{
throw new InvalidOperationException("Wheeeeeeee");
}
catch (Exception ex)
catch (InvalidOperationException ex)
{
return ex;
}