Skip to main content

A simple Python tool to calculate code complexity.

Project description

Code Complexity Checker

PyPI Python License

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

  1. Reads the Python file
  2. Uses Radon's ComplexityVisitor to analyze function/class complexity
  3. 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:

  1. Fork the repository on GitHub.
  2. Clone your fork:
    git clone https://github.com/sneha30404/code-complexity-checker.git
    
  3. Create a new branch for your feature
    git checkout -b feature-name
    
  4. Make your changes and commit them:
    git commit -m "Add feature-name"
    
  5. Push to your branch:
    git push origin feature-name
    
  6. Submit a Pull Request.

Links


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

code_complexity_checker-0.1.4.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

code_complexity_checker-0.1.4-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file code_complexity_checker-0.1.4.tar.gz.

File metadata

  • Download URL: code_complexity_checker-0.1.4.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.6

File hashes

Hashes for code_complexity_checker-0.1.4.tar.gz
Algorithm Hash digest
SHA256 4b4f9d8d3e964ccc4fe31e7650a8b9a378fe7ed5731511955d833e014dcba383
MD5 384e809a2d415c05f7038ef132a9ee48
BLAKE2b-256 15b08e0a42a9f181a5d2ef10a5dd6887fc2ef62de907ede3334702d43e76f068

See more details on using hashes here.

File details

Details for the file code_complexity_checker-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for code_complexity_checker-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 267e5c2837bc101af521a0af7ce7b272b1b94f92b9a0f2368c7949b45864b48e
MD5 e12ae4726f3109b147ed24983e11431f
BLAKE2b-256 0afaf122be8938f75445ecb51a908fc55f1bafcbdabd6c8050a40d43c8312024

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page