Consensys / vscode-solidity-auditor

Solidity language support and visual security auditor for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=tintinweb.solidity-visual-auditor
GNU General Public License v3.0
578 stars 60 forks source link

What does the complexity mean? Is it the gas to be costed? #62

Closed zhengger closed 4 years ago

zhengger commented 4 years ago

Outline View: populates VS Code outline view with sourceUnit and contract layout contracts, stateVars, methods, inherited names annotates security relevant information (visibility, ...) calculates complexity rating annotations functions with information about whether they are accessing stateVars

tintinweb commented 4 years ago

Hey @zhengger,

the complexity rating is based on the AST and not gas costs. It is more a naive indicator for code complexity (source code; not evm bytecode). For example, loops, branches, transfer of funds makes code more complex from a reviewers perspective.

hope that helps. cheers, tin

zhengger commented 4 years ago

Hi @tintinweb, thank you!

Could you give me a little more illustration on what's the purpose of "complexity rating", i.e. what can I use it for?

Thank you so much!

tintinweb commented 4 years ago

@zhengger probably most interesting to auditors who want to quickly find functions with high code complexity or devs that want to reduce complexity that is over a specific threshold. Note that you can disable this via config setting solidity-va.outline.extras.

zhengger commented 4 years ago

@tintinweb Got it. Thank you so much for your patience!