Suggestion: detect "goto the case label just below"
- Dominant language
- C#
- Stars
- 3.5k
- Forks
- 294
- Avg merge
- 2h 30m
- Merged PRs (30d)
- 4
Description
It's not common, but the situation just happened to me:
Roslynator could detect a `case` containing **no code except a `goto`** leading to the `case` label just below it, and suggest to remove the `goto` and simply use a fall through.
switch (value)
{
case 1:
goto case 2; // can be removed (because case 1 is empty of code)
case 2:
...
}
The difficulty might be if `case 1` contains some comments (keep them but still detect that `case 1` is empty of code)
Contributor guide
Research direction
The issue names no source file or test. Start by locating Roslynator's existing analyzer for C# switch statements, then verify how it identifies empty case sections and goto case targets. Done means detecting a case containing only a goto to the immediately following label, while preserving comments, and adding coverage for the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100