Function Complexity Scorer
Free to download on every platform. Comes pre-installed on BotFone, BotPad and BotFlip — with extra free apps included.
About this app
WHAT IT DOES
Function Complexity Scorer is a static analysis tool that evaluates Solidity functions based on multiple complexity metrics. It parses your contract source locally and scores each function using a weighted algorithm that considers cyclomatic complexity (control flow statements), nesting depth, number of parameters, logical operators, and lines of code. The output includes a per‑function score, a complexity level (Low, Moderate, High, Very High), and a summary table showing which functions may need refactoring. This helps developers identify code that is difficult to test, audit, or maintain.
HOW TO USE
Paste any Solidity contract source into the input area and click "score complexity". The tool scans for function declarations, extracts each function body, and computes individual scores. Results appear as a table with function names, parameter counts, lines of code, control flow count, nesting depth, and the final complexity score. Functions with High or Very High scores are highlighted for attention. Use these insights to prioritize code review, simplify complex logic, or break large functions into smaller, more focused pieces.
THE REAL MECHANISM
The analyzer uses a heuristic parser that strips comments and string literals to avoid false positives. It then applies a weighted scoring model: each control flow statement (if, for, while, require, assert, revert, try, catch) adds 2 points; each logical operator (&&, ||) adds 1 point; nesting depth adds 1.5 points per level; lines of code add 0.3 points per line; and each parameter adds 0.5 points. The raw score is normalized and mapped to a complexity level. This approach balances multiple factors rather than relying on a single metric, providing a more holistic view of function complexity. All processing occurs in the browser — no code is sent to any server.
WHAT IT CANNOT SEE
The tool cannot detect semantic errors or determine if complexity is actually problematic in a specific context. It does not analyze external dependencies, evaluate gas optimization, detect reentrancy or other security vulnerabilities, or assess business logic correctness. A low complexity score does not guarantee the function is secure, and a high score does not necessarily mean the function is flawed — it is a guideline for further manual review.
PLEASE NOTE — EVM CHAINS ONLY
This tool is designed for Solidity contracts targeting Ethereum Virtual Machine (EVM) compatible chains. It does not support Vyper, Rust, Move, or other smart contract languages. All processing occurs in your browser; no contract data is stored or transmitted.