A lightweight Python tool that analyzes the complexity of your code using Radon . Quickly check function complexity, detect high-complexity areas, and improve your code quality!
- Analyze Cyclomatic Complexity of Python functions & classes
- Generate JSON Reports with detailed complexity insights
- Command-Line Interface (CLI) for quick execution
- Lightweight & Easy to Use
- Supports Python 3.7+
Install the package using pip:
pip install code-complexity-checkerAnalyze a Python file:
!code-checker --file example.pyThis will output something like:
[
{"function": "calculate_factorial", "complexity": 3, "lineno": 5},
{"function": "fibonacci", "complexity": 4, "lineno": 12}
]- Reads the Python file
- Uses Radon's
ComplexityVisitorto analyze function/class complexity - Outputs a structured JSON report with function names & their complexity scores
- Helps you identify complex functions early
- Makes code easier to maintain & optimize
- Great for code reviews & refactoring
Contributions are welcome! Follow these steps to contribute:
- Fork the repository on GitHub.
- Clone your fork:
git clone https://github.com/sneha30404/code-complexity-checker.git
- Create a new branch for your feature
git checkout -b feature-name
- Make your changes and commit them:
git commit -m "Add feature-name" - Push to your branch:
git push origin feature-name
- Submit a Pull Request.
- PyPI: Code Complexity Checker
- GitHub: Source Code
- Radon Docs: Radon Library
This project is licensed under the MIT License.
Happy Coding!