Code quality diagnosis toolkit — 5-dimension maintainability profiling for Python and TypeScript
Project description
Dr. Huatuo
Code Quality Diagnosis Toolkit
5-dimension quality profiling for Python and TypeScript. Named after the legendary physician Hua Tuo (华佗) — it diagnoses code health.
What is dr-huatuo?
dr-huatuo orchestrates static analysis tools into a unified quality profile with 5 independent dimensions. No single aggregate score — each dimension gets its own grade so you know exactly what to fix.
- Multi-Language — Python (ruff, radon, bandit, mypy, pylint, complexipy) and TypeScript (eslint, tsc, escomplex)
- 5-Dimension Quality Profile — Maintainability, Complexity, Code Style, Documentation, Security
- CI Quality Gate —
--fail-on Dexits non-zero for CI/CD integration - Multiple Output Formats — Terminal (rich), HTML (interactive with Chart.js), JSON, Markdown
- Plugin Architecture — Language-agnostic protocol, register new analyzers with one line
Quick Start
pip install dr-huatuo
# or
pipx install dr-huatuo
# Check a Python file
ht check myfile.py
# Check a TypeScript project
ht check frontend/src/ --language typescript
# Check a mixed project (auto-detects Python + TypeScript)
ht check src/ --fail-on D
# Generate interactive HTML report
ht report src/ -f html -o report.html
# Show version and tool status
ht version
Screenshots
Terminal Report (ht report src/)
HTML Report (ht report src/ -f html)
Quality Dimensions
| Dimension | Metrics | Grades |
|---|---|---|
| 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 | Lint violations (ruff) + linter score (pylint) | A: 0 violations + ≥9.0 |
| Documentation | Docstring + comment density | A: ≥80% docstrings + 10-30% comments |
| Security | Bandit HIGH/MEDIUM findings | PASS / WARN / FAIL gate |
Type safety (mypy errors) is reported as informational — not rated.
CLI Reference
# Quality check (5-dimension profile)
ht check <path> # analyze file or directory
ht check src/ --fail-on D # CI gate: fail on D or F
ht check src/ --fail-on C # stricter: fail on C, D, or F
ht check src/ --fail-on WARN # fail on any security warning
ht check src/ --fail-on D --dimension Security # gate single dimension
ht check src/ -e .venv tests docs # exclude directories
ht check src/ --language typescript # filter by language
# Project reports
ht report <path> # terminal output (default)
ht report src/ -f html -o report.html # interactive HTML with Chart.js
ht report src/ -f json -o report.json # machine-readable JSON
ht report src/ -f markdown -o report.md # markdown for docs
# Info
ht version # show version + tool status
Scoring System
Score starts at 100, with deductions per category:
| Category | Deduction | Cap |
|---|---|---|
| Lint violations | -2 each | -30 |
| Complexity >10 | (cc-10) × 5 | -20 |
| Security HIGH | -15 each | -30 |
| Security MEDIUM | -5 each | -15 |
| Type errors | -1 each | -10 |
Grades: A (90+) Excellent, B (80+) Good, C (70+) Fair, D (60+) Pass, F (<60) Fail
Tools Orchestrated
Python
| Tool | What it checks |
|---|---|
| ruff | Lint violations (fast Python linter) |
| radon | Cyclomatic complexity, maintainability index, Halstead metrics |
| bandit | Security vulnerabilities |
| mypy | Type errors |
| pylint | Code quality score |
| complexipy | Cognitive complexity |
Python tools are installed automatically as pip dependencies.
TypeScript
| Tool | What it checks |
|---|---|
| eslint | Lint violations, security rules (eslint-plugin-security) |
| tsc | Type errors (via tsconfig.json) |
| escomplex | Cyclomatic complexity, maintainability index |
TypeScript tools require Node.js. Install locally: npm install --save-dev eslint typescript typhonjs-escomplex
Roadmap
- Foundation — single-file analyzer, project reporter, tests, CI/CD, PyPI
- Quality Profile & CLI — 5-dimension profile,
htCLI, quality gate, HTML drilldown - Scoring Consistency — unified scoring formula, tool detection fix
- Analyzer Unification — plugin protocol,
PythonAnalyzer, generic field names - Multi-Language — TypeScript analyzer, mixed-project support
- Research Pipeline — dataset annotation, deduplication, BugsInPy validation
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.5.0.tar.gz.
File metadata
- Download URL: dr_huatuo-0.5.0.tar.gz
- Upload date:
- Size: 895.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 |
a87335db69e9303b73bfdf5c1790fb2a760e6bb5b5b3d5171428cbc0ea2c3b64
|
|
| MD5 |
07c5523b39d092c8e352680a47978ce0
|
|
| BLAKE2b-256 |
f4778dd644d0c9a61e4253355d678150e8f166bc85eddbba5d724d87e14735fd
|
Provenance
The following attestation bundles were made for dr_huatuo-0.5.0.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.5.0.tar.gz -
Subject digest:
a87335db69e9303b73bfdf5c1790fb2a760e6bb5b5b3d5171428cbc0ea2c3b64 - Sigstore transparency entry: 1205586715
- Sigstore integration time:
-
Permalink:
frankyxhl/dr-huatuo@7192be14c7b65fba2c5f28f509faf0fc78829063 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/frankyxhl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7192be14c7b65fba2c5f28f509faf0fc78829063 -
Trigger Event:
release
-
Statement type:
File details
Details for the file dr_huatuo-0.5.0-py3-none-any.whl.
File metadata
- Download URL: dr_huatuo-0.5.0-py3-none-any.whl
- Upload date:
- Size: 78.3 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 |
9bd99e8cc64d47626552e3e8e5f9694b868892dfb588f5c59c5beda5b0409a93
|
|
| MD5 |
99ea4ba909fee07bc51efa77b7b85a78
|
|
| BLAKE2b-256 |
666446fb3f13671a43edc0aefdf6a92704bd07e353342ad98246cb52ff61fd4d
|
Provenance
The following attestation bundles were made for dr_huatuo-0.5.0-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.5.0-py3-none-any.whl -
Subject digest:
9bd99e8cc64d47626552e3e8e5f9694b868892dfb588f5c59c5beda5b0409a93 - Sigstore transparency entry: 1205586726
- Sigstore integration time:
-
Permalink:
frankyxhl/dr-huatuo@7192be14c7b65fba2c5f28f509faf0fc78829063 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/frankyxhl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7192be14c7b65fba2c5f28f509faf0fc78829063 -
Trigger Event:
release
-
Statement type: