Adding analyzer project

Contains two analyzers with fixes

* Use AnsiConsole over System.Console
* Favor local instance over static implementation
This commit is contained in:
Phil Scott
2021-06-20 19:47:19 -04:00
committed by Patrik Svensson
parent d015a4966f
commit 4f293d887d
20 changed files with 974 additions and 0 deletions

View File

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\src\Spectre.Console\Spectre.Console.csproj" />
<ProjectReference Include="..\..\..\src\Spectre.Console.Analyzer\Spectre.Console.Analyzer.csproj"
PrivateAssets="all"
ReferenceOutputAssembly="false"
OutputItemType="Analyzer" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,32 @@
using Spectre.Console;
namespace AnalyzerTester
{
class Program
{
static void Main(string[] args)
{
AnsiConsole.WriteLine("Hello World!");
}
}
class Dependency
{
private readonly IAnsiConsole _ansiConsole;
public Dependency(IAnsiConsole ansiConsole)
{
_ansiConsole = ansiConsole;
}
public void DoIt()
{
_ansiConsole.WriteLine("Hey mom!");
}
public void DoIt(IAnsiConsole thisConsole)
{
thisConsole.WriteLine("Hey mom!");
}
}
}