diff --git a/src/Akka.Analyzers.Tests/Akka.Analyzers.Tests.csproj b/src/Akka.Analyzers.Tests/Akka.Analyzers.Tests.csproj
index 2db5c04..36c5380 100644
--- a/src/Akka.Analyzers.Tests/Akka.Analyzers.Tests.csproj
+++ b/src/Akka.Analyzers.Tests/Akka.Analyzers.Tests.csproj
@@ -10,10 +10,7 @@
-
-
-
-
+
diff --git a/src/Akka.Analyzers.Tests/Analyzers/AK1000/MustCloseOverSenderWhenUsingPipeToAnalyzerSpecs.cs b/src/Akka.Analyzers.Tests/Analyzers/AK1000/MustCloseOverSenderWhenUsingPipeToAnalyzerSpecs.cs
index 8b64ff0..6ebf389 100644
--- a/src/Akka.Analyzers.Tests/Analyzers/AK1000/MustCloseOverSenderWhenUsingPipeToAnalyzerSpecs.cs
+++ b/src/Akka.Analyzers.Tests/Analyzers/AK1000/MustCloseOverSenderWhenUsingPipeToAnalyzerSpecs.cs
@@ -184,7 +184,7 @@ public async Task SuccessCase(string testCode)
[Theory]
[MemberData(nameof(FailureCases))]
- public async Task FailureCase(
+ public Task FailureCase(
(string testCode, (int startLine, int startColumn, int endLine, int endColumn) spanData) d)
{
var expected = Verify.Diagnostic()
@@ -192,6 +192,6 @@ public async Task FailureCase(
.WithArguments("Sender")
.WithSeverity(DiagnosticSeverity.Error);
- await Verify.VerifyAnalyzer(d.testCode, expected).ConfigureAwait(true);
+ return Verify.VerifyAnalyzer(d.testCode, expected);
}
}
\ No newline at end of file
diff --git a/src/Akka.Analyzers.Tests/Analyzers/AK2000/MustNotHandleAutomaticallyHandledMessagesInMessageExtractorAnalyzerSpecs.cs b/src/Akka.Analyzers.Tests/Analyzers/AK2000/MustNotHandleAutomaticallyHandledMessagesInMessageExtractorAnalyzerSpecs.cs
index d0631b6..2e389ef 100644
--- a/src/Akka.Analyzers.Tests/Analyzers/AK2000/MustNotHandleAutomaticallyHandledMessagesInMessageExtractorAnalyzerSpecs.cs
+++ b/src/Akka.Analyzers.Tests/Analyzers/AK2000/MustNotHandleAutomaticallyHandledMessagesInMessageExtractorAnalyzerSpecs.cs
@@ -294,6 +294,11 @@ public string ShardId(object message)
{
return Random.Shared.Next(0,10).ToString();
}
+
+ public string ShardId(string entityId, object message)
+ {
+ return Random.Shared.Next(0,10).ToString();
+ }
}
""", new[]
{
diff --git a/src/Akka.Analyzers.Tests/Utility/ReferenceAssembliesHelper.cs b/src/Akka.Analyzers.Tests/Utility/ReferenceAssembliesHelper.cs
index 0a14ebf..7104438 100644
--- a/src/Akka.Analyzers.Tests/Utility/ReferenceAssembliesHelper.cs
+++ b/src/Akka.Analyzers.Tests/Utility/ReferenceAssembliesHelper.cs
@@ -33,7 +33,7 @@ static ReferenceAssembliesHelper()
// TODO: does this bring all other transitive dependencies?
CurrentAkka = defaultAssemblies.AddPackages(
- [new PackageIdentity("Akka", "1.5.14"), new PackageIdentity("Akka.Cluster.Sharding", "1.5.14")]
+ [new PackageIdentity("Akka.Cluster.Sharding", "1.5.15")]
);
}
}
\ No newline at end of file
diff --git a/src/Akka.Analyzers/AK2000/MustNotUseAutomaticallyHandledMessagesInsideMessageExtractorAnalyzer.cs b/src/Akka.Analyzers/AK2000/MustNotUseAutomaticallyHandledMessagesInsideMessageExtractorAnalyzer.cs
index f496a0b..49c01cd 100644
--- a/src/Akka.Analyzers/AK2000/MustNotUseAutomaticallyHandledMessagesInsideMessageExtractorAnalyzer.cs
+++ b/src/Akka.Analyzers/AK2000/MustNotUseAutomaticallyHandledMessagesInsideMessageExtractorAnalyzer.cs
@@ -15,6 +15,16 @@ namespace Akka.Analyzers;
public class MustNotUseAutomaticallyHandledMessagesInsideMessageExtractorAnalyzer()
: AkkaDiagnosticAnalyzer(RuleDescriptors.Ak2001DoNotUseAutomaticallyHandledMessagesInShardMessageExtractor)
{
+ private static readonly Version RelevantVersion = new(1, 5, 15, 0);
+
+ protected override bool ShouldAnalyze(AkkaContext akkaContext)
+ {
+ Guard.AssertIsNotNull(akkaContext);
+
+ // Akka.Cluster.Sharding has to be installed and the version of it used has to be greater than or equal to v1.5.15
+ return akkaContext.HasAkkaClusterShardingInstalled && akkaContext.AkkaClusterSharding.Version >= RelevantVersion;
+ }
+
public override void AnalyzeCompilation(CompilationStartAnalysisContext context, AkkaContext akkaContext)
{
Guard.AssertIsNotNull(context);
@@ -22,17 +32,11 @@ public override void AnalyzeCompilation(CompilationStartAnalysisContext context,
context.RegisterSyntaxNodeAction(ctx =>
{
- if (akkaContext.HasAkkaClusterShardingInstalled == false)
- return; // exit early if we don't have Akka.Cluster.Sharding installed
-
AnalyzeMethodDeclaration(ctx, akkaContext);
}, SyntaxKind.MethodDeclaration);
context.RegisterSyntaxNodeAction(ctx =>
{
- if (akkaContext.HasAkkaClusterShardingInstalled == false)
- return; // exit early if we don't have Akka.Cluster.Sharding installed
-
var invocationExpr = (InvocationExpressionSyntax)ctx.Node;
var semanticModel = ctx.SemanticModel;
if (semanticModel.GetSymbolInfo(invocationExpr).Symbol is not IMethodSymbol methodSymbol)