mix metastatic.complexity
(Metastatic v0.10.4)
View Source
Analyzes code complexity for a given file.
Usage
mix metastatic.complexity FILE [options]Options
--format- Output format: text (default), json, or detailed--language- Source language: python, elixir, or erlang (auto-detected if not specified)--max-cyclomatic- Cyclomatic complexity threshold (default: 10)--max-cognitive- Cognitive complexity threshold (default: 15)--max-nesting- Nesting depth threshold (default: 3)--lines- Analyze specific line range (e.g., "10-50") - extracted code must be valid--function- Analyze specific function by name (all clauses combined for multi-clause functions)
Examples
# Basic complexity analysis
mix metastatic.complexity my_file.py
# JSON output
mix metastatic.complexity my_file.py --format json
# Detailed report
mix metastatic.complexity my_file.ex --format detailed
# Custom thresholds
mix metastatic.complexity my_file.erl --max-cyclomatic 15 --max-cognitive 20
# Analyze specific line range
mix metastatic.complexity my_file.py --lines 10-50
# Analyze specific function (all clauses combined)
mix metastatic.complexity my_file.ex --function complex
mix metastatic.complexity my_file.ex --function factorialExit Codes
- 0 - All metrics within thresholds
- 1 - Warnings (exceeded thresholds)
- 2 - Error during analysis