I have a Semgrep rule:
rules:
- id: create-chat-client
patterns:
- pattern: var $X = GrpcChannel.ForAddress(...);
- pattern: var $Y = new ChatService.ChatServiceClient($X);
languages:
- csharp
message: <pass>
severity: INFO
And I am trying to match this code:
using Grpc.Net.Client;
using GrpcChat.ProtoBuf;
var channel = GrpcChannel.ForAddress("https://localhost:8888");
var client = new ChatService.ChatServiceClient(channel);
These match separately, but the 'patterns' should be a "AND" match and it fails. I must be missing something obvious. Anyone see anything?