From 3742f282e042556414eb0211a7488cc1a06ec522 Mon Sep 17 00:00:00 2001 From: Matt Kotsenas Date: Fri, 7 Jun 2024 10:15:11 -0700 Subject: [PATCH] Enable ConcurrentExecution and disable generated code analysis for all analyzers --- Source/Moq.Analyzers.Test/Helpers/AnalyzerTestExtensions.cs | 1 - Source/Moq.Analyzers/AsShouldBeUsedOnlyForInterfaceAnalyzer.cs | 2 ++ .../CallbackSignatureShouldMatchMockedMethodAnalyzer.cs | 2 ++ Source/Moq.Analyzers/ConstructorArgumentsShouldMatchAnalyzer.cs | 2 ++ .../NoConstructorArgumentsForInterfaceMockAnalyzer.cs | 2 ++ Source/Moq.Analyzers/NoMethodsInPropertySetupAnalyzer.cs | 2 ++ Source/Moq.Analyzers/NoSealedClassMocksAnalyzer.cs | 2 ++ .../SetupShouldBeUsedOnlyForOverridableMembersAnalyzer.cs | 2 ++ .../Moq.Analyzers/SetupShouldNotIncludeAsyncResultAnalyzer.cs | 2 ++ 9 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Source/Moq.Analyzers.Test/Helpers/AnalyzerTestExtensions.cs b/Source/Moq.Analyzers.Test/Helpers/AnalyzerTestExtensions.cs index 8be969c6..0f67c325 100644 --- a/Source/Moq.Analyzers.Test/Helpers/AnalyzerTestExtensions.cs +++ b/Source/Moq.Analyzers.Test/Helpers/AnalyzerTestExtensions.cs @@ -9,7 +9,6 @@ public static TAnalyzerTest SetDefaults(this TAnalyzer where TVerifier : IVerifier, new() { test.ReferenceAssemblies = ReferenceAssemblies.Net.Net80.AddPackages([new PackageIdentity("Moq", "4.8.2")]); // TODO: See https://github.com/rjmurillo/moq.analyzers/issues/58 - test.TestBehaviors = TestBehaviors.SkipGeneratedCodeCheck; // TODO: We should enable the generated code check return test; } diff --git a/Source/Moq.Analyzers/AsShouldBeUsedOnlyForInterfaceAnalyzer.cs b/Source/Moq.Analyzers/AsShouldBeUsedOnlyForInterfaceAnalyzer.cs index 41fdcd20..f2ce8ad0 100644 --- a/Source/Moq.Analyzers/AsShouldBeUsedOnlyForInterfaceAnalyzer.cs +++ b/Source/Moq.Analyzers/AsShouldBeUsedOnlyForInterfaceAnalyzer.cs @@ -15,6 +15,8 @@ public class AsShouldBeUsedOnlyForInterfaceAnalyzer : DiagnosticAnalyzer public override void Initialize(AnalysisContext context) { + context.EnableConcurrentExecution(); + context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None); context.RegisterSyntaxNodeAction(Analyze, SyntaxKind.InvocationExpression); } diff --git a/Source/Moq.Analyzers/CallbackSignatureShouldMatchMockedMethodAnalyzer.cs b/Source/Moq.Analyzers/CallbackSignatureShouldMatchMockedMethodAnalyzer.cs index ff845857..eaaa0e28 100644 --- a/Source/Moq.Analyzers/CallbackSignatureShouldMatchMockedMethodAnalyzer.cs +++ b/Source/Moq.Analyzers/CallbackSignatureShouldMatchMockedMethodAnalyzer.cs @@ -18,6 +18,8 @@ public override ImmutableArray SupportedDiagnostics public override void Initialize(AnalysisContext context) { + context.EnableConcurrentExecution(); + context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None); context.RegisterSyntaxNodeAction(Analyze, SyntaxKind.InvocationExpression); } diff --git a/Source/Moq.Analyzers/ConstructorArgumentsShouldMatchAnalyzer.cs b/Source/Moq.Analyzers/ConstructorArgumentsShouldMatchAnalyzer.cs index 6d1f0e63..baa31cc2 100644 --- a/Source/Moq.Analyzers/ConstructorArgumentsShouldMatchAnalyzer.cs +++ b/Source/Moq.Analyzers/ConstructorArgumentsShouldMatchAnalyzer.cs @@ -18,6 +18,8 @@ public override ImmutableArray SupportedDiagnostics public override void Initialize(AnalysisContext context) { + context.EnableConcurrentExecution(); + context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None); context.RegisterSyntaxNodeAction(Analyze, SyntaxKind.ObjectCreationExpression); } diff --git a/Source/Moq.Analyzers/NoConstructorArgumentsForInterfaceMockAnalyzer.cs b/Source/Moq.Analyzers/NoConstructorArgumentsForInterfaceMockAnalyzer.cs index 3255e634..8c46ef66 100644 --- a/Source/Moq.Analyzers/NoConstructorArgumentsForInterfaceMockAnalyzer.cs +++ b/Source/Moq.Analyzers/NoConstructorArgumentsForInterfaceMockAnalyzer.cs @@ -18,6 +18,8 @@ public override ImmutableArray SupportedDiagnostics public override void Initialize(AnalysisContext context) { + context.EnableConcurrentExecution(); + context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None); context.RegisterSyntaxNodeAction(Analyze, SyntaxKind.ObjectCreationExpression); } diff --git a/Source/Moq.Analyzers/NoMethodsInPropertySetupAnalyzer.cs b/Source/Moq.Analyzers/NoMethodsInPropertySetupAnalyzer.cs index d2ced6f1..870eef1e 100644 --- a/Source/Moq.Analyzers/NoMethodsInPropertySetupAnalyzer.cs +++ b/Source/Moq.Analyzers/NoMethodsInPropertySetupAnalyzer.cs @@ -18,6 +18,8 @@ public override ImmutableArray SupportedDiagnostics public override void Initialize(AnalysisContext context) { + context.EnableConcurrentExecution(); + context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None); context.RegisterSyntaxNodeAction(Analyze, SyntaxKind.InvocationExpression); } diff --git a/Source/Moq.Analyzers/NoSealedClassMocksAnalyzer.cs b/Source/Moq.Analyzers/NoSealedClassMocksAnalyzer.cs index 391672c1..8e1f0cd1 100644 --- a/Source/Moq.Analyzers/NoSealedClassMocksAnalyzer.cs +++ b/Source/Moq.Analyzers/NoSealedClassMocksAnalyzer.cs @@ -18,6 +18,8 @@ public override ImmutableArray SupportedDiagnostics public override void Initialize(AnalysisContext context) { + context.EnableConcurrentExecution(); + context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None); context.RegisterSyntaxNodeAction(Analyze, SyntaxKind.ObjectCreationExpression); } diff --git a/Source/Moq.Analyzers/SetupShouldBeUsedOnlyForOverridableMembersAnalyzer.cs b/Source/Moq.Analyzers/SetupShouldBeUsedOnlyForOverridableMembersAnalyzer.cs index c11c2e65..44207e62 100644 --- a/Source/Moq.Analyzers/SetupShouldBeUsedOnlyForOverridableMembersAnalyzer.cs +++ b/Source/Moq.Analyzers/SetupShouldBeUsedOnlyForOverridableMembersAnalyzer.cs @@ -15,6 +15,8 @@ public class SetupShouldBeUsedOnlyForOverridableMembersAnalyzer : DiagnosticAnal public override void Initialize(AnalysisContext context) { + context.EnableConcurrentExecution(); + context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None); context.RegisterSyntaxNodeAction(Analyze, SyntaxKind.InvocationExpression); } diff --git a/Source/Moq.Analyzers/SetupShouldNotIncludeAsyncResultAnalyzer.cs b/Source/Moq.Analyzers/SetupShouldNotIncludeAsyncResultAnalyzer.cs index 15b0b528..28d024ac 100644 --- a/Source/Moq.Analyzers/SetupShouldNotIncludeAsyncResultAnalyzer.cs +++ b/Source/Moq.Analyzers/SetupShouldNotIncludeAsyncResultAnalyzer.cs @@ -15,6 +15,8 @@ public class SetupShouldNotIncludeAsyncResultAnalyzer : DiagnosticAnalyzer public override void Initialize(AnalysisContext context) { + context.EnableConcurrentExecution(); + context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None); context.RegisterSyntaxNodeAction(Analyze, SyntaxKind.InvocationExpression); }