mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-16 02:09:20 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
29 lines
785 B
C#
29 lines
785 B
C#
namespace Sandbox.CodeUpgrader;
|
|
|
|
public interface IAnalyzerTest
|
|
{
|
|
public Task TestWithMarkup( string code );
|
|
}
|
|
|
|
/// <summary>
|
|
/// Wraps DiagnosticAnalyzer to make it less of a pain in the ass
|
|
/// </summary>
|
|
public abstract partial class Analyzer : DiagnosticAnalyzer
|
|
{
|
|
public virtual DiagnosticDescriptor Rule { get; }
|
|
|
|
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create( Rule );
|
|
|
|
public sealed override void Initialize( AnalysisContext context )
|
|
{
|
|
context.ConfigureGeneratedCodeAnalysis( GeneratedCodeAnalysisFlags.Analyze );
|
|
context.EnableConcurrentExecution();
|
|
|
|
Init( context );
|
|
}
|
|
|
|
public virtual void Init( AnalysisContext context ) { }
|
|
|
|
public virtual Task RunTests( IAnalyzerTest tester ) => Task.CompletedTask;
|
|
}
|