-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
It seems to me that this rule should take method overloads into account.
internal class Program
{
internal static void DoSomething(object input)
{
switch (input)
{
case int value:
Do(value);
break;
case string value:
Do(value); // GCop415 The same code is repeated in multiple IF branches. Instead update the IF condition to cover both scenarios.
break;
case DateTime value:
Do(value); // GCop415 The same code is repeated in multiple IF branches. Instead update the IF condition to cover both scenarios.
break;
default:
throw new NotImplementedException();
}
}
private static void Do(int value)
{
Console.Write(value + 1);
}
private static void Do(string value)
{
Console.WriteLine(value.Substring(1, 4));
}
private static void Do(DateTime value)
{
Console.WriteLine(value.AddDays(2));
}
}Metadata
Metadata
Assignees
Labels
No labels