Closed FirstWhack closed 1 year ago
I'm open for suggestions on how to improve the situation, however I think that code path could be simplified (that is the purpose of this extension, to point out such things) The reason for having the same result as the mentioned generator function is likely that yields are not counted at the moment.
I'm not sure though about what is the purpose of this issue report... yes it is not cyclomatic complexity as it is stated in the readme, yes it is imperfect, on the other hand almost every aspect of the complexity computation can be customized with a simple configuration.
You don't like that return statements add +1? Set the value associated with them to 0.
I'll keep this open so that I'll add +1 for yields as well to be consistent
I think issue: Support for Cognitive Complexity #96 will go a long way to sorting out this confusion.
if with else statement is 2.
but, i found an default setting 'Codemetrics › Luaconfiguration: Elseif Clause' is 1
It seems that ‘else if’ are recognized as ‘else’ and ‘if’ respectively, so it leads to 2? I think it might be more appropriate to keep it at 1
Changed default for IfWithElseStatement to 1 available in kisstkondoros.vscode-codemetrics v1.26.1
The following reports "Complexity is 6 it's time to do something..."
This piece of code has an obvious cyclomatic complexity of 3.. Aside from the contrived nature of this code, it is not time to do something.
Per the readme:
I have another example where the actual cyclomatic complexity of a generator function (in a redux saga) is 58, but the tool reports complexity of 7. It is 200 lines of conditional yields and essentially the same complexity as the above example according to CodeMetrics. I will have to take some time to recreate it in a readable but unlicensed way later.