Files
sbox-public/engine/Sandbox.CodeUpgrader/Helpers/Analyzer.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

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;
}