-
Notifications
You must be signed in to change notification settings - Fork 510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update SA1302 (InterfaceNamesMustBeginWithI) to handle conflicting names #436
Comments
First of all we need to check if a type with the new name exists in the same namespace. If it's in a different namespace - it's safe to apply the fix. If the type aleady exists in the namespace, maybe we should append a number to the name, to make it unique (of course, if we have Foo interface, and IFoo and IFoo2 already exist, we should rename it to IFoo3). |
We could do that. First I'm curious if there is a way to check with |
Isn't it done in #443 ? |
No, that pull request makes improvements based on the feedback in dotnet/roslyn#197, but this particular issue did not behave in the manner expected by that team. Hopefully the next release of the code fix framework allows us to notify the user of a conflict prior to applying it. |
This helper is a combination of work on DotNetAnalyzers#436 and DotNetAnalyzers#437, and offers a more flexible solution for avoiding conflicts during rename operations.
The following code results in an SA1302 warning. If the code fix is applied, it introduces a new compiler error.
We first need to decide how we want to handle this case (and similar), followed by implementation and tests.
The text was updated successfully, but these errors were encountered: