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.3.0.tar.gz (183.9 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.3.0-py3-none-any.whl (63.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dr_huatuo-0.3.0.tar.gz
  • Upload date:
  • Size: 183.9 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.3.0.tar.gz
Algorithm Hash digest
SHA256 909e9f2282db5987938433dd3bc29388a298769db3b8473c7fe69ffb7bda713c
MD5 0b432d2d04303e6455cca3b2adda2c93
BLAKE2b-256 b21019e0208c9c569db5c1ac0cf9aa53f5bbede13db95fda075b8f4d6638821b

See more details on using hashes here.

Provenance

The following attestation bundles were made for dr_huatuo-0.3.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.3.0-py3-none-any.whl.

File metadata

  • Download URL: dr_huatuo-0.3.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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 75a2432f0b8c0e5c12894d031d37c6ee185ceed222903631b707a04396946063
MD5 8737230f946b8e1f4c1fa6a2b90dc6ce
BLAKE2b-256 12898fe834ae0066aa15e64552570c99ec06f9df16d33b8d1238e80ecfb0e89a

See more details on using hashes here.

Provenance

The following attestation bundles were made for dr_huatuo-0.3.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