Skip to content

Commit

Permalink
Skip check for AMQP libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanCrd committed Dec 9, 2024
1 parent 50cf3ee commit 0b4834b
Showing 1 changed file with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,31 @@ private static bool DoReturnTypesMatch(ITypeSymbol asyncReturnType, ITypeSymbol
return false;
}

private bool IsAmqpBasedLibrary(INamedTypeSymbol type)
{
var namespaceName = type.ContainingNamespace.ToDisplayString();

// List of AMQP-based libraries that are exempted from this rule.
if (namespaceName.StartsWith("Azure.Messaging.EventHubs") ||
namespaceName.StartsWith("Azure.Messaging.ServiceBus") ||
namespaceName.StartsWith("Azure.Messaging.WebPubSub"))
{
return true;
}

return false;
}

public override void AnalyzeCore(ISymbolAnalysisContext context)
{
INamedTypeSymbol type = (INamedTypeSymbol)context.Symbol;

// Skip the verification for AMQP-based SDKs
if (IsAmqpBasedLibrary(type))
{
return;
}

foreach (var member in type.GetMembers())
{
var methodSymbol = member as IMethodSymbol;
Expand Down Expand Up @@ -325,9 +347,9 @@ public override void AnalyzeCore(ISymbolAnalysisContext context)
context.ReportDiagnostic(Diagnostic.Create(Descriptors.AZC0004, member.Locations.First()), member);
}

if (!methodSymbol.Parameters.SequenceEqual(syncMember.Parameters, ParameterEquivalenceComparer.Default))
{
context.ReportDiagnostic(Diagnostic.Create(Descriptors.AZC0005, member.Locations.First()), member);
if (!methodSymbol.Parameters.SequenceEqual(syncMember.Parameters, ParameterEquivalenceComparer.Default))
{
context.ReportDiagnostic(Diagnostic.Create(Descriptors.AZC0005, member.Locations.First()), member);
}

CheckClientMethod(context, syncMember);
Expand Down

0 comments on commit 0b4834b

Please sign in to comment.