Skip to content

sneha30404/Code-Complexity-Checker

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!

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages