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 Dexits 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca29b819b23cdef14e1f0206722104ccb570f2615795b278e65d98a5bc1c194d
|
|
| MD5 |
4f11b237ae79a65c78e4b5860465adf0
|
|
| BLAKE2b-256 |
7dba26d77aededdd3a9661106482ba6b2e4a27289754ae13a5f5af8c8b62f1e9
|
Provenance
The following attestation bundles were made for dr_huatuo-0.3.1.tar.gz:
Publisher:
publish.yml on frankyxhl/dr-huatuo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dr_huatuo-0.3.1.tar.gz -
Subject digest:
ca29b819b23cdef14e1f0206722104ccb570f2615795b278e65d98a5bc1c194d - Sigstore transparency entry: 1156038344
- Sigstore integration time:
-
Permalink:
frankyxhl/dr-huatuo@8aa186af8d704024776ac0d199e7f08f73b9726a -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/frankyxhl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8aa186af8d704024776ac0d199e7f08f73b9726a -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b661a38878f0ef443d71da738d545206b4c05ed61d1bdf4a3e965d4a6ba3d4a
|
|
| MD5 |
e24bdc55ac6688c556f4d4d9e62ee552
|
|
| BLAKE2b-256 |
3ce53c23a17a56105d999f24f93eb393d726c843df1a3ba09348ebcadff33456
|
Provenance
The following attestation bundles were made for dr_huatuo-0.3.1-py3-none-any.whl:
Publisher:
publish.yml on frankyxhl/dr-huatuo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dr_huatuo-0.3.1-py3-none-any.whl -
Subject digest:
7b661a38878f0ef443d71da738d545206b4c05ed61d1bdf4a3e965d4a6ba3d4a - Sigstore transparency entry: 1156038380
- Sigstore integration time:
-
Permalink:
frankyxhl/dr-huatuo@8aa186af8d704024776ac0d199e7f08f73b9726a -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/frankyxhl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8aa186af8d704024776ac0d199e7f08f73b9726a -
Trigger Event:
release
-
Statement type: