Added feature to optionally check switch exhaustiveness when using enums #355

Open
Uriel6575 wants to merge 1 commit from unknown repository into master
Uriel6575 commented 2013-10-15 14:51:31 -05:00 (Migrated from github.com)

I've implemented this feature while refactoring some stuff just for myself but thought that it might be useful for somebody else.
The main idea here is that C# compiler by default doesn't check that all enum values was used in some switch statement. And it's quite understandable, because sometimes I do really want to handle just 2 of 10 flags, for example. But sometimes I want to be sure that all possible enum values was handled.
So here I have an action which adds marker comment to switch statement and then it becomes subjected to the aforementioned check. And also you can add all the missing cases with the fix action.

I've implemented this feature while refactoring some stuff just for myself but thought that it might be useful for somebody else. The main idea here is that C# compiler by default doesn't check that all enum values was used in some switch statement. And it's quite understandable, because sometimes I do really want to handle just 2 of 10 flags, for example. But sometimes I want to be sure that all possible enum values was handled. So here I have an action which adds marker comment to switch statement and then it becomes subjected to the aforementioned check. And also you can add all the missing cases with the fix action.
This pull request is broken due to missing fork information.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'unknown repository:unknown repository'
git switch 'unknown repository'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'master'
git merge --no-ff 'unknown repository'
git switch 'unknown repository'
git rebase 'master'
git switch 'master'
git merge --ff-only 'unknown repository'
git switch 'unknown repository'
git rebase 'master'
git switch 'master'
git merge --no-ff 'unknown repository'
git switch 'master'
git merge --squash 'unknown repository'
git switch 'master'
git merge --ff-only 'unknown repository'
git switch 'master'
git merge 'unknown repository'
git push origin 'master'
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-icsharpcode/NRefactory!355
No description provided.