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.1.tar.gz (184.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.1-py3-none-any.whl (64.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dr_huatuo-0.3.1.tar.gz
  • Upload date:
  • Size: 184.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.1.tar.gz
Algorithm Hash digest
SHA256 ca29b819b23cdef14e1f0206722104ccb570f2615795b278e65d98a5bc1c194d
MD5 4f11b237ae79a65c78e4b5860465adf0
BLAKE2b-256 7dba26d77aededdd3a9661106482ba6b2e4a27289754ae13a5f5af8c8b62f1e9

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: dr_huatuo-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 64.4 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7b661a38878f0ef443d71da738d545206b4c05ed61d1bdf4a3e965d4a6ba3d4a
MD5 e24bdc55ac6688c556f4d4d9e62ee552
BLAKE2b-256 3ce53c23a17a56105d999f24f93eb393d726c843df1a3ba09348ebcadff33456

See more details on using hashes here.

Provenance

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