提交 77fae0f1 编写于 作者: S Sam Harwell

Fix violations of RS1025 (Configure generated code analysis)

上级 22286daa
......@@ -32,6 +32,9 @@
<!-- DiagnosticId must be unique across analyzers - suppress for non-shipping/test projects -->
<Rule Id="RS1019" Action="None" />
<!-- Configure generated code analysis - suppress for non-shipping/test projects -->
<Rule Id="RS1025" Action="None" />
<!-- Do not use generic CodeAction.Create to create CodeAction - not useful for tests -->
<Rule Id="RS0005" Action="None" />
</Rules>
......
......@@ -35,6 +35,8 @@ public sealed override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics
public sealed override void Initialize(AnalysisContext context)
{
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics);
context.RegisterCompilationStartAction(c =>
{
var analyzer = new CompilationAnalyzer(c.Compilation);
......
......@@ -27,7 +27,11 @@ public bool OpenFileOnly(Workspace workspace)
=> true;
public override void Initialize(AnalysisContext context)
=> context.RegisterSyntaxTreeAction(AnalyzeSyntaxTree);
{
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics);
context.RegisterSyntaxTreeAction(AnalyzeSyntaxTree);
}
private void AnalyzeSyntaxTree(SyntaxTreeAnalysisContext context)
{
......
......@@ -20,7 +20,9 @@ internal abstract class DocumentDiagnosticAnalyzer : DiagnosticAnalyzer
/// <summary>
/// it is not allowed one to implement both DocumentDiagnosticAnalzyer and DiagnosticAnalyzer
/// </summary>
#pragma warning disable RS1025 // Configure generated code analysis
public sealed override void Initialize(AnalysisContext context)
#pragma warning restore RS1025 // Configure generated code analysis
{
}
......
......@@ -18,7 +18,9 @@ internal abstract class ProjectDiagnosticAnalyzer : DiagnosticAnalyzer
/// <summary>
/// it is not allowed one to implement both ProjectDiagnosticAnalzyer and DiagnosticAnalyzer
/// </summary>
#pragma warning disable RS1025 // Configure generated code analysis
public sealed override void Initialize(AnalysisContext context)
#pragma warning restore RS1025 // Configure generated code analysis
{
}
......
......@@ -26,6 +26,7 @@ internal abstract class UnboundIdentifiersDiagnosticAnalyzerBase<TLanguageKindEn
public override void Initialize(AnalysisContext context)
{
context.EnableConcurrentExecution();
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics);
context.RegisterSyntaxNodeAction(AnalyzeNode, this.SyntaxKindsOfInterest.ToArray());
}
......
......@@ -53,6 +53,8 @@ public bool OpenFileOnly(Workspace workspace)
public override void Initialize(AnalysisContext context)
{
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics);
foreach (var analyzer in _analyzers)
{
analyzer.Initialize(context);
......
......@@ -73,6 +73,7 @@ public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics
public override void Initialize(AnalysisContext context)
{
context.EnableConcurrentExecution();
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics);
context.RegisterSemanticModelAction(this.AnalyzeSemanticModel);
}
......
......@@ -65,6 +65,7 @@ public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics
public override void Initialize(AnalysisContext context)
{
context.EnableConcurrentExecution();
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics);
context.RegisterCompilationStartAction(startContext =>
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册