A simple Python tool to calculate code complexity.
Project description
Code Complexity Checker
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!
Features
- 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+
Installation
Install the package using pip:
pip install code-complexity-checker
Usage
Analyze a Python file:
!code-checker --file example.py
This will output something like:
[
{"function": "calculate_factorial", "complexity": 3, "lineno": 5},
{"function": "fibonacci", "complexity": 4, "lineno": 12}
]
How It Works
- Reads the Python file
- Uses Radon's
ComplexityVisitorto analyze function/class complexity - Outputs a structured JSON report with function names & their complexity scores
Why Use This?
- Helps you identify complex functions early
- Makes code easier to maintain & optimize
- Great for code reviews & refactoring
Contributing
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.
Links
- PyPI: Code Complexity Checker
- GitHub: Source Code
- Radon Docs: Radon Library
License
This project is licensed under the MIT License.
Happy Coding!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file code_complexity_checker-0.1.10.tar.gz.
File metadata
- Download URL: code_complexity_checker-0.1.10.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81b662ea5231cc39c16baa0b00ed6f4a3b3d90ac91281c822936429f6fd2f723
|
|
| MD5 |
077640b27060d8b71ce843eb167ed050
|
|
| BLAKE2b-256 |
ac67bc0b14acc95f6365f8e2cb1a6ead233eb54e5fb5b27c15734ea5266f2f8e
|
File details
Details for the file code_complexity_checker-0.1.10-py3-none-any.whl.
File metadata
- Download URL: code_complexity_checker-0.1.10-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48de50ac5acfd425205961d430499d6d871de147690eb8a82bbd05e1704b59cb
|
|
| MD5 |
be47655ce9af08e31fd63835bb4f6d15
|
|
| BLAKE2b-256 |
10dc9d8b683c26694b8fec8bad8bfbfef1fcdab0dc208f04096249cae772f1ba
|