vscode-solidity-auditor icon indicating copy to clipboard operation
vscode-solidity-auditor copied to clipboard

Cyclomatic complexity detection

Open pedrohba1 opened this issue 3 years ago • 1 comments

In the same way that an UML can be generated, I think it would be great to detect cyclomatic complexities.

I think that somehow detecting Cyclomatic complexities might be good because of the following exempt from wikipedia:

Correlation to number of defects A number of studies have investigated the correlation between McCabe's cyclomatic complexity number with the frequency of defects occurring in a function or method.[11] Some studies[12] find a positive correlation between cyclomatic complexity and defects: functions and methods that have the highest complexity tend to also contain the most defects.

A better explanation of it: https://en.wikipedia.org/wiki/Cyclomatic_complexity#Limiting_complexity_during_development

pedrohba1 avatar Aug 22 '22 00:08 pedrohba1

hey @pedrohba1 🙌 ,

cyclomatic complexity is a little more complex to calculate that's why I took the shortcut with statement-based complexity scoring. statements that increase complexity add score to the function (https://github.com/ConsenSys/vscode-solidity-auditor/issues/62).

happy to take a PR if someone want's to take this on.

cheers, tin

tintinweb avatar Sep 06 '22 13:09 tintinweb