Created
October 24, 2025 11:05
-
-
Save ngmachado/c2f6f9eaf196656b58f2ef079097606a to your computer and use it in GitHub Desktop.
Analyzing complexity for ora-example/defi_lending_pool.ora
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ./zig-out/bin/ora --analyze-complexity ora-example/defi_lending_pool.ora | |
| Analyzing complexity for ora-example/defi_lending_pool.ora | |
| ================================================== | |
| Contract: LendingPool | |
| ────────────────────────────────────────────────── | |
| pub fn get_total_deposits() | |
| Complexity: ✓ Simple | |
| Nodes: 1 | |
| Statements: 1 | |
| Max Depth: 1 | |
| pub fn get_available_liquidity() | |
| Complexity: ✓ Simple | |
| Nodes: 2 | |
| Statements: 2 | |
| Max Depth: 1 | |
| inline fn is_valid_amount() | |
| Complexity: ✓ Simple | |
| Nodes: 3 | |
| Statements: 3 | |
| Max Depth: 2 | |
| inline fn only_owner() | |
| Complexity: ✓ Simple | |
| Nodes: 1 | |
| Statements: 1 | |
| Max Depth: 1 | |
| inline fn when_not_paused() | |
| Complexity: ✓ Simple | |
| Nodes: 1 | |
| Statements: 1 | |
| Max Depth: 1 | |
| pub fn get_tier_discount() | |
| Complexity: ✓ Simple | |
| Nodes: 1 | |
| Statements: 1 | |
| Max Depth: 1 | |
| pub fn get_tier_max_ltv() | |
| Complexity: ✓ Simple | |
| Nodes: 2 | |
| Statements: 2 | |
| Max Depth: 1 | |
| pub fn get_risk_level() | |
| Complexity: ✓ Simple | |
| Nodes: 8 | |
| Statements: 8 | |
| Max Depth: 4 | |
| pub fn process_operation_with_tier() | |
| Complexity: ✓ Simple | |
| Nodes: 14 | |
| Statements: 14 | |
| Max Depth: 2 | |
| pub fn update_loan_status() | |
| Complexity: ✓ Simple | |
| Nodes: 19 | |
| Statements: 19 | |
| Max Depth: 4 | |
| pub fn calculate_utilization_rate() | |
| Complexity: ✓ Simple | |
| Nodes: 6 | |
| Statements: 6 | |
| Max Depth: 2 | |
| pub fn calculate_interest_rate() | |
| Complexity: ✓ Simple | |
| Nodes: 9 | |
| Statements: 9 | |
| Max Depth: 2 | |
| fn accrue_interest() | |
| Complexity: ✓ Simple | |
| Nodes: 19 | |
| Statements: 19 | |
| Max Depth: 2 | |
| 💡 Tip: This function is a good candidate for 'inline' | |
| pub fn deposit() | |
| Complexity: ✓ Simple | |
| Nodes: 9 | |
| Statements: 9 | |
| Max Depth: 2 | |
| pub fn calculate_health_factor() | |
| Complexity: ✓ Simple | |
| Nodes: 10 | |
| Statements: 10 | |
| Max Depth: 2 | |
| pub fn borrow() | |
| Complexity: ○ Moderate | |
| Nodes: 22 | |
| Statements: 22 | |
| Max Depth: 2 | |
| pub fn repay() | |
| Complexity: ✓ Simple | |
| Nodes: 15 | |
| Statements: 15 | |
| Max Depth: 2 | |
| pub fn withdraw() | |
| Complexity: ○ Moderate | |
| Nodes: 24 | |
| Statements: 24 | |
| Max Depth: 3 | |
| pub fn liquidate() | |
| Complexity: ○ Moderate | |
| Nodes: 41 | |
| Statements: 41 | |
| Max Depth: 2 | |
| pub fn rebalance_user_portfolio() | |
| Complexity: ✗ Complex | |
| Nodes: 120 | |
| Statements: 120 | |
| Max Depth: 7 | |
| 💡 Recommendation: Consider breaking into smaller functions | |
| inline fn complex_risk_assessment() | |
| Complexity: ○ Moderate | |
| Nodes: 49 | |
| Statements: 49 | |
| Max Depth: 6 | |
| ══════════════════════════════════════════════════ | |
| SUMMARY | |
| ══════════════════════════════════════════════════ | |
| Total Functions: 21 | |
| ✓ Simple: 16 (76%) | |
| ○ Moderate: 4 (19%) | |
| ✗ Complex: 1 (4%) | |
| Average Complexity: 17 nodes/function | |
| Complexity Thresholds: | |
| Simple: < 20 nodes (good for inline) | |
| Moderate: 20-100 nodes | |
| Complex: > 100 nodes (not recommended for inline) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment