mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-11-04 02:25:28 +08:00 
			
		
		
		
	Adding analyzer project
Contains two analyzers with fixes * Use AnsiConsole over System.Console * Favor local instance over static implementation
This commit is contained in:
		
				
					committed by
					
						
						Patrik Svensson
					
				
			
			
				
	
			
			
			
						parent
						
							d015a4966f
						
					
				
				
					commit
					4f293d887d
				
			
							
								
								
									
										16
									
								
								examples/Console/AnalyzerTester/AnalyzerTester.csproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								examples/Console/AnalyzerTester/AnalyzerTester.csproj
									
									
									
									
									
										Normal 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>
 | 
			
		||||
							
								
								
									
										32
									
								
								examples/Console/AnalyzerTester/Program.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								examples/Console/AnalyzerTester/Program.cs
									
									
									
									
									
										Normal 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!");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user