Closed tats-u closed 6 months ago
var member = callStateMent.Invocation;
while (true)
{
switch (member)
{
case InvocationExpression:
case SimpleMemberAccessExpression:
member = member.Expression;
break;
case Identifier:
case MeExpression:
case MyBaseExpression:
case MyClassExpression:
// etc.
return "Call can be removed";
default:
return "Call is mandatory";
}
}
@tats-u thanks for your feedback and spending time work on a solution. But as mentioned from the discussion in the linked PR, we believe this functionality would be more suitable as a separate analyzer outside of Roslyn.
Brief description:
Describe your code style rule here.
VB requires
Call
before method call expressions if the method calls do not start with identifiers. However, some old-fashioned developers have forced others to add thisCall
to every method call. It is mainly because of the compatibility with VBA/VB6 and because they do not know whenCall
is necessary.Languages applicable:
Is your analyzer C# only? VB Only? Or Both?
VB Only
Code example that the analyzer should report:
A small code snippet that describes a case that the analyzer should report.
Note: the following
Call
s are necessary:Additional information:
Any more additional information you would like to add.
Documentation requirements:
When this analyzer is implemented, it must be documented by following the steps at Documentation for IDE CodeStyle analyzers.