-
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
Improve SA1129 code fix for enum types #1972
Comments
For this and #1973, does it makes sense to just keep expanding the existing code fix with additional branches? Or should this be split into separate diagnostics/fixes? |
Either way you will have to create additional branches, as splitting into separate diagnostics/fixes will require exceptions to be added to the current implementation. I would therefore prefer to go with extending the existing code fix, as adding exceptions for more specific diagnostics / fixes have not been problem free (For examples I'm thinking of SA1003 and SA1020-SA1024, but there are more). |
Grabbing this. |
@sharwell To clarify, do you mean "enum declaration |
I meant the latter. 😄 |
Currently the SA1129 code fix replaces
new TaskState()
withdefault(TaskState)
. An improved code fix for enum types would be the following:Member
in the enum declarationT
has the value 0, replacenew T()
withT.Member
new T()
withdefault(T)
(i.e. fall back to the current behavior)The text was updated successfully, but these errors were encountered: