views:

33

answers:

1

Hi all:

I do not have any programs installed for measuring cyclomatric code complexity at the moment. But I was wondering does a recursive method increases the complexity?

e.g.

// just a simple C# example to recursively find an int[]
// within a pile of string[]
private int[] extractInts(string[] s)
{
    foreach (string s1 in s)
    {
        if (s1.ints.length < 0)
        {
            extractInts(s1);
        }
        else
        {
            return ints;
        }
    }
}

Thanks.

+3  A: 

As far as I understand, no. There is only one linearly independent path to the recursive method in your example, so it wouldn't increase the cyclomatic complexity.

Javid Jamae