Skip to main content

Codebase Maintainability Analyzer

Project description

Maintainability API & CLI 🛠️

GitHub stars PyPI

Maintainability is a powerful tool that allows you to analyze the maintainability of your codebase. It provides a FastAPI based API and a command-line interface (CLI) to interact with the API. The application calculates various metrics related to code maintainability such as readability, design quality, testability, consistency, and debug error handling.

Why Use Maintainability? 🚀

Maintainability is designed to help you improve the quality of your codebase. It provides you with detailed metrics about your code, which can help you identify areas that need improvement. By using Maintainability, you can ensure that your code is easy to understand, modify, and test, which can save you a lot of time and effort in the long run.

Repo Structure 📂

maintainability
├── api
│   ├── requirements.txt
│   ├── src
│   │   ├── main.py
│   │   ├── models.py
│   │   ├── test_main.py
│   │   └── utils.py
│   └── vercel.json
└── cli
    ├── cli.py
    └── __init__.py

Usage 🖥️

CLI

The CLI provides a simple way to interact with the API. Here's an example of how to use it:

python cli.py --paths /path/to/your/code

This command will analyze the code in the specified paths and return the maintainability metrics.

API

The API provides two main endpoints:

  • POST /submit_metrics: This endpoint allows you to submit your metrics to the API. Here's an example of how to use it:
import requests

data = {
    "/test/path/testfile.py": {
        "maintainability": {
            "readability": 1,
            "design_quality": 2,
            "testability": 3,
            "consistency": 4,
            "debug_error_handling": 5,
        },
        "file_info": {
            "file_size": 1000,
            "loc": 100,
            "language": "python",
            "content": "print('hello world')",
        },
        "timestamp": "timestamp",
        "session_id": "88888888-8888-8888-8888-888888888888",
    }
}

response = requests.post("http://localhost:8000/submit_metrics", json=data)
  • POST /extract_metrics: This endpoint allows you to extract metrics from your code. Here's an example of how to use it:
import requests

data = {"/test/path/testfile.py": "print('hello world')"}

response = requests.post("http://localhost:8000/extract_metrics", json=data)

Conclusion 🎉

Maintainability is a powerful tool for improving the quality of your codebase. By providing detailed metrics about your code, it can help you identify areas that need improvement and ensure that your code is easy to understand, modify, and test. Give it a try today!

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

maintainability-0.2.1.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

maintainability-0.2.1-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file maintainability-0.2.1.tar.gz.

File metadata

  • Download URL: maintainability-0.2.1.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Linux/6.2.0-1012-azure

File hashes

Hashes for maintainability-0.2.1.tar.gz
Algorithm Hash digest
SHA256 4ec930443661baff66f67b83d2634d2e477c11e0d2da8382406b7a96e1a14a49
MD5 5f4126b12664796dff947e99dc7ab346
BLAKE2b-256 fe7088eacb6aa1cf6f2526c5539d7a2a78b77ecad236c47d0fb4cce51115abcc

See more details on using hashes here.

File details

Details for the file maintainability-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: maintainability-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Linux/6.2.0-1012-azure

File hashes

Hashes for maintainability-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ea5604a725d20e50b7d888d247a853ad69d09448a1c64d260b2d2cd4d2aa9459
MD5 637a22caca5a544b5fc2903f6e86abcf
BLAKE2b-256 5cbd3e527a21509acd1a7de9c284daf5ba5c2b49f5743adc286aa0ab5b07f25d

See more details on using hashes here.

Supported by

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