Skip to main content

Code quality diagnosis toolkit — 5-dimension maintainability profiling for Python

Project description

dr-huatuo

Code quality diagnosis toolkit for Python. Named after the legendary Chinese physician Hua Tuo (华佗) — it diagnoses code health.

Features

  • 5-Dimension Quality Profile: Maintainability, Complexity, Code Style, Documentation, Security
  • CI Quality Gate: --fail-on D exits non-zero for CI/CD integration
  • Literature-Backed Thresholds: McCabe, SonarSource, Microsoft/SEI, with evidence tagging
  • 25 Static Metrics: ruff, radon, bandit, mypy, pylint, complexipy
  • HTML Reports: Interactive complexity drilldown with source code view

Quick Start

pip install dr-huatuo

# Check a file
dr-huatuo check myfile.py

# Check a project with CI quality gate
dr-huatuo check src/ --fail-on D

# Generate HTML report
dr-huatuo report src/ -f html -o report.html

Example Output

myfile.py
  Maintainability    A  (MI=65.3)
  Complexity         C  (cognitive_complexity=18 > 15)
  Code Style         A  (ruff=0, pylint=9.2)
  Documentation      B  (docstring_density=0.75)
  Security           PASS

  Action items:
    1. Reduce cognitive complexity (18 → ≤15 for B)

Quality Dimensions

Dimension Metrics Thresholds
Maintainability Maintainability Index (MI) A: ≥40, B: ≥20, C: ≥10, D: <10
Complexity Cognitive complexity + nesting depth A: ≤5/≤2, D: >25/≥6
Code Style ruff violations + pylint score A: 0 violations + ≥9.0
Documentation Docstring + comment density A: ≥80% docstrings + 10-30% comments
Security Bandit HIGH/MEDIUM findings PASS/WARN/FAIL gate

License

MIT

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

dr_huatuo-0.2.0.tar.gz (179.8 kB view details)

Uploaded Source

Built Distribution

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

dr_huatuo-0.2.0-py3-none-any.whl (63.5 kB view details)

Uploaded Python 3

File details

Details for the file dr_huatuo-0.2.0.tar.gz.

File metadata

  • Download URL: dr_huatuo-0.2.0.tar.gz
  • Upload date:
  • Size: 179.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dr_huatuo-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9f1ee39bd198969d14fa79ec73696fa910a197a09ec18f8f43cc518439b27aac
MD5 9df5ef55515c084d57727e8f588fe4ad
BLAKE2b-256 8d3d7c7678e406b11e46d40827fcdf3932c3bfe96493ce8e60170a0c2af06009

See more details on using hashes here.

Provenance

The following attestation bundles were made for dr_huatuo-0.2.0.tar.gz:

Publisher: publish.yml on frankyxhl/dr-huatuo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dr_huatuo-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: dr_huatuo-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 63.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dr_huatuo-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d7dcca2add8038d6b6857eb8253473d470aee3e1ad3d64e87b570b292784216c
MD5 62f84b2a992930f53f31a77870a5cad7
BLAKE2b-256 c928a814e6ea96d16b95b9d4de58a162caf92600a47e1f2212db3fdfc8e2c934

See more details on using hashes here.

Provenance

The following attestation bundles were made for dr_huatuo-0.2.0-py3-none-any.whl:

Publisher: publish.yml on frankyxhl/dr-huatuo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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