terryyin / lizard

A simple code complexity analyser without caring about the C/C++ header files or Java imports, supports most of the popular languages.
Other
1.85k stars 250 forks source link

Failed do detect code duplicate inside switch block #249

Open alexovod opened 5 years ago

alexovod commented 5 years ago

I noticed that lizard failed to detect code duplicate that I had inside switch block

for example:

void switchWithDuplicates() { int i = 50; int j = 500;

int value = minimum(10000, 2000, 3, 405, i, 550, 7, 5000, 200); 

switch(value)
{
    case 50:
    {
        if(j > i)
        {
            doSomethingWith(i,j);
        } else 
        {
            doSomethingElseWith(j);
        }

    }
        break;

    case 3405:
        break;

    case 3405:
    {
        if(j > i)
        {
            doSomethingWith(i,j);
        } else 
        {
            doSomethingElseWith(j);
        }

    }
    break;

    default: break;             
}   

}