I do not have programs designed to measure the complexity of the cyclometric code at the moment. But I wonder if a recursive method increases complexity?
eg.
// 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.
As far as I understand, no. In your example, there is only one linearly independent path to the recursive method, so it will not increase cyclomatic complexity.
Even if the recursive call itself is not considered strictly as an increment, this is a protection condition. This makes a loop and recursion + guard on steam.