Skip to content

Commit

Permalink
Do not stop when MemberAccess or ObjectCreation are nested
Browse files Browse the repository at this point in the history
  • Loading branch information
costin-zaharia-sonarsource committed May 30, 2024
1 parent 3c6601c commit ca0b9b4
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,18 @@ public override void Visit(SyntaxNode node)
}
}

public override void VisitMemberAccessExpression(MemberAccessExpressionSyntax node) =>
public override void VisitMemberAccessExpression(MemberAccessExpressionSyntax node)
{
Result |= node.Expression.NameIs("SecureRandom") && node.Name.NameIs("GetInstance");

public override void VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) =>
base.VisitMemberAccessExpression(node);
}

public override void VisitObjectCreationExpression(ObjectCreationExpressionSyntax node)
{
Result |= node.Type.GetName() is "DigestRandomGenerator" or "VmpcRandomGenerator";

base.VisitObjectCreationExpression(node);
}
}
}

0 comments on commit ca0b9b4

Please sign in to comment.